mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +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.Width = cellrect.Width;
|
||||
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)
|
||||
foreach(EnumItem i in enumscombo.Items)
|
||||
|
|
|
@ -51,10 +51,24 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
#if NO_WIN32
|
||||
|
||||
internal static bool LockWindowUpdate(IntPtr hwnd) { return true; }
|
||||
internal static bool MessageBeep(MessageBeepType type) { return true; }
|
||||
internal static int SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam) { return 0; }
|
||||
internal static int PostMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam) { return 0; }
|
||||
internal static void InvokeUIActions(MainForm mainform)
|
||||
{
|
||||
// This implementation really should work universally, but it seemed to hang sometimes on Windows.
|
||||
// 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)
|
||||
{
|
||||
|
@ -63,6 +77,11 @@ namespace CodeImp.DoomBuilder
|
|||
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
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern bool LockWindowUpdate(IntPtr hwnd);
|
||||
|
@ -73,12 +92,22 @@ namespace CodeImp.DoomBuilder
|
|||
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)]
|
||||
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);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "PostMessage", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int PostMessage(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", SetLastError = true)]
|
||||
[DllImport("user32.dll", EntryPoint = "PostMessage", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
||||
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)]
|
||||
internal static extern bool MessageBeep(MessageBeepType type);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
|
|
|
@ -4144,7 +4144,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
object syncobject = new object();
|
||||
List<System.Action> queuedActions = new List<System.Action>();
|
||||
|
||||
void ProcessQueuedUIActions()
|
||||
internal void ProcessQueuedUIActions()
|
||||
{
|
||||
List<System.Action> queue;
|
||||
lock (syncobject)
|
||||
|
@ -4175,7 +4175,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
if (notify)
|
||||
General.PostMessage(Handle, General.WM_UIACTION, IntPtr.Zero, IntPtr.Zero);
|
||||
General.InvokeUIActions(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue