Ejemplo n.º 1
0
        public System.Windows.Forms.DialogResult ShowDialog(FamiStudioForm parent)
        {
#if FAMISTUDIO_LINUX
            Run();
            Hide();
#else
            Show();

            if (WindowPosition == WindowPosition.CenterOnParent)
            {
                var mainWinRect = parent.Bounds;
                int x           = mainWinRect.Left + (mainWinRect.Width - Allocation.Width) / 2;
                int y           = mainWinRect.Top + (mainWinRect.Height - Allocation.Height) / 2;
                Move(x, y);
            }

            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));

            while (result == System.Windows.Forms.DialogResult.None)
            {
                Application.RunIteration();
            }

            Hide();

            MacUtils.RestoreMainNSWindowFocus();
#endif

            return(result);
        }
Ejemplo n.º 2
0
        private bool RunValidation()
        {
            if (ValidateProperties == null)
            {
                return(true);
            }

#if FAMISTUDIO_MACOS
            MacUtils.RemoveNSWindowAlwaysOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif
            // Validation might display messages boxes, need to work around z-ordering issues.
            bool valid = ValidateProperties.Invoke(propertyPage);

#if FAMISTUDIO_MACOS
            // This fixes some super weird focus issues.
            if (!valid)
            {
                Hide();
                Show();
            }

            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif

            return(valid);
        }
Ejemplo n.º 3
0
        public System.Windows.Forms.DialogResult ShowDialog(FamiStudioForm parent = null)
        {
#if FAMISTUDIO_MACOS
            Show();

            int x = parent.Bounds.Left + (parent.Bounds.Width - Allocation.Width) / 2;
            int y = parent.Bounds.Top + (parent.Bounds.Height - Allocation.Height) / 2;
            Move(x, y);
            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));

            while (result == System.Windows.Forms.DialogResult.None)
            {
                Application.RunIteration();
            }

            Hide();

            MacUtils.RestoreMainNSWindowFocus();
#else
            Run();
            Hide();
#endif

            return(result);
        }
Ejemplo n.º 4
0
        public System.Windows.Forms.DialogResult ShowDialog(FamiStudioForm parent = null)
        {
            Show();

            if (topAlign || leftAlign)
            {
                var pt = initialLocation;
                if (leftAlign)
                {
                    pt.X -= Allocation.Width;
                }
                if (topAlign)
                {
                    pt.Y -= Allocation.Height;
                }
                Move(pt.X, pt.Y);
            }

#if FAMISTUDIO_MACOS
            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif

            while (result == System.Windows.Forms.DialogResult.None)
            {
                Application.RunIteration();
            }

            Hide();

#if FAMISTUDIO_MACOS
            MacUtils.RestoreMainNSWindowFocus();
#endif

            return(result);
        }
Ejemplo n.º 5
0
        public void ShowModal(FamiStudioForm parent = null)
        {
            Show();

#if FAMISTUDIO_MACOS
            if (WindowPosition == WindowPosition.CenterOnParent)
            {
                var mainWinRect = parent.Bounds;
                int x           = mainWinRect.Left + (mainWinRect.Width - Allocation.Width) / 2;
                int y           = mainWinRect.Top + (mainWinRect.Height - Allocation.Height) / 2;
                Move(x, y);
            }

            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif
        }
Ejemplo n.º 6
0
        public System.Windows.Forms.DialogResult ShowDialog(FamiStudioForm parent)
        {
            Show();

            if (topAlign || leftAlign)
            {
                Debug.Assert(WindowPosition == WindowPosition.None);

                var pt = initialLocation;
                if (leftAlign)
                {
                    pt.X -= Allocation.Width;
                }
                if (topAlign)
                {
                    pt.Y -= Allocation.Height;
                }
                Move(pt.X, pt.Y);
            }

#if FAMISTUDIO_MACOS
            if (WindowPosition == WindowPosition.CenterOnParent)
            {
                var mainWinRect = parent.Bounds;
                int x           = mainWinRect.Left + (mainWinRect.Width - Allocation.Width) / 2;
                int y           = mainWinRect.Top + (mainWinRect.Height - Allocation.Height) / 2;
                Move(x, y);
            }

            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif

            while (result == System.Windows.Forms.DialogResult.None)
            {
                Application.RunIteration();
            }

            Hide();

#if FAMISTUDIO_MACOS
            MacUtils.RestoreMainNSWindowFocus();
#endif

            return(result);
        }
Ejemplo n.º 7
0
        public System.Windows.Forms.DialogResult ShowDialog()
        {
            Show();
#if FAMISTUDIO_MACOS
            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif

            while (result == System.Windows.Forms.DialogResult.None)
            {
                Application.RunIteration();
            }

            Hide();
#if FAMISTUDIO_MACOS
            MacUtils.RestoreMainNSWindowFocus();
#endif

            return(result);
        }
Ejemplo n.º 8
0
        public System.Windows.Forms.DialogResult ShowDialog()
        {
            Show();

            if (topAlign || leftAlign)
            {
                GetPosition(out var x, out var y);
                if (leftAlign)
                {
                    x -= Allocation.Width;
                }
                if (topAlign)
                {
                    y -= Allocation.Height;
                }
                Move(x, y);
            }

#if FAMISTUDIO_MACOS
            MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
#endif

            while (result == System.Windows.Forms.DialogResult.None)
            {
                Application.RunIteration();
            }

            Hide();

#if FAMISTUDIO_MACOS
            MacUtils.RestoreMainNSWindowFocus();
#else
            PlatformUtils.ProcessPendingEvents();
#endif

            return(result);
        }
Ejemplo n.º 9
0
 public void TemporarelyShow()
 {
     Show();
     Move(tempPosX, tempPosY);
     MacUtils.SetNSWindowAlwayOnTop(MacUtils.NSWindowFromGdkWindow(GdkWindow.Handle));
 }