Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Diff, IFS Browser create fix, remember open info
Browse files Browse the repository at this point in the history
  • Loading branch information
worksofliam committed Feb 20, 2018
1 parent d70e9ed commit 8aadf2c
Show file tree
Hide file tree
Showing 18 changed files with 1,756 additions and 135 deletions.
15 changes: 10 additions & 5 deletions ILEditor/Classes/DiffMatchPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Windows.Forms;

namespace DiffMatchPatch
{
Expand Down Expand Up @@ -1548,10 +1549,14 @@ public int diff_xIndex(List<Diff> diffs, int loc)
/**
* Convert a Diff list into a pretty HTML report.
* @param diffs List of Diff objects.
* @param 0 = combined, 1 = only old, 2 = only new
* @return HTML representation.
*/
public string diff_prettyHtml(List<Diff> diffs)
public string diff_prettyHtml(List<Diff> diffs, int oldnew = 0)
{
if (oldnew < 0 || oldnew > 2)
oldnew = 0;

StringBuilder html = new StringBuilder();

foreach (Diff aDiff in diffs)
Expand All @@ -1562,12 +1567,12 @@ public string diff_prettyHtml(List<Diff> diffs)
switch (aDiff.operation)
{
case Operation.INSERT:
html.Append("<ins style=\"background:#e6ffe6;\">").Append(text)
.Append("</ins>");
if (oldnew == 0 || oldnew == 2)
html.Append("<ins style=\"background:#e6ffe6;\">").Append(text).Append("</ins>");
break;
case Operation.DELETE:
html.Append("<span style=\"background:#ffbaba;\">").Append(text)
.Append("</span>");
if (oldnew == 0 || oldnew == 1)
html.Append("<span style=\"background:#ffbaba;\">").Append(text).Append("</span>");
break;
case Operation.EQUAL:
html.Append("<span>").Append(text).Append("</span>");
Expand Down
14 changes: 12 additions & 2 deletions ILEditor/Editor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ILEditor/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public partial class Editor : Form
{ "CLP", Language.CL },
{ "CMD", Language.CL },
{ "CPP", Language.CPP },
{ "SQLCPP", Language.CPP },
{ "C", Language.CPP },
{ "SQLC", Language.CPP },
{ "SQL", Language.SQL },
{ "CBL", Language.COBOL },
{ "COBOL", Language.COBOL },
Expand Down Expand Up @@ -387,6 +389,8 @@ private void start5250SessionToolStripMenuItem_Click(object sender, EventArgs e)
}

private void quickMemberSearchToolStripMenuItem_Click(object sender, EventArgs e) => new QuickMemberSearch().Show();

private void sourceDiffToolStripMenuItem_Click(object sender, EventArgs e) => new SourceCompareSelect().ShowDialog();
#endregion

#region Source dropdown
Expand Down
9 changes: 9 additions & 0 deletions ILEditor/Forms/OpenSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ namespace ILEditor.Forms
{
public partial class OpenSource : Form
{
public static string Library = "", SPF = "", Stmf = "";

public OpenSource(int tab = 0)
{
InitializeComponent();
type.Items.AddRange(Editor.LangTypes.Keys.ToArray());

tabs.SelectedIndex = tab;

lib.Text = Library;
spf.Text = SPF;
stmfPath.Text = Stmf;
}

private void button1_Click(object sender, EventArgs e)
Expand All @@ -40,6 +46,8 @@ private void button1_Click(object sender, EventArgs e)
if (isValid)
{
Editor.OpenSource(new RemoteSource("", lib.Text, spf.Text, mbr.Text, type.Text, true));
Library = lib.Text;
SPF = spf.Text;
this.Close();
}
else
Expand All @@ -51,6 +59,7 @@ private void button1_Click(object sender, EventArgs e)

if (IBMi.FileExists(stmfPath.Text)) {
Editor.OpenSource(new RemoteSource("", stmfPath.Text));
Stmf = stmfPath.Text;
this.Close();
}
else
Expand Down
91 changes: 14 additions & 77 deletions ILEditor/Forms/SaveAs.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 18 additions & 20 deletions ILEditor/Forms/SaveAs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,31 @@ namespace ILEditor.Forms
public partial class SaveAs : Form
{
public bool Success = false;
public string Lib = "";
public string Spf = "";
public string Mbr = "";
public SaveAs()
public SourceSelectBox SourceInfo() => sourceSelectBox;
public SaveAs(RemoteSource MemberInfo = null)
{
InitializeComponent();

if (MemberInfo != null)
{
switch (MemberInfo.GetFS())
{
case FileSystem.IFS:
sourceSelectBox.SetSource(MemberInfo.GetRemoteFile());
sourceSelectBox.SetSource("", "", MemberInfo.GetName());
break;
case FileSystem.QSYS:
sourceSelectBox.SetSource("", MemberInfo.GetObject(), MemberInfo.GetName());
break;
}
}
}

private void save_Click(object sender, EventArgs e)
{
Boolean valid = true;
this.Lib = lib.Text.Trim();
this.Spf = spf.Text.Trim();
this.Mbr = mbr.Text.Trim();

if (!IBMiUtils.IsValueObjectName(this.Lib))
valid = false;

if (!IBMiUtils.IsValueObjectName(this.Spf))
valid = false;

if (!IBMiUtils.IsValueObjectName(this.Mbr))
valid = false;

if (!valid)
if (!sourceSelectBox.isValid())
{
MessageBox.Show("Member information not valid.");
MessageBox.Show("Source information not valid.");
}
else
{
Expand Down
Loading

0 comments on commit 8aadf2c

Please sign in to comment.