Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pipeline Tool] Mac fixes #7077

Merged
merged 1 commit into from Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -77,8 +77,9 @@ public void SetRoot(IProjectItem item)
_treeRoot.Tag = item;
_treeRoot.Expanded = true;

_treeView.ReloadItem(_treeRoot);
_treeView.ContextMenu = _contextMenu;
_treeView.DataStore = _treeBase;
_treeView.ReloadData();
}

public void AddItem(IProjectItem citem)
Expand Down
Expand Up @@ -49,6 +49,7 @@ public void Create(string category, string name, object value, Type type, EventH
public int Height { get; set; }
public Action OnKill { get; set; }
public bool HasDialog { get; protected set; }
public bool SkipCellDraw { get; set; }

public virtual void OnCreate()
{
Expand All @@ -67,7 +68,9 @@ public virtual void Draw(Graphics g, Rectangle rec, int separatorPos, bool selec

g.DrawText(SystemFonts.Default(), DrawInfo.GetTextColor(selected, false), rec.X + 5, rec.Y + (rec.Height - Height) / 2, Text);
g.FillRectangle(DrawInfo.GetBackgroundColor(selected), separatorPos - 6, rec.Y, rec.Width, rec.Height);
DrawCell(g, rec, separatorPos, selected);

if (!SkipCellDraw)
DrawCell(g, rec, separatorPos, selected);
}

public virtual void DrawCell(Graphics g, Rectangle rec, int separatorPos, bool selected)
Expand Down
Expand Up @@ -11,16 +11,9 @@ namespace MonoGame.Tools.Pipeline
[CellAttribute(typeof(bool))]
public class CellBool : CellBase
{
private bool _draw;

public CellBool()
{
_draw = true;
}

public override void Edit(PixelLayout control)
{
_draw = false;
SkipCellDraw = true;

var checkbox = new CheckBox();
checkbox.Tag = this;
Expand All @@ -35,22 +28,16 @@ public override void Edit(PixelLayout control)

OnKill += delegate
{
SkipCellDraw = false;
OnKill = null;

if (_eventHandler == null || checkbox.Checked == null)
return;

_draw = true;
Value = checkbox.Checked;
_eventHandler(Value, EventArgs.Empty);
};
}

public override void DrawCell(Graphics g, Rectangle rec, int separatorPos, bool selected)
{
if (_draw)
base.DrawCell(g, rec, separatorPos, selected);
}
}
}

Expand Up @@ -17,6 +17,7 @@ public override void OnCreate()

public override void Edit(PixelLayout control)
{
SkipCellDraw = true;
var editText = new TextBox();
editText.Tag = this;
editText.Style = "OverrideSize";
Expand All @@ -35,6 +36,7 @@ public override void Edit(PixelLayout control)

OnKill += delegate
{
SkipCellDraw = false;
OnKill = null;

if (_eventHandler == null)
Expand Down
Expand Up @@ -22,7 +22,9 @@ public override void OnCreate()

public override void Edit(PixelLayout control)
{
SkipCellDraw = true;
var combo = new DropDown();
combo.Tag = this;

if (_type.IsSubclassOf(typeof(Enum)))
{
Expand Down Expand Up @@ -61,6 +63,12 @@ public override void Edit(PixelLayout control)
combo.Height = _lastRec.Height;
control.Add(combo, _lastRec.X, _lastRec.Y);

OnKill += delegate
{
SkipCellDraw = false;
OnKill = null;
};

combo.SelectedIndexChanged += delegate
{
if (_eventHandler == null || combo.SelectedIndex < 0)
Expand Down
Expand Up @@ -40,6 +40,8 @@ public override void OnCreate()

public override void Edit(PixelLayout control)
{
SkipCellDraw = true;

var editText = new TextBox();
editText.Tag = this;
editText.Style = "OverrideSize";
Expand All @@ -55,6 +57,7 @@ public override void Edit(PixelLayout control)

OnKill += delegate
{
SkipCellDraw = false;
OnKill = null;

if (_eventHandler == null)
Expand Down
Expand Up @@ -12,6 +12,7 @@ public class CellText : CellBase
{
public override void Edit(PixelLayout control)
{
SkipCellDraw = true;
var editText = new TextBox();
editText.Tag = this;
editText.Style = "OverrideSize";
Expand All @@ -26,6 +27,7 @@ public override void Edit(PixelLayout control)

OnKill += delegate
{
SkipCellDraw = false;
OnKill = null;

if (_eventHandler == null)
Expand Down
Expand Up @@ -65,6 +65,9 @@ private bool ClearChildren()
}
}

if (ret)
drawable.Invalidate();

return ret;
}

Expand Down Expand Up @@ -229,6 +232,8 @@ private void Drawable_MouseUp(object sender, MouseEventArgs e)
{
_selectedCell.Edit(pixel1);
}

drawable.Invalidate();
});

#if WINDOWS
Expand Down
Expand Up @@ -20,7 +20,7 @@ private void InitializeComponent()
{
Title = "Select Folder";
DisplayMode = DialogDisplayMode.Attached;
Size = new Size(370, 200);
Size = new Size(400, 200);

buttonOk = new Button();
buttonOk.Text = "Ok";
Expand Down
6 changes: 3 additions & 3 deletions Tools/MonoGame.Content.Builder.Editor/Info.plist
Expand Up @@ -8,7 +8,7 @@
<string>false</string>
</dict>
<key>CFBundleName</key>
<string>MonoGame Content Builder Editor</string>
<string>MGCB Editor</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
Expand All @@ -23,7 +23,7 @@
<string>net.monogame.mgcb-editor</string>
<key>CFBundleShortVersionString</key>
<string>3.3</string>
<key>CFBundleIconFile</key>
<string>App</string>
<key>CFBundleIconFile</key>
<string>Icon.icns</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Tools/MonoGame.Content.Builder.Editor/MainWindow.cs
Expand Up @@ -18,7 +18,7 @@ partial class MainWindow : Form, IView
public EventHandler<EventArgs> RecentChanged;
public EventHandler<EventArgs> TitleChanged;
#pragma warning restore 649
public const string TitleBase = "MonoGame Content Builder Editor";
public const string TitleBase = "MGCB Editor";
public static MainWindow Instance;

private List<Pad> _pads;
Expand Down
5 changes: 3 additions & 2 deletions Tools/MonoGame.Content.Builder.Editor/MainWindow.eto.cs
Expand Up @@ -48,9 +48,9 @@ public PipelineMenuBar()

private void InitializeComponent()
{
Title = "MonoGame Pipeline Tool";
Title = "MGCB Editor";
Icon = Icon.FromResource("Icons.monogame.png");
Size = new Size(750, 550);
Size = new Size(900, 550);
MinimumSize = new Size(400, 400);

InitalizeCommands();
Expand Down Expand Up @@ -367,6 +367,7 @@ private void InitalizeToolbar()

ToolBar = toolbar = new ToolBar();
ToolBar.Style = "ToolBar";

ToolBar.Items.Add(cmdNew);
ToolBar.Items.Add(cmdOpen);
ToolBar.Items.Add(cmdSave);
Expand Down
Expand Up @@ -33,7 +33,7 @@
<None Remove="App.icns" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="App.icns" />
<BundleResource Include="Icon.icns" />
</ItemGroup>
<Import Project="MonoGame.Content.Builder.Editor.targets" />

Expand Down