From ccf2191f10be639af1755c26ce53e4de2ced7693 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl 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 9462055f..c2c3c0b2 100644 --- a/Source/Core/BuilderMono.csproj +++ b/Source/Core/BuilderMono.csproj @@ -42,7 +42,7 @@ true ..\..\Build\ - DEBUG;TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + DEBUG;TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS true full x86 @@ -63,7 +63,7 @@ prompt - NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS 4 true 1591 @@ -72,7 +72,7 @@ true ..\..\Build\ - DEBUG;TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + DEBUG;TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS true @@ -94,7 +94,7 @@ x86 false prompt - TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + TRACE;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS false @@ -104,7 +104,7 @@ false true - TRACE;DEBUG;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + TRACE;DEBUG;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS x64 @@ -112,14 +112,14 @@ false true true - TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + TRACE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS x64 ..\..\Build\ false true - TRACE;DEBUG;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;NO_DEVIL + TRACE;DEBUG;PROFILE;NO_SCINTILLA;NO_FORMS_DESIGN;NO_WIN32;NO_UPDATER;MONO_WINFORMS x64 diff --git a/Source/Core/Controls/LinedefInfoPanel.cs b/Source/Core/Controls/LinedefInfoPanel.cs index df302b84..77d63a03 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 588fa063..e7f08904 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 4ab27d6a..200f2add 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 23ed3f0b..df512620 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 3623fbe8..8b5e276c 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 65190174..7ea77848 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 ed0bf6ea..766ba853 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;