From ccf2191f10be639af1755c26ce53e4de2ced7693 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl <dpjudas@users.noreply.github.com> Date: Sat, 12 Sep 2020 01:25:59 +0200 Subject: [PATCH] Add workaround for broken View.List implementation in mono's winforms --- Source/Core/BuilderMono.csproj | 14 +++++++------- Source/Core/Controls/LinedefInfoPanel.cs | 1 + Source/Core/Controls/SectorInfoPanel.cs | 1 + Source/Core/Controls/ThingInfoPanel.cs | 1 + Source/Core/General/General.cs | 14 +++++++++++++- Source/Core/Windows/ChangeMapForm.cs | 1 + Source/Core/Windows/ConfigForm.cs | 1 + Source/Core/Windows/OpenMapOptionsForm.cs | 2 ++ 8 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Source/Core/BuilderMono.csproj b/Source/Core/BuilderMono.csproj index 9462055f9..c2c3c0b2c 100644 --- a/Source/Core/BuilderMono.csproj +++ b/Source/Core/BuilderMono.csproj @@ -42,7 +42,7 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> <OutputPath>..\..\Build\</OutputPath> - <DefineConstants>DEBUG;TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>DEBUG;TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DebugType>full</DebugType> <PlatformTarget>x86</PlatformTarget> @@ -63,7 +63,7 @@ <ErrorReport>prompt</ErrorReport> <DocumentationFile> </DocumentationFile> - <DefineConstants>NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> <WarningLevel>4</WarningLevel> <DebugSymbols>true</DebugSymbols> <NoWarn>1591</NoWarn> @@ -72,7 +72,7 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug + Profiler|x86' "> <DebugSymbols>true</DebugSymbols> <OutputPath>..\..\Build\</OutputPath> - <DefineConstants>DEBUG;TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>DEBUG;TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DocumentationFile> </DocumentationFile> @@ -94,7 +94,7 @@ <PlatformTarget>x86</PlatformTarget> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> - <DefineConstants>TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> @@ -104,7 +104,7 @@ </DocumentationFile> <Prefer32Bit>false</Prefer32Bit> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <DefineConstants>TRACE;DEBUG;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>TRACE;DEBUG;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PlatformTarget>x64</PlatformTarget> @@ -112,14 +112,14 @@ <Prefer32Bit>false</Prefer32Bit> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <Optimize>true</Optimize> - <DefineConstants>TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug + Profiler|x64'"> <PlatformTarget>x64</PlatformTarget> <OutputPath>..\..\Build\</OutputPath> <Prefer32Bit>false</Prefer32Bit> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <DefineConstants>TRACE;DEBUG;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL</DefineConstants> + <DefineConstants>TRACE;DEBUG;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS</DefineConstants> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release + Profiler|x64'"> <PlatformTarget>x64</PlatformTarget> diff --git a/Source/Core/Controls/LinedefInfoPanel.cs b/Source/Core/Controls/LinedefInfoPanel.cs index df302b849..77d63a03d 100755 --- a/Source/Core/Controls/LinedefInfoPanel.cs +++ b/Source/Core/Controls/LinedefInfoPanel.cs @@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls { // Initialize InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(flags); // Hide stuff when in Doom format hexenformatwidth = infopanel.Width; diff --git a/Source/Core/Controls/SectorInfoPanel.cs b/Source/Core/Controls/SectorInfoPanel.cs index 588fa0634..e7f089046 100755 --- a/Source/Core/Controls/SectorInfoPanel.cs +++ b/Source/Core/Controls/SectorInfoPanel.cs @@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls { // Initialize InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(flags); //mxd labelFloorTextureSize.BackColor = Color.FromArgb(128, labelFloorTextureSize.BackColor); diff --git a/Source/Core/Controls/ThingInfoPanel.cs b/Source/Core/Controls/ThingInfoPanel.cs index 4ab27d6a9..200f2add6 100755 --- a/Source/Core/Controls/ThingInfoPanel.cs +++ b/Source/Core/Controls/ThingInfoPanel.cs @@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls { // Initialize InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(flags); // Hide stuff when in Doom format hexenformatwidth = infopanel.Width; diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index 23ed3f0b5..df5126201 100755 --- a/Source/Core/General/General.cs +++ b/Source/Core/General/General.cs @@ -47,7 +47,19 @@ namespace CodeImp.DoomBuilder { public static class General { - #region ================== API Declarations + #region ================== API Declarations and Mono compatibility + +#if MONO_WINFORMS + public static void ApplyMonoListViewFix(System.Windows.Forms.ListView listview) + { + if (listview.View == System.Windows.Forms.View.List) + { + listview.View = System.Windows.Forms.View.SmallIcon; + } + } +#else + public static void ApplyMonoListViewFix(System.Windows.Forms.ListView listview) {} +#endif #if NO_WIN32 diff --git a/Source/Core/Windows/ChangeMapForm.cs b/Source/Core/Windows/ChangeMapForm.cs index 3623fbe83..8b5e276c1 100755 --- a/Source/Core/Windows/ChangeMapForm.cs +++ b/Source/Core/Windows/ChangeMapForm.cs @@ -20,6 +20,7 @@ namespace CodeImp.DoomBuilder.Windows public ChangeMapForm(string filepathname, MapOptions options) { InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(mapslist); this.options = options; this.filepathname = filepathname; } diff --git a/Source/Core/Windows/ConfigForm.cs b/Source/Core/Windows/ConfigForm.cs index 651901747..7ea778486 100755 --- a/Source/Core/Windows/ConfigForm.cs +++ b/Source/Core/Windows/ConfigForm.cs @@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.Windows // Initialize InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(listtextures); // Make list column header full width columnname.Width = listconfigs.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth - 2; diff --git a/Source/Core/Windows/OpenMapOptionsForm.cs b/Source/Core/Windows/OpenMapOptionsForm.cs index ed0bf6eae..766ba853b 100755 --- a/Source/Core/Windows/OpenMapOptionsForm.cs +++ b/Source/Core/Windows/OpenMapOptionsForm.cs @@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.Windows { // Initialize InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(mapslist); this.Text = "Open Map from " + Path.GetFileName(filepathname); this.filepathname = filepathname; datalocations.StartPath = filepathname; //mxd @@ -59,6 +60,7 @@ namespace CodeImp.DoomBuilder.Windows { // Initialize InitializeComponent(); + CodeImp.DoomBuilder.General.ApplyMonoListViewFix(mapslist); this.Text = "Open Map from " + Path.GetFileName(filepathname); this.filepathname = filepathname; this.options = options; -- GitLab