Add workaround for broken View.List implementation in mono's winforms

This commit is contained in:
Magnus Norddahl 2020-09-12 01:25:59 +02:00
parent 800090d5b3
commit ccf2191f10
8 changed files with 27 additions and 8 deletions

View file

@ -42,7 +42,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\</OutputPath> <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> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
@ -63,7 +63,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<DocumentationFile> <DocumentationFile>
</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> <WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<NoWarn>1591</NoWarn> <NoWarn>1591</NoWarn>
@ -72,7 +72,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug + Profiler|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug + Profiler|x86' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\</OutputPath> <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> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile> <DocumentationFile>
</DocumentationFile> </DocumentationFile>
@ -94,7 +94,7 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <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> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
@ -104,7 +104,7 @@
</DocumentationFile> </DocumentationFile>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
@ -112,14 +112,14 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize> <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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug + Profiler|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug + Profiler|x64'">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<OutputPath>..\..\Build\</OutputPath> <OutputPath>..\..\Build\</OutputPath>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release + Profiler|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release + Profiler|x64'">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>

View file

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(flags);
// Hide stuff when in Doom format // Hide stuff when in Doom format
hexenformatwidth = infopanel.Width; hexenformatwidth = infopanel.Width;

View file

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(flags);
//mxd //mxd
labelFloorTextureSize.BackColor = Color.FromArgb(128, labelFloorTextureSize.BackColor); labelFloorTextureSize.BackColor = Color.FromArgb(128, labelFloorTextureSize.BackColor);

View file

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(flags);
// Hide stuff when in Doom format // Hide stuff when in Doom format
hexenformatwidth = infopanel.Width; hexenformatwidth = infopanel.Width;

View file

@ -47,7 +47,19 @@ namespace CodeImp.DoomBuilder
{ {
public static class General 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 #if NO_WIN32

View file

@ -20,6 +20,7 @@ namespace CodeImp.DoomBuilder.Windows
public ChangeMapForm(string filepathname, MapOptions options) public ChangeMapForm(string filepathname, MapOptions options)
{ {
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(mapslist);
this.options = options; this.options = options;
this.filepathname = filepathname; this.filepathname = filepathname;
} }

View file

@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.Windows
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(listtextures);
// Make list column header full width // Make list column header full width
columnname.Width = listconfigs.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth - 2; columnname.Width = listconfigs.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth - 2;

View file

@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(mapslist);
this.Text = "Open Map from " + Path.GetFileName(filepathname); this.Text = "Open Map from " + Path.GetFileName(filepathname);
this.filepathname = filepathname; this.filepathname = filepathname;
datalocations.StartPath = filepathname; //mxd datalocations.StartPath = filepathname; //mxd
@ -59,6 +60,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
CodeImp.DoomBuilder.General.ApplyMonoListViewFix(mapslist);
this.Text = "Open Map from " + Path.GetFileName(filepathname); this.Text = "Open Map from " + Path.GetFileName(filepathname);
this.filepathname = filepathname; this.filepathname = filepathname;
this.options = options; this.options = options;