Mono/Linux: Fixed layout issues

This commit is contained in:
Souryo 2016-12-11 14:25:29 -05:00
parent 02da94cf6b
commit efca5284b1
30 changed files with 117 additions and 26 deletions

View file

@ -19,6 +19,10 @@
#include "../Utilities/UTF8Util.h"
#ifdef __GNUC__
#define __forceinline inline
#endif
using std::vector;
using std::shared_ptr;
using std::unique_ptr;

View file

@ -0,0 +1,38 @@
using System.Windows.Forms;
using System.Drawing;
using Mesen.GUI;
namespace Mesen.GUI.Controls
{
public class BaseControl : UserControl
{
public static string MonospaceFontFamily
{
get
{
if(Program.IsMono) {
return "Ubuntu Mono";
} else {
return "Consolas";
}
}
}
public new SizeF AutoScaleDimensions
{
set {
}
}
public new AutoScaleMode AutoScaleMode
{
set {
if(Program.IsMono) {
base.AutoScaleMode = AutoScaleMode.None;
} else {
base.AutoScaleMode = value;
}
}
}
}
}

View file

@ -10,7 +10,7 @@ using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
public partial class ctrlHorizontalTrackbar : UserControl
public partial class ctrlHorizontalTrackbar : BaseControl
{
public event EventHandler ValueChanged
{

View file

@ -10,7 +10,7 @@ using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
public partial class ctrlLoadingRom : UserControl
public partial class ctrlLoadingRom : BaseControl
{
public ctrlLoadingRom()
{

View file

@ -12,7 +12,7 @@ using Mesen.GUI.Config;
namespace Mesen.GUI.Controls
{
public partial class ctrlNsfPlayer : UserControl
public partial class ctrlNsfPlayer : BaseControl
{
private List<ComboboxItem> _trackList = new List<ComboboxItem>();
private int _frameCount = 0;

View file

@ -11,7 +11,7 @@ using Mesen.GUI.Config;
namespace Mesen.GUI.Controls
{
public partial class ctrlRenderer : UserControl
public partial class ctrlRenderer : BaseControl
{
private bool _cursorHidden = false;

View file

@ -10,7 +10,7 @@ using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
public partial class ctrlTrackbar : UserControl
public partial class ctrlTrackbar : BaseControl
{
public event EventHandler ValueChanged
{

View file

@ -6,10 +6,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public class BaseScrollableTextboxUserControl : UserControl
public class BaseScrollableTextboxUserControl : BaseControl
{
virtual protected ctrlScrollableTextbox ScrollableTextbox
{

View file

@ -7,10 +7,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlBreakpoints : UserControl
public partial class ctrlBreakpoints : BaseControl
{
public event EventHandler BreakpointNavigation;

View file

@ -7,10 +7,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlCallstack : UserControl
public partial class ctrlCallstack : BaseControl
{
private class StackInfo
{

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlChrViewer : UserControl
public partial class ctrlChrViewer : BaseControl
{
private byte[][] _chrPixelData = new byte[2][];
private int _selectedPalette = 0;

View file

@ -9,10 +9,11 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Mesen.GUI.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
public partial class ctrlConsoleStatus : UserControl
public partial class ctrlConsoleStatus : BaseControl
{
public event EventHandler OnStateChanged;
public event EventHandler OnGotoLocation;

View file

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Debugger.Controls;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
@ -29,6 +30,7 @@ namespace Mesen.GUI.Debugger
public ctrlDebuggerCode()
{
InitializeComponent();
this.lstSearchResult.Font = new System.Drawing.Font(BaseControl.MonospaceFontFamily, 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
splitContainer.Panel2Collapsed = true;
}

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlFunctionList : UserControl
public partial class ctrlFunctionList : BaseControl
{
public event EventHandler OnFindOccurrence;
public event EventHandler OnFunctionSelected;

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlLabelList : UserControl
public partial class ctrlLabelList : BaseControl
{
public event EventHandler OnFindOccurrence;
public event EventHandler OnLabelSelected;

View file

@ -7,10 +7,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlMemoryAccessCounters : UserControl
public partial class ctrlMemoryAccessCounters : BaseControl
{
private MemoryCountData[] _data;
private AddressType _memoryType = AddressType.InternalRam;

View file

@ -9,10 +9,11 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlNametableViewer : UserControl
public partial class ctrlNametableViewer : BaseControl
{
private byte[][] _nametablePixelData = new byte[4][];
private byte[][] _tileData = new byte[4][];

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlPaletteViewer : UserControl
public partial class ctrlPaletteViewer : BaseControl
{
private byte[] _paletteRam;
private byte[] _palettePixelData;

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlProfiler : UserControl
public partial class ctrlProfiler : BaseControl
{
public static event EventHandler OnFunctionSelected;
private Int64[] _exclusiveTime;

View file

@ -7,10 +7,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
public partial class ctrlScrollableTextbox : UserControl
public partial class ctrlScrollableTextbox : BaseControl
{
public event EventHandler ScrollPositionChanged;
@ -52,6 +53,8 @@ namespace Mesen.GUI.Debugger
this.ctrlTextbox.ShowLineNumbers = true;
this.ctrlTextbox.ShowLineInHex = true;
this.ctrlTextbox.Font = new System.Drawing.Font(BaseControl.MonospaceFontFamily, 13F);
this.hScrollBar.ValueChanged += hScrollBar_ValueChanged;
this.vScrollBar.ValueChanged += vScrollBar_ValueChanged;
this.ctrlTextbox.ScrollPositionChanged += ctrlTextbox_ScrollPositionChanged;
@ -67,7 +70,7 @@ namespace Mesen.GUI.Debugger
set
{
if(value >= 6 && value <= 20) {
this.ctrlTextbox.Font = new Font("Consolas", value);
this.ctrlTextbox.Font = new Font(BaseControl.MonospaceFontFamily, value);
UpdateHorizontalScrollbar();
this.ctrlTextbox.Invalidate();

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
public partial class ctrlSpriteViewer : UserControl
public partial class ctrlSpriteViewer : BaseControl
{
private byte[] _spriteRam;
private byte[] _spritePixelData;

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
public partial class ctrlWatch : UserControl
public partial class ctrlWatch : BaseControl
{
public ctrlWatch()
{

View file

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
@ -42,7 +43,7 @@ namespace Mesen.GUI.Debugger
tlpMain.Controls.Add(lbl);
lbl = new Label();
lbl.Font = new Font("Consolas", 10);
lbl.Font = new Font(BaseControl.MonospaceFontFamily, 10);
lbl.Margin = new Padding(2);
lbl.AutoSize = true;
lbl.Text = kvp.Value;

View file

@ -123,6 +123,28 @@ namespace Mesen.GUI.Forms
}
}
public new SizeF AutoScaleDimensions
{
set
{
if(!Program.IsMono) {
base.AutoScaleDimensions = value;
}
}
}
public new AutoScaleMode AutoScaleMode
{
set
{
if(Program.IsMono) {
base.AutoScaleMode = AutoScaleMode.None;
} else {
base.AutoScaleMode = value;
}
}
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Forms.Cheats
{
public partial class ctrlCheatFinder : UserControl
public partial class ctrlCheatFinder : BaseControl
{
public event EventHandler OnAddCheat;
public bool TabIsFocused

View file

@ -7,10 +7,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Forms.Config
{
public partial class ctrlDipSwitch : UserControl
public partial class ctrlDipSwitch : BaseControl
{
public ctrlDipSwitch()
{

View file

@ -3,10 +3,11 @@ using System.ComponentModel;
using System.Windows.Forms;
using Mesen.GUI.Config;
using System.Reflection;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Forms.Config
{
public partial class ctrlEmulatorShortcuts : UserControl
public partial class ctrlEmulatorShortcuts : BaseControl
{
public ctrlEmulatorShortcuts()
{

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Forms.Config
{
public partial class ctrlInputPortConfig : UserControl
public partial class ctrlInputPortConfig : BaseControl
{
private ControllerInfo _controllerInfo;

View file

@ -8,10 +8,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Forms.Config
{
public partial class ctrlStandardController : UserControl
public partial class ctrlStandardController : BaseControl
{
public event EventHandler OnChange;

View file

@ -11,6 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Forms
{
@ -22,6 +23,8 @@ namespace Mesen.GUI.Forms
{
InitializeComponent();
this.txtChangelog.Font = new System.Drawing.Font(BaseControl.MonospaceFontFamily, 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
_fileHash = fileHash;
lblCurrentVersionString.Text = currentVersion.ToString();