private void notifyIcon1_MouseUp(object sender, MouseEventArgs e) { if (DeactivatedOnIcon) { DeactivatedOnIcon = false; return; } if (ModifierKeys.HasFlag(Keys.Alt)) { return; } if (listDevices.Items.Count > 0) { VolBar.RegisterDevice(RenderType); } if (e.Button == MouseButtons.Left) { timer1.Enabled = true; Show(); Activate(); } }
private void notifyIcon1_MouseUp(object sender, MouseEventArgs e) { if (ModifierKeys.HasFlag(Keys.Alt)) { return; } switch (e.Button) { case MouseButtons.Left: if (!Program.stfu) { timer1.Enabled = true; Show(); Activate(); } break; case MouseButtons.Right: if (EndPoints.DeviceNames.Count > 0) { CurrentDevice = CurrentDevice == EndPoints.DeviceNames.Count - 1 ? 0 : CurrentDevice + 1; EndPoints.SetDefaultDevice(CurrentDevice); if (!Program.stfu) { notifyIcon.ShowBalloonTip(0, "Audio device changed", EndPoints.DeviceNames[CurrentDevice], ToolTipIcon.Info); } } break; } VolBar.RegisterDevice(RenderType); }
private void FormSwitcher_Deactivate(object sender, EventArgs e) { Hide(); timer1.Enabled = false; RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); VolBar.RegisterDevice(RenderType); }
private void FormSwitcher_Deactivate(object sender, EventArgs e) { Hide(); timer1.Enabled = false; VolBar.UnregisterDevice(); RenderType = EDataFlow.eRender; RefreshDevices(false); VolBar.RegisterDevice(RenderType); }
public FormSwitcher() { InitializeComponent(); ledLeft.OldStyle = Program.settings.ColorVU; ledLeft.SetValue((float)0.1); ledRight.OldStyle = Program.settings.ColorVU; ledRight.SetValue((float)0.1); SetWindowTheme(listDevices.Handle, "explorer", null); using (var gr = CreateGraphics()) DpiFactor = gr.DpiX / 96; var tile = new Size(listDevices.ClientSize.Width + 2, (int)(listDevices.TileSize.Height * DpiFactor)); DeviceIcons.InitImageLists(DpiFactor); listDevices.TileSize = tile; listDevices.Scroll += VolBar.DoScroll; listDevices.LargeImageList = DeviceIcons.ActiveIcons; if (DpiFactor <= 1) { DefaultTrayIcons.Add(getIcon(Resources.mute)); DefaultTrayIcons.Add(getIcon(Resources.zero)); DefaultTrayIcons.Add(getIcon(Resources._1_33)); DefaultTrayIcons.Add(getIcon(Resources._33_66)); DefaultTrayIcons.Add(getIcon(Resources._66_100)); } else { DefaultTrayIcons.Add(getIcon(Resources.mute_highDPI)); DefaultTrayIcons.Add(getIcon(Resources.zero_highDPI)); DefaultTrayIcons.Add(getIcon(Resources._1_33_highDPI)); DefaultTrayIcons.Add(getIcon(Resources._33_66_highDPI)); DefaultTrayIcons.Add(getIcon(Resources._66_100_highDPI)); } RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); SetTrayIcons(); VolBar.VolumeMuteChanged += IconChanged; VolBar.RegisterDevice(RenderType); EndPoints.NotifyClient.DefaultChanged += DefaultChanged; EndPoints.NotifyClient.DeviceAdded += DeviceAdded; EndPoints.NotifyClient.DeviceRemoved += DeviceRemoved; GlobalHotkeys.Handle = Handle; GlobalHotkeys.RegisterAll(); ScrollVolume.VolumeScroll += ScrollTheVolume; ScrollVolume.RegisterVolScroll(Program.settings.VolumeScroll.Enabled); }
private void listDevices_Click(object sender, EventArgs e) { foreach (ListViewItem item in listDevices.Items) { SetDeviceIcon(item.Index, item.Selected); if (item.Selected) { listDevices.BeginUpdate(); SetTrayIcons(); EndPoints.SetDefaultDevice(listDevices.SelectedItems[0].Tag.ToString()); VolBar.RegisterDevice(RenderType); listDevices.EndUpdate(); } } }
private void FormSwitcher_Deactivate(object sender, EventArgs e) { Hide(); timer1.Enabled = false; RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); VolBar.RegisterDevice(RenderType); var iconpos = WindowPosition.GetNotifyIconArea(notifyIcon); var iconrect = new Rectangle(iconpos.left, iconpos.top, iconpos.right - iconpos.left, iconpos.bottom - iconpos.top); if (iconrect.Contains(Cursor.Position)) { DeactivatedOnIcon = true; } }
private void notifyIcon1_MouseUp(object sender, MouseEventArgs e) { if (DeactivatedOnIcon) { DeactivatedOnIcon = false; return; } VolBar.RegisterDevice(RenderType); if (e.Button == MouseButtons.Left) { timer1.Enabled = true; Show(); Activate(); } }
private void DefaultChanged(string devID) { if (InvokeRequired) { BeginInvoke(new DevEventDelegate(DefaultChanged), devID); } else { foreach (ListViewItem item in listDevices.Items) { if ((string)item.Tag == devID) { item.Selected = true; SetTrayIcons(); VolBar.RegisterDevice(RenderType); } SetDeviceIcon(item.Index, item.Selected); } } }
private void listDevices_Click(object sender, EventArgs e) { foreach (ListViewItem item in listDevices.Items) { SetDeviceIcon(item.ImageIndex, item.Selected); if (item.Selected) { listDevices.BeginUpdate(); SetTrayIcons(); EndPoints.SetDefaultDevice(listDevices.SelectedItems[0].Tag.ToString()); VolBar.RegisterDevice(RenderType); listDevices.EndUpdate(); } } if (Program.settings.CloseAfterSelecting) { FormSwitcher_Deactivate(sender, e); } }
private void FormSwitcher_Deactivate(object sender, EventArgs e) { if (Disposing || Program.settings.AlwaysVisible) { return; } Hide(); timer1.Enabled = false; RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); VolBar.RegisterDevice(RenderType); var rect = WindowPosition.GetNotifyIconArea(notifyIcon); var iconrect = new Rectangle((int)(rect.left / DpiFactor), (int)(rect.top / DpiFactor), (int)(rect.right / DpiFactor) - (int)(rect.left / DpiFactor), (int)(rect.bottom / DpiFactor) - (int)(rect.top / DpiFactor)); if (iconrect.Contains(Cursor.Position)) { DeactivatedOnIcon = true; } }
private void OpenAlwaysVisible() { if (Program.settings.FreePosLeft == 0 || Program.settings.FreePosTop == 0) { var point = WindowPosition.GetWindowPosition(notifyIcon, Width, Height); Left = point.X; Top = point.Y; } else { Left = Program.settings.FreePosLeft; Top = Program.settings.FreePosTop; } RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); SetSizes(); VolBar.RegisterDevice(RenderType); timer1.Enabled = true; Show(); Activate(); }
public FormSwitcher() { InitializeComponent(); SetWindowTheme(listDevices.Handle, "explorer", null); using (var gr = CreateGraphics()) DpiFactor = gr.DpiX / 96; var tile = new Size(listDevices.ClientSize.Width + 2, (int)(listDevices.TileSize.Height * DpiFactor)); listDevices.TileSize = tile; if (DpiFactor == 1) { TrayIcons.Add(getIcon(Resources.mute)); TrayIcons.Add(getIcon(Resources.zero)); TrayIcons.Add(getIcon(Resources._1_33)); TrayIcons.Add(getIcon(Resources._33_66)); TrayIcons.Add(getIcon(Resources._66_100)); } else { TrayIcons.Add(getIcon(Resources.mute_highDPI)); TrayIcons.Add(getIcon(Resources.zero_highDPI)); TrayIcons.Add(getIcon(Resources._1_33_highDPI)); TrayIcons.Add(getIcon(Resources._33_66_highDPI)); TrayIcons.Add(getIcon(Resources._66_100_highDPI)); } RefreshDevices(false); VolBar.VolumeMuteChanged += IconChanged; VolBar.RegisterDevice(RenderType); listDevices.Scroll += VolBar.DoScroll; DeviceIcons.InitImageLists(DpiFactor); listDevices.LargeImageList = DeviceIcons.ActiveIcons; Hotkey.handle = Handle; Hotkey.RegisterHotKey(notifyIcon); }
private void listDevices_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { listDevices.BeginUpdate(); if (!e.IsSelected) { listDevices.LargeImageList.Images[CurrentDevice].Dispose(); listDevices.LargeImageList.Images[CurrentDevice] = DeviceIcons.NormalIcons.Images[CurrentDevice]; } else if (CurrentDevice != e.ItemIndex) { CurrentDevice = e.ItemIndex; EndPoints.SetDefaultDevice(CurrentDevice); VolBar.UnregisterDevice(); VolBar.RegisterDevice(RenderType); listDevices.LargeImageList.Images[CurrentDevice].Dispose(); listDevices.LargeImageList.Images[CurrentDevice] = DeviceIcons.DefaultIcons.Images[CurrentDevice]; } listDevices.EndUpdate(); }
private void notifyIcon1_MouseDown(object sender, MouseEventArgs e) { if (ModifierKeys == Keys.Shift) { Close(); Application.Exit(); return; } VolBar.UnregisterDevice(); RenderType = ModifierKeys.HasFlag(Keys.Control) ? EDataFlow.eCapture : EDataFlow.eRender; if (ModifierKeys.HasFlag(Keys.Alt)) { RefreshDevices(false); VolBar.RegisterDevice(RenderType); VolBar.ChangeMute(); VolBar.UnregisterDevice(); if (RenderType == EDataFlow.eCapture && !Program.stfu) { var mutetxt = String.Format("Device {0}muted", VolBar.Mute ? "" : "un"); notifyIcon.ShowBalloonTip(0, mutetxt, EndPoints.DeviceNames[CurrentDevice], ToolTipIcon.Info); } RenderType = EDataFlow.eRender; RefreshDevices(false); VolBar.RegisterDevice(RenderType); return; } RefreshDevices(true); if (e.Button == MouseButtons.Left) { SetSizes(); } }
public FormSwitcher() { InitializeComponent(); IsWin10 = Environment.OSVersion.Version.Major == 10; if (IsWin10) { FormBorderStyle = FormBorderStyle.FixedToolWindow; } SetWindowTheme(listDevices.Handle, "explorer", null); ledLeft.OldStyle = Program.settings.ColorVU; ledLeft.SetValue((float)0.1); ledRight.OldStyle = Program.settings.ColorVU; ledRight.SetValue((float)0.1); DpiFactor = getScalingFactor(); var tile = new Size(listDevices.ClientSize.Width + 2, (int)(listDevices.TileSize.Height * DpiFactor)); DeviceIcons.InitImageLists(DpiFactor); listDevices.TileSize = tile; listDevices.Scroll += VolBar.DoScroll; ledLeft.DoScroll += VolBar.DoScroll; ledRight.DoScroll += VolBar.DoScroll; listDevices.LargeImageList = DeviceIcons.ActiveIcons; if (DpiFactor <= 1) { DefaultTrayIcons.Add(getIcon(Resources.mute)); DefaultTrayIcons.Add(getIcon(Resources.zero)); DefaultTrayIcons.Add(getIcon(Resources._1_33)); DefaultTrayIcons.Add(getIcon(Resources._33_66)); DefaultTrayIcons.Add(getIcon(Resources._66_100)); } else { DefaultTrayIcons.Add(getIcon(Resources.mute_highDPI)); DefaultTrayIcons.Add(getIcon(Resources.zero_highDPI)); DefaultTrayIcons.Add(getIcon(Resources._1_33_highDPI)); DefaultTrayIcons.Add(getIcon(Resources._33_66_highDPI)); DefaultTrayIcons.Add(getIcon(Resources._66_100_highDPI)); } RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); SetTrayIcons(); VolBar.VolumeMuteChanged += IconChanged; VolBar.RegisterDevice(RenderType); EndPoints.NotifyClient.DefaultChanged += DefaultChanged; EndPoints.NotifyClient.DeviceAdded += DeviceAdded; EndPoints.NotifyClient.DeviceRemoved += DeviceRemoved; GlobalHotkeys.Handle = Handle; GlobalHotkeys.RegisterAll(); ScrollVolume.VolumeScroll += ScrollTheVolume; ScrollVolume.RegisterVolScroll(Program.settings.VolumeScroll.Enabled); if (Program.settings.AlwaysVisible) { OpenAlwaysVisible(); } }