protected AddonHostForm()
            : base("TXT_APP_NAME")
        {
            InitializeComponent();
            SetNavPanelOrientation(Orientation.Vertical);

            this.Shown += new EventHandler(MainForm_Load);
            //this.Load += new EventHandler(MainForm_Load);

            this.HandleDestroyed += new EventHandler(MainForm_HandleDestroyed);

            this.ShowInTaskbar   = true;
            lblNoItems.Text      = Translator.Translate("TXT_THEREARENOITEMS");
            lblNoProperties.Text = Translator.Translate("TXT_THEREARENOITEMS");
            lblNoPreview.Text    = Translator.Translate("TXT_THEREARENOITEMS");

            this.Location    = AppConfig.WindowLocation;
            this.Size        = AppConfig.WindowSize;
            this.WindowState = AppConfig.WindowState;

            tsmiSettings.ShortcutKeyDisplayString =
                ShortcutMapper.GetShortcutString(OPMShortcut.CmdOpenSettings);

            tsmiSettings.Image = Resources.Settings.Transparent();

            SetColors();

            ExitEditPathMode(false);
        }
Beispiel #2
0
        private void BuildMenuText(ToolStripItem tsm, string tag, string param, OPMShortcut command)
        {
            tsm.ToolTipText =
                (tsm.Enabled && !string.IsNullOrEmpty(param)) ? Translator.Translate(tag) + ": " + param :
                Translator.Translate(tag);
            tsm.Text = Translator.Translate(tag);

            if (tsm is OPMToolStripMenuItem)
            {
                string text = tsm.ToolTipText;
                if (text.Length > 45)
                {
                    tsm.Text = text.Substring(0, 45) + "...";
                }
                else
                {
                    tsm.ToolTipText = string.Empty;
                    tsm.Text        = text;
                }

                if (command != OPMShortcut.CmdOutOfRange)
                {
                    (tsm as OPMToolStripMenuItem).ShortcutKeyDisplayString =
                        ShortcutMapper.GetShortcutString(command);
                }
            }
            else
            {
                if (command != OPMShortcut.CmdOutOfRange)
                {
                    tsm.ToolTipText +=
                        string.Format(" ({0})", ShortcutMapper.GetShortcutString(command));
                }
            }
        }
Beispiel #3
0
        private void BuildMenuText(ToolStripItem tsm, string tag, string param, OPMShortcut command)
        {
            tsm.ToolTipText =
                (tsm.Enabled && !string.IsNullOrEmpty(param)) ?
                Translator.Translate(tag) + ": " + param :
                Translator.Translate(tag);
            tsm.Text = Translator.Translate(tag);

            if (tsm is OPMToolStripMenuItem)
            {
                tsm.Text = tsm.ToolTipText;
                if (command != OPMShortcut.CmdOutOfRange)
                {
                    (tsm as OPMToolStripMenuItem).ShortcutKeyDisplayString =
                        ShortcutMapper.GetShortcutString(command);
                }
            }
            else
            {
                if (command != OPMShortcut.CmdOutOfRange)
                {
                    tsm.ToolTipText +=
                        string.Format(" ({0})", ShortcutMapper.GetShortcutString(command));
                }

                // TODO FIX
                //if (command == OPMShortcut.CmdGenericOpen && _recentFiles.Count > 0 && AppSettings.MCRememberRecentFiles)
                //{
//                    tsm.ToolTipText += "\r\n" + Translator.Translate("TXT_OPENRECENTFILEDROPDOWN");
//              }
            }
        }
        private void OnMouseHover(object sender, EventArgs e)
        {
            ToolStripButton btn = sender as ToolStripButton;

            if (btn != null)
            {
                _hoveredItem = btn;

                OPMShortcut cmd         = (OPMShortcut)btn.Tag;
                string      resourceTag = string.Format("TXT_{0}", cmd.ToString().ToUpperInvariant()).Replace("CMD", "BTN");
                string      tipText     = Translator.Translate(resourceTag, ShortcutMapper.GetShortcutString(cmd));
                _tip.ShowSimpleToolTip(tipText, btn.Image);
            }
        }
Beispiel #5
0
        private void AttachFileMenuItems(PlaylistItem playlistItem, MenuWrapper <T> menu, EventHandler clickHandler)
        {
            if (EnableSubtitleEntry(playlistItem))
            {
                if (menu.MenuItemsCount > 0)
                {
                    menu.AddSingleEntry(new OPMMenuStripSeparator());
                }

                string str = Translator.Translate("TXT_SEARCH_SUBTITLES");
                OPMToolStripMenuItem tsmi = new OPMToolStripMenuItem(str);
                tsmi.Click += clickHandler;
                tsmi.Tag    = OPMShortcut.CmdSearchSubtitles;
                tsmi.ShortcutKeyDisplayString = ShortcutMapper.GetShortcutString(OPMShortcut.CmdSearchSubtitles);

                menu.AddSingleEntry(tsmi);
            }
        }
Beispiel #6
0
        private void BuildMenuText(ToolStripItem tsm, string tag, string param, OPMShortcut command)
        {
            tsm.ToolTipText =
                (tsm.Enabled && !string.IsNullOrEmpty(param)) ?
                Translator.Translate(tag) + ": " + param :
                Translator.Translate(tag);
            tsm.Text = Translator.Translate(tag);

            if (tsm is OPMToolStripMenuItem)
            {
                string text = tsm.ToolTipText;
                if (text.Length > 45)
                {
                    tsm.Text = text.Substring(0, 45) + "...";
                }
                else
                {
                    tsm.ToolTipText = string.Empty;
                    tsm.Text        = text;
                }

                if (command != OPMShortcut.CmdOutOfRange)
                {
                    (tsm as OPMToolStripMenuItem).ShortcutKeyDisplayString =
                        ShortcutMapper.GetShortcutString(command);
                }
            }
            else
            {
                if (command != OPMShortcut.CmdOutOfRange)
                {
                    tsm.ToolTipText +=
                        string.Format(" ({0})", ShortcutMapper.GetShortcutString(command));
                }

                if (command == OPMShortcut.CmdGenericOpen && _recentFiles.Count > 0 && BuiltinAddonConfig.MCRememberRecentFiles)
                {
                    tsm.ToolTipText += "\r\n" + Translator.Translate("TXT_OPENRECENTFILEDROPDOWN");
                }
            }
        }
 public void OnKeymapChanged()
 {
     tsmiSettings.ShortcutKeyDisplayString =
         ShortcutMapper.GetShortcutString(OPMShortcut.CmdOpenSettings);
 }
Beispiel #8
0
        private void BuildMenuEntry(OPMShortcut cmd, MenuWrapper <T> menu, EventHandler clickHandler, int index = -1, bool enabled = true)
        {
            if (cmd == OPMShortcut.CmdOpenDisk)
            {
                if (VideoDVDHelpers.IsOSSupported == false)
                {
                    return;
                }
            }

            string shortcuts = ShortcutMapper.GetShortcutString(cmd);
            string menuName  = cmd.ToString().ToUpperInvariant().Replace("CMD", "MNU");
            string imageName = "btn" + cmd.ToString().Replace("Cmd", "");

            string desc = Translator.Translate("TXT_" + menuName);

            OPMToolStripMenuItem tsmi = new OPMToolStripMenuItem(desc);

            tsmi.Click += clickHandler;
            tsmi.Tag    = cmd;
            tsmi.ShortcutKeyDisplayString = shortcuts;

            switch (cmd)
            {
            case OPMShortcut.CmdMoveUp:
                tsmi.Image = OPMedia.UI.Properties.Resources.Up16;
                break;

            case OPMShortcut.CmdMoveDown:
                tsmi.Image = OPMedia.UI.Properties.Resources.Down16;
                break;

            case OPMShortcut.CmdDelete:
                tsmi.Image = OPMedia.UI.Properties.Resources.Delete16;
                break;

            case OPMShortcut.CmdLoadPlaylist:
                tsmi.Image = OPMedia.UI.Properties.Resources.Open16;
                break;

            case OPMShortcut.CmdSavePlaylist:
                tsmi.Image = OPMedia.UI.Properties.Resources.Save16;
                break;

            case OPMShortcut.CmdOpenDisk:
                tsmi.Image = ImageProcessing.DVD;
                break;

            case OPMShortcut.CmdOpenURL:
                tsmi.Image = OPMedia.Core.Properties.Resources.Internet;
                break;

            case OPMShortcut.CmdPlayPause:
            {
                Bitmap img = null;

                switch (MediaRenderer.DefaultInstance.FilterState)
                {
                case Runtime.ProTONE.Rendering.DS.BaseClasses.FilterState.Paused:
                    img = Resources.btnPlay;
                    break;

                case Runtime.ProTONE.Rendering.DS.BaseClasses.FilterState.Running:
                    img = Resources.btnPause;
                    break;

                default:
                    img = Resources.btnPlay;
                    break;
                }

                img.MakeTransparent(ThemeManager.TransparentColor);
                tsmi.Image = img;
            }
            break;

            case OPMShortcut.CmdCfgAudio:
                tsmi.Image = ImageProcessing.AudioFile16;
                break;

            case OPMShortcut.CmdCfgVideo:
                tsmi.Image = ImageProcessing.VideoFile16;
                break;

            case OPMShortcut.CmdCfgSubtitles:
                tsmi.Image = ImageProcessing.Subtitle16;
                break;

            case OPMShortcut.CmdOpenSettings:
                tsmi.Image = OPMedia.UI.Properties.Resources.Settings16;
                break;

            case OPMShortcut.CmdCfgTimer:
                tsmi.Image = Resources.IconTime;
                break;

            default:
                tsmi.Image = Resources.ResourceManager.GetImage(imageName);
                break;
            }

            tsmi.Enabled = enabled;

            if (index >= 0)
            {
                menu.InsertSingleEntry(index, tsmi);
            }
            else
            {
                menu.AddSingleEntry(tsmi);
            }
        }
Beispiel #9
0
        void cmsMain_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = MainThread.AreModalFormsOpen;
            if (e.Cancel)
            {
                MainThread.ModalForm.Activate();
                return;
            }

            cmsMain.SuspendLayout();

            while (_cmdMenusCount > 0)
            {
                cmsMain.Items.RemoveAt(0);
                _cmdMenusCount--;
            }

            _cmdMenusCount = new MenuBuilder <ContextMenuStrip>(null).BuildCommandsMenu(0,
                                                                                        new MenuWrapper <ContextMenuStrip>(cmsMain), new EventHandler(NotifyMenuClick));

            foreach (ToolStripItem tsi in cmsMain.Items)
            {
                if (tsi == mnuMediaState)
                {
                    continue;
                }

                string text = tsi.Text;

                if (text.Length > 45)
                {
                    tsi.Text        = text.Substring(0, 45) + "...";
                    tsi.ToolTipText = text;
                }
                else
                {
                    tsi.ToolTipText = "";
                }

                if (tsi is OPMToolStripMenuItem && tsi.Tag != null)
                {
                    switch ((OPMShortcut)tsi.Tag)
                    {
                    case OPMShortcut.CmdToggleShuffle:
                        (tsi as OPMToolStripMenuItem).Checked = ProTONEConfig.ShufflePlaylist;
                        break;

                    case OPMShortcut.CmdPlaylistEnd:
                        (tsi as OPMToolStripMenuItem).Checked = SystemScheduler.PlaylistEventEnabled;
                        break;

                    case OPMShortcut.CmdLoopPlay:
                        (tsi as OPMToolStripMenuItem).Checked = ProTONEConfig.LoopPlay;
                        break;
                    }

                    if (tsi.Tag != null)
                    {
                        (tsi as OPMToolStripMenuItem).ShortcutKeyDisplayString =
                            ShortcutMapper.GetShortcutString((OPMShortcut)tsi.Tag);
                    }
                }
            }

            // Dummy playlist item  - required to prevent initial "delayed" opening
            mnuPlaylistPlaceholder.DropDownItems.Add(string.Empty);
            mnuPlaylistPlaceholder.DropDownOpening += new EventHandler(mnuPlaylist_DropDownOpening);

            mnuTools.DropDownItems.Add(string.Empty);
            mnuTools.DropDownOpening += new EventHandler(mnuTools_DropDownOpening);

            volumeScale.Width = timeScale.Width = 250;

            cmsMain.ResumeLayout();
        }