public void restoreMaxiState() { mini = false; // Maxi form settings Padding = new Padding(2, 24, 2, 2); if (GPMBrowser != null) { GPMBrowser.SetZoomLevel(0); } FormBorderStyle = FormBorderStyle.Sizable; MaximumSize = new Size(); // Force it to be always bigger than the mini player MinimumSize = new Size(301, 301); MaximizeBox = true; handleZoom = false; // Restore Maxi size and pos Size savedSize = Properties.Settings.Default.MaxiSize; Point savedPoint = Properties.Settings.Default.MaxiPoint; if (savedSize.Height == -1 && savedSize.Width == -1) { savedSize = new Size(1080, 720); } savedPoint = (onScreen(savedPoint) ? savedPoint : new Point(-1, -1)); if (savedPoint.X == -1 && savedPoint.Y == -1) { savedPoint = topLeft(savedSize); } Location = savedPoint; FormBorderStyle = FormBorderStyle.None; Size = savedSize; FormBorderStyle = FormBorderStyle.Sizable; }
private void setZoomRatio() { // DPI CALCS float dpiX, dpiY; Graphics graphics = this.CreateGraphics(); dpiX = graphics.DpiX; dpiY = graphics.DpiY; int ratioX, ratioY; ratioX = (int)dpiX / 96; ratioY = (int)dpiY / 96; // The mini player must always be a square int D = Math.Max(ClientSize.Width, ClientSize.Height); ClientSize = new Size(D, D); var tmp = Size; Size = tmp; double ratio = D / (300.0 * ratioX); // Browser zoom level formula is [percentage] = 1.2 ^ [zoom level] // So we reverse to get [zoom level] = Log[percentage] / Log[1.2] double factor = Math.Log10(ratio) / Math.Log10(1.2); GPMBrowser.SetZoomLevel(factor); }
public void restoreMaxiState() { int ratioX = MaterialSkin.Utilities.DPIMath.ratioX(this); int ratioY = MaterialSkin.Utilities.DPIMath.ratioY(this); mini = false; FormBorderStyle targetStyle; if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1) { targetStyle = FormBorderStyle.None; } else { targetStyle = FormBorderStyle.Sizable; } // Maxi form settings Padding = new Padding(2 * ratioX, 24 * ratioY, 2 * ratioX, 2 * ratioY); if (GPMBrowser != null) { GPMBrowser.SetZoomLevel(Properties.Settings.Default.MaxiZoomLevel); } FormBorderStyle = targetStyle; MaximumSize = new Size(); // Force it to be always bigger than the mini player MinimumSize = new Size(301 * ratioX, 301 * ratioY); MaximizeBox = true; handleZoom = false; // Restore Maxi size and pos Size savedSize = Properties.Settings.Default.MaxiSize; Point savedPoint = Properties.Settings.Default.MaxiPoint; if (savedSize.Height == -1 && savedSize.Width == -1) { savedSize = new Size(1080 * ratioX, 720 * ratioY); } savedPoint = (onScreen(savedPoint) ? savedPoint : new Point(-1, -1)); if (savedPoint.X == -1 && savedPoint.Y == -1) { savedPoint = topLeft(savedSize); } Location = savedPoint; FormBorderStyle = FormBorderStyle.None; Size = savedSize; FormBorderStyle = targetStyle; TopMost = false; }
private void setZoomRatio() { // The mini player must always be a square int D = Math.Max(ClientSize.Width, ClientSize.Height); ClientSize = new Size(D, D); var tmp = Size; Size = tmp; double ratio = D / 300.0; // Browser zoom level formula is [percentage] = 1.2 ^ [zoom level] // So we reverse to get [zoom level] = Log[percentage] / Log[1.2] double factor = Math.Log10(ratio) / Math.Log10(1.2); GPMBrowser.SetZoomLevel(factor); }
private void nextTrack() { GPMBrowser.EvaluateScriptAsync("(function() {document.querySelectorAll('[data-id=forward]')[0].click()})()"); }
// Media Functions private void playPause() { GPMBrowser.EvaluateScriptAsync("(function() {document.querySelectorAll('[data-id=play-pause]')[0].click()})()"); }
private void findFocus() { GPMBrowser.EvaluateScriptAsync("(function() {document.querySelectorAll('sj-search-box > input')[0].focus()})()"); }
private void nextTrack() { GPMBrowser.EvaluateScriptAsync("(function() {window.GPM.playback.forward();})()"); }
private void prevTrack() { GPMBrowser.EvaluateScriptAsync("(function() {window.GPM.playback.rewind();})()"); }
// Media Functions private void playPause() { GPMBrowser.EvaluateScriptAsync("(function() {window.GPM.playback.playPause();})()"); }