mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-28 14:51:36 +00:00
Write replacements for the unimplemented native calls for unix
This commit is contained in:
parent
0d07050bcb
commit
87fe50df56
3 changed files with 40 additions and 11 deletions
|
@ -598,7 +598,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
enumscombo.Location = new Point(cellrect.Left, cellrect.Top);
|
enumscombo.Location = new Point(cellrect.Left, cellrect.Top);
|
||||||
enumscombo.Width = cellrect.Width;
|
enumscombo.Width = cellrect.Width;
|
||||||
int internalheight = cellrect.Height - (enumscombo.Height - enumscombo.ClientRectangle.Height) - 6;
|
int internalheight = cellrect.Height - (enumscombo.Height - enumscombo.ClientRectangle.Height) - 6;
|
||||||
General.SendMessage(enumscombo.Handle, General.CB_SETITEMHEIGHT, new IntPtr(-1), new IntPtr(internalheight));
|
General.SetComboBoxItemHeight(enumscombo, internalheight);
|
||||||
|
|
||||||
// Select the value of this field (for DropDownList style combo)
|
// Select the value of this field (for DropDownList style combo)
|
||||||
foreach(EnumItem i in enumscombo.Items)
|
foreach(EnumItem i in enumscombo.Items)
|
||||||
|
|
|
@ -51,10 +51,24 @@ namespace CodeImp.DoomBuilder
|
||||||
|
|
||||||
#if NO_WIN32
|
#if NO_WIN32
|
||||||
|
|
||||||
internal static bool LockWindowUpdate(IntPtr hwnd) { return true; }
|
internal static void InvokeUIActions(MainForm mainform)
|
||||||
internal static bool MessageBeep(MessageBeepType type) { return true; }
|
{
|
||||||
internal static int SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam) { return 0; }
|
// This implementation really should work universally, but it seemed to hang sometimes on Windows.
|
||||||
internal static int PostMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam) { return 0; }
|
// Let's hope the mono implementation of Winforms works better.
|
||||||
|
mainform.Invoke(new System.Action(() => { mainform.ProcessQueuedUIActions(); }));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static bool MessageBeep(MessageBeepType type)
|
||||||
|
{
|
||||||
|
System.Media.SystemSounds.Beep.Play();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static bool LockWindowUpdate(IntPtr hwnd)
|
||||||
|
{
|
||||||
|
// This can be safely ignored. It is a performance/flicker optimization. It might not even be needed on Windows anymore.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
internal unsafe static void ZeroPixels(PixelColor* pixels, int size)
|
internal unsafe static void ZeroPixels(PixelColor* pixels, int size)
|
||||||
{
|
{
|
||||||
|
@ -63,6 +77,11 @@ namespace CodeImp.DoomBuilder
|
||||||
pixels[i] = transparent;
|
pixels[i] = transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void SetComboBoxItemHeight(ComboBox combobox, int height)
|
||||||
|
{
|
||||||
|
// Only used by FieldsEditorControl. Not sure what its purpose is, might only be visual adjustment that isn't strictly needed?
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
internal static extern bool LockWindowUpdate(IntPtr hwnd);
|
internal static extern bool LockWindowUpdate(IntPtr hwnd);
|
||||||
|
@ -73,10 +92,20 @@ namespace CodeImp.DoomBuilder
|
||||||
internal unsafe static void ZeroPixels(PixelColor* pixels, int size) { ZeroMemory(new IntPtr(pixels), size * sizeof(PixelColor)); }
|
internal unsafe static void ZeroPixels(PixelColor* pixels, int size) { ZeroMemory(new IntPtr(pixels), size * sizeof(PixelColor)); }
|
||||||
|
|
||||||
[DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern int SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
static extern int SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
internal static void SetComboBoxItemHeight(ComboBox combobox, int height)
|
||||||
|
{
|
||||||
|
SendMessage(combobox.Handle, General.CB_SETITEMHEIGHT, new IntPtr(-1), new IntPtr(height));
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll", EntryPoint = "PostMessage", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("user32.dll", EntryPoint = "PostMessage", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern int PostMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
static extern int PostMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
internal static void InvokeUIActions(MainForm mainform)
|
||||||
|
{
|
||||||
|
PostMessage(mainform.Handle, General.WM_UIACTION, IntPtr.Zero, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
internal static extern bool MessageBeep(MessageBeepType type);
|
internal static extern bool MessageBeep(MessageBeepType type);
|
||||||
|
|
|
@ -4144,7 +4144,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
object syncobject = new object();
|
object syncobject = new object();
|
||||||
List<System.Action> queuedActions = new List<System.Action>();
|
List<System.Action> queuedActions = new List<System.Action>();
|
||||||
|
|
||||||
void ProcessQueuedUIActions()
|
internal void ProcessQueuedUIActions()
|
||||||
{
|
{
|
||||||
List<System.Action> queue;
|
List<System.Action> queue;
|
||||||
lock (syncobject)
|
lock (syncobject)
|
||||||
|
@ -4175,7 +4175,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
General.PostMessage(Handle, General.WM_UIACTION, IntPtr.Zero, IntPtr.Zero);
|
General.InvokeUIActions(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue