Skip to content

Commit

Permalink
v1.3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nobody committed May 17, 2020
2 parents 3378da3 + f344081 commit 5b3856d
Show file tree
Hide file tree
Showing 112 changed files with 9,219 additions and 2,872 deletions.
733 changes: 733 additions & 0 deletions Plugins/Luna/Controllers/FormEditorCtrl/AutoCompleteCtrl.cs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

136 changes: 136 additions & 0 deletions Plugins/Luna/Controllers/FormEditorCtrl/MenuCtrl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using Luna.Resources.Langs;
using Luna.Services;
using System.Windows.Forms;

namespace Luna.Controllers.FormEditorCtrl
{
internal sealed class MenuCtrl
{
Views.WinForms.FormEditor formEditor;
ButtonCtrl editorCtrl;
private readonly ToolStripMenuItem miNewWindow;
private readonly ToolStripMenuItem miShowMgr;
private readonly ToolStripMenuItem miLoad;
private readonly ToolStripMenuItem miSaveAs;
private readonly ToolStripMenuItem miExit;
private readonly ToolStripMenuItem miLoadClrLib;

private readonly ToolStripStatusLabel smiLbClrLib;
private readonly ComboBox cboxScriptName;

public MenuCtrl(
Views.WinForms.FormEditor formEditor,

ButtonCtrl editorCtrl,
ToolStripMenuItem miNewWindow,
ToolStripMenuItem miShowMgr,
ToolStripMenuItem miLoad,
ToolStripMenuItem miSaveAs,
ToolStripMenuItem miExit,

ToolStripMenuItem miLoadClrLib,


ToolStripStatusLabel smiLbClrLib,


ComboBox cboxScriptName)
{
this.editorCtrl = editorCtrl;
this.miNewWindow = miNewWindow;
this.miShowMgr = miShowMgr;
this.miLoad = miLoad;
this.miSaveAs = miSaveAs;
this.miExit = miExit;
this.miLoadClrLib = miLoadClrLib;

this.smiLbClrLib = smiLbClrLib;

this.cboxScriptName = cboxScriptName;
this.formEditor = formEditor;
}

public void Run(
Services.FormMgrSvc formMgrService,
Services.Settings settings)
{
InitControls(settings);
BindEvents(formMgrService);
}

#region private method
private void InitControls(Settings settings)
{
miLoadClrLib.Checked = settings.isLoadClrLib;
smiLbClrLib.Enabled = settings.isLoadClrLib;
}

private void BindEvents(FormMgrSvc formMgrService)
{
miShowMgr.Click += (s, a) => formMgrService.ShowFormMain();

miLoadClrLib.Click += (s, a) =>
{
var enable = !miLoadClrLib.Checked;
miLoadClrLib.Checked = enable;
smiLbClrLib.Enabled = enable;
editorCtrl.isLoadClrLib = enable;
};

miNewWindow.Click += (s, a) =>
formMgrService.CreateNewEditor();

// event handling
miExit.Click += (s, a) =>
VgcApis.Misc.UI.CloseFormIgnoreError(formEditor);

miLoad.Click += (s, a) =>
{
if (editorCtrl.IsChanged()
&& !VgcApis.Misc.UI.Confirm(I18N.DiscardUnsavedChanges))
{
return;
}

var cf = VgcApis.Misc.UI.ReadFileFromDialog(VgcApis.Models.Consts.Files.LuaExt);
var script = cf.Item1;
var filename = cf.Item2;

if (script == null)
{
return;
}

cboxScriptName.Text = @"";
editorCtrl.SetCurFileName(filename);
editorCtrl.SetCurrentEditorContent(script);
editorCtrl.SetScriptCache(script);
};

miSaveAs.Click += (s, a) =>
{
var script = editorCtrl.GetCurrentEditorContent();
var err = VgcApis.Misc.UI.ShowSaveFileDialog(
VgcApis.Models.Consts.Files.LuaExt,
script,
out var filename);

switch (err)
{
case VgcApis.Models.Datas.Enums.SaveFileErrorCode.Success:
if (string.IsNullOrEmpty(cboxScriptName.Text))
{
editorCtrl.SetCurFileName(filename);
editorCtrl.SetScriptCache(script);
}
VgcApis.Misc.UI.MsgBoxAsync(I18N.Done);
break;
case VgcApis.Models.Datas.Enums.SaveFileErrorCode.Fail:
VgcApis.Misc.UI.MsgBoxAsync(I18N.WriteFileFail);
break;
}
};
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using System.Drawing;
using System.Windows.Forms;

namespace Luna.Controllers
namespace Luna.Controllers.FormMainCtrl
{
public class TabGeneralCtrl
internal class TabGeneralCtrl
{
Button btnStopAll, btnKillAll, btnDelAll, btnImport, btnExport;
FlowLayoutPanel flyLuaUiPanel;
Expand All @@ -25,12 +25,9 @@ public TabGeneralCtrl(

#region public methods
Services.LuaServer luaServer;
Services.Settings settings;
public void Run(
Services.Settings settings,
Services.LuaServer luaServer)

public void Run(Services.LuaServer luaServer)
{
this.settings = settings;
this.luaServer = luaServer;
BindEvents(luaServer);
BindDragDropEvent();
Expand Down
62 changes: 62 additions & 0 deletions Plugins/Luna/Controllers/FormMainCtrl/TabOptionsCtrl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Luna.Resources.Langs;
using System.Windows.Forms;

namespace Luna.Controllers.FormMainCtrl
{
internal class TabOptionsCtrl
{
private readonly CheckBox chkLoadClrLib;
private readonly CheckBox chkEnableCodeAnalyze;
private readonly Button btnSaveOptions;

public TabOptionsCtrl(
CheckBox chkLoadClrLib,
CheckBox chkEnableCodeAnalyze,
Button btnSaveOptions)
{
this.chkLoadClrLib = chkLoadClrLib;
this.chkEnableCodeAnalyze = chkEnableCodeAnalyze;
this.btnSaveOptions = btnSaveOptions;
}

Services.Settings settings;
public void Run(Services.Settings settings)
{
this.settings = settings;
InitControls();
BindEvents();
}

public bool IsChanged()
{
if (chkLoadClrLib.Checked != settings.isLoadClrLib
|| chkEnableCodeAnalyze.Checked != settings.isEnableAdvanceAutoComplete)
{
return true;
}
return false;
}

#region private methods
void BindEvents()
{
btnSaveOptions.Click += (s, a) =>
{
if (IsChanged())
{
settings.isLoadClrLib = chkLoadClrLib.Checked;
settings.isEnableAdvanceAutoComplete = chkEnableCodeAnalyze.Checked;
}
VgcApis.Misc.UI.MsgBox(I18N.Done);
};
}

void InitControls()
{
chkLoadClrLib.Checked = settings.isLoadClrLib;
chkEnableCodeAnalyze.Checked = settings.isEnableAdvanceAutoComplete;
}
#endregion

}
}
4 changes: 2 additions & 2 deletions Plugins/Luna/Controllers/LuaCoreCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Luna.Controllers
{
public class LuaCoreCtrl
internal class LuaCoreCtrl
{
public EventHandler OnStateChange;

Expand Down Expand Up @@ -271,7 +271,7 @@ Lua CreateLuaCore(Models.Apis.LuaSys luaSys)
UseTraceback = enableTracebackFeature,
};

if (settings.isEnableClrSupports && isLoadClr)
if (settings.isLoadClrLib && isLoadClr)
{
lua.LoadCLRPackage();
}
Expand Down
83 changes: 0 additions & 83 deletions Plugins/Luna/Controllers/MenuCtrl.cs

This file was deleted.

Loading

0 comments on commit 5b3856d

Please sign in to comment.