Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CI/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ if %errorlevel% neq 0 goto :error

git clean -xfd

nuget restore FlashDevelop.sln

msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="x86" /t:Rebuild %MSBuildLogger%
:: Extract version from HEAD
call SetVersion.bat

:: Check for build errors
if %errorlevel% neq 0 goto :error
nuget restore FlashDevelop.sln

:: Build AnyCPU version for 64bits support
msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Build %MSBuildLogger%
:: Build the solutions
msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild
ping -n 5 127.0.0.1 > nul
msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86 /t:Rebuild

:: Check for build errors
if %errorlevel% neq 0 goto :error
Expand Down
34 changes: 15 additions & 19 deletions External/Plugins/StartPage/Controls/DragDropPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public class DragDropPanel : Panel
{
public DragDropPanel()
{
this.AutoSize = false;
this.AllowDrop = true;
this.DragOver += this.PanelDragOver;
this.DragDrop += this.PanelDragDrop;
this.Width = 300;
this.Height = 90;
AutoSize = false;
AllowDrop = true;
DragOver += PanelDragOver;
DragDrop += PanelDragDrop;
Width = 300;
Height = 90;
}

/// <summary>
Expand All @@ -28,7 +28,7 @@ protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
var cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
Expand All @@ -37,7 +37,7 @@ protected override CreateParams CreateParams
/// <summary>
/// Handles the drag over event and enables correct dn'd effects.
/// </summary>
private void PanelDragOver(object sender, DragEventArgs e)
static void PanelDragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
Expand All @@ -49,21 +49,17 @@ private void PanelDragOver(object sender, DragEventArgs e)
/// <summary>
/// Handles the actual file drop and opens them as editable documents.
/// </summary>
private void PanelDragDrop(object sender, DragEventArgs e)
static void PanelDragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
if (!e.Data.GetDataPresent(DataFormats.FileDrop)) return;
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (var file in files)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
if (File.Exists(file))
{
if (File.Exists(file))
{
PluginBase.MainForm.OpenEditableDocument(file);
}
PluginBase.MainForm.OpenEditableDocument(file);
}
}
}

}

}
}
167 changes: 67 additions & 100 deletions External/Plugins/StartPage/Controls/StartPageWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ namespace StartPage.Controls
{
public class StartPageWebBrowser : UserControl
{
private readonly string rssUrl = string.Empty;
private readonly string pageUrl = string.Empty;
private bool showingStartPage = false;
private readonly RecentProjectList recentProjectList;
private readonly StartPageActions startPageActions;
private WebBrowserEx webBrowser;
private DragDropPanel dndPanel;
readonly string rssUrl;
readonly string pageUrl;
bool showingStartPage;
readonly RecentProjectList recentProjectList;
readonly StartPageActions startPageActions;
WebBrowserEx webBrowser;
DragDropPanel dndPanel;

public StartPageWebBrowser(string pageUrl, string rssUrl)
{
this.rssUrl = rssUrl;
this.pageUrl = pageUrl;
this.InitializeDragDrop();
this.InitializeComponent();
this.startPageActions = new StartPageActions();
this.recentProjectList = new RecentProjectList();
this.webBrowser.ObjectForScripting = this.startPageActions;
this.startPageActions.DocumentCompleted += WebBrowserDocumentCompleted;
this.ShowStartPage();
InitializeDragDrop();
InitializeComponent();
startPageActions = new StartPageActions();
recentProjectList = new RecentProjectList();
webBrowser.ObjectForScripting = startPageActions;
startPageActions.DocumentCompleted += WebBrowserDocumentCompleted;
ShowStartPage();
}

#region Component Designer Generated Code
Expand All @@ -40,34 +40,33 @@ public StartPageWebBrowser(string pageUrl, string rssUrl)
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
void InitializeComponent()
{
this.webBrowser = new WebBrowserEx();
this.SuspendLayout();
webBrowser = new WebBrowserEx();
SuspendLayout();
//
// webBrowser
//
this.webBrowser.AllowWebBrowserDrop = false;
this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser.IsWebBrowserContextMenuEnabled = false;
this.webBrowser.Location = new System.Drawing.Point(0, 0);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
this.webBrowser.Size = new System.Drawing.Size(696, 602);
this.webBrowser.TabIndex = 0;
this.webBrowser.WebBrowserShortcutsEnabled = false;
this.webBrowser.Navigating += this.WebBrowserNavigating;
this.webBrowser.NewWindow += this.WebBrowserNewWindow;
webBrowser.AllowWebBrowserDrop = false;
webBrowser.Dock = DockStyle.Fill;
webBrowser.IsWebBrowserContextMenuEnabled = false;
webBrowser.Location = new System.Drawing.Point(0, 0);
webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
webBrowser.Name = "webBrowser";
webBrowser.Size = new System.Drawing.Size(696, 602);
webBrowser.TabIndex = 0;
webBrowser.WebBrowserShortcutsEnabled = false;
webBrowser.Navigating += WebBrowserNavigating;
webBrowser.NewWindow += WebBrowserNewWindow;
//
// StartPageWebBrowser
//
this.Dock = System.Windows.Forms.DockStyle.Fill;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.webBrowser);
this.Name = "StartPageWebBrowser";
this.Size = new System.Drawing.Size(696, 602);
this.ResumeLayout(false);

Dock = DockStyle.Fill;
AutoScaleMode = AutoScaleMode.None;
Controls.Add(webBrowser);
Name = "StartPageWebBrowser";
Size = new System.Drawing.Size(696, 602);
ResumeLayout(false);
}

#endregion
Expand All @@ -77,69 +76,66 @@ private void InitializeComponent()
/// <summary>
/// Initializes the drag and drop operation.
/// </summary>
private void InitializeDragDrop()
void InitializeDragDrop()
{
this.dndPanel = new DragDropPanel();
this.Controls.Add(this.dndPanel);
dndPanel = new DragDropPanel();
Controls.Add(dndPanel);
}

/// <summary>
/// Shows the start page
/// </summary>
public void ShowStartPage()
{
this.showingStartPage = true;
this.webBrowser.Navigate(this.pageUrl);
showingStartPage = true;
webBrowser.Navigate(pageUrl);
}

/// <summary>
/// Updates the recent projects list
/// </summary>
public void SendProjectInfo()
{
this.recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects);
this.webBrowser.Document.InvokeScript("handleXmlData", new[] { this.recentProjectList.ToXml(), null});
recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects);
webBrowser.Document?.InvokeScript("handleXmlData", new[] { recentProjectList.ToXml(), null});
}

/// <summary>
/// Updates the recent projects list
/// </summary>
private void WebBrowserDocumentCompleted(object sender, EventArgs e)
void WebBrowserDocumentCompleted(object sender, EventArgs e)
{
this.recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects);
this.webBrowser.Document.InvokeScript("handleXmlData", new[] { this.recentProjectList.ToXml(), this.rssUrl});
recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects);
webBrowser.Document?.InvokeScript("handleXmlData", new[] { recentProjectList.ToXml(), rssUrl});
}

/// <summary>
/// If the page tries to open a new window use a fd tab instead
/// </summary>
private void WebBrowserNewWindow(object sender, CancelEventArgs e)
void WebBrowserNewWindow(object sender, CancelEventArgs e)
{
this.startPageActions.ShowURL(this.webBrowser.StatusText);
startPageActions.ShowURL(webBrowser.StatusText);
e.Cancel = true;
}

/// <summary>
/// If we're not about to show the start page and it isn't a javascript call then open a new fd tab
/// </summary>
private void WebBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e)
void WebBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e)
{
if (this.IsDownloadable(e.Url.ToString())) return;
if (!this.showingStartPage && !e.Url.ToString().StartsWithOrdinal("javascript"))
if (IsDownloadable(e.Url.ToString())) return;
if (!showingStartPage && !e.Url.ToString().StartsWithOrdinal("javascript"))
{
this.startPageActions.ShowURL(e.Url.ToString());
startPageActions.ShowURL(e.Url.ToString());
e.Cancel = true;
}
this.showingStartPage = false;
showingStartPage = false;
}

/// <summary>
/// Checks if the url is downloadable file
/// </summary>
private bool IsDownloadable(string url)
{
return url.EndsWithOrdinal(".exe") || url.EndsWithOrdinal(".zip");
}
static bool IsDownloadable(string url) => url.EndsWithOrdinal(".exe") || url.EndsWithOrdinal(".zip");

#endregion

Expand All @@ -150,107 +146,78 @@ public class StartPageActions
{
public event EventHandler DocumentCompleted;

private static string RELEASE_NOTES_URL = Path.Combine(PathHelper.DocDir, "index.html");
static string RELEASE_NOTES_URL = Path.Combine(PathHelper.DocDir, "index.html");

public void PageReady()
{
DocumentCompleted?.Invoke(this, null);
}
public void PageReady() => DocumentCompleted?.Invoke(this, null);

/// <summary>
/// Called from webpage to browse any url in seperate browser control
/// Called from webpage to browse any url in separate browser control
/// </summary>
public void ShowURL(string url)
{
PluginBase.MainForm.CallCommand("Browse", url);
}
public void ShowURL(string url) => PluginBase.MainForm.CallCommand("Browse", url);

/// <summary>
/// Called from webpage to browse FlashDevelop Homepage
/// </summary>
public void ShowHome()
{
this.ShowURL(DistroConfig.DISTRIBUTION_HOME);
}
public void ShowHome() => ShowURL(DistroConfig.DISTRIBUTION_HOME);

/// <summary>
/// Called from webpage to browse release notes
/// </summary>
public void ShowReleaseNotes()
{
this.ShowURL(RELEASE_NOTES_URL);
}
public void ShowReleaseNotes() => ShowURL(RELEASE_NOTES_URL);

/// <summary>
/// Called from webpage to browse documentation
/// </summary>
public void ShowDocumentation()
{
this.ShowURL(DistroConfig.DISTRIBUTION_HELP);
}
public void ShowDocumentation() => ShowURL(DistroConfig.DISTRIBUTION_HELP);

/// <summary>
/// Called from webpage to show FlashDevelop About dialog
/// </summary>
public void ShowAbout()
{
PluginBase.MainForm.CallCommand("About", null);
}
public void ShowAbout() => PluginBase.MainForm.CallCommand("About", null);

/// <summary>
/// Opens appman to install new software
/// </summary>
public void InstallSoftware()
{
PluginBase.MainForm.CallCommand("RunProcess", "$(Quote)$(AppDir)\\Tools\\appman\\AppMan.exe$(Quote);-locale=$(Locale)");
}
public void InstallSoftware() => PluginBase.MainForm.CallCommand("RunProcess", "$(Quote)$(AppDir)\\Tools\\appman\\AppMan.exe$(Quote);-locale=$(Locale)");

/// <summary>
/// Called from webpage to show New Project Dialog
/// </summary>
public void NewProject()
{
DataEvent de = new DataEvent(EventType.Command, ProjectManagerCommands.NewProject, null);
var de = new DataEvent(EventType.Command, ProjectManagerCommands.NewProject, null);
EventManager.DispatchEvent(this, de);
}

/// <summary>
/// Called from webpage to open a project
/// </summary>
public void OpenProject(string path)
{
PluginBase.MainForm.OpenEditableDocument(path);
}
public void OpenProject(string path) => PluginBase.MainForm.OpenEditableDocument(path);

/// <summary>
/// Called from webpage to open project dialog
/// </summary>
public void OpenProjectDialog()
{
DataEvent de = new DataEvent(EventType.Command, ProjectManagerCommands.OpenProject, null);
var de = new DataEvent(EventType.Command, ProjectManagerCommands.OpenProject, null);
EventManager.DispatchEvent(this, de);
}

}

#endregion

}

#region WebBrowserEx

class WebBrowserEx : WebBrowser
internal class WebBrowserEx : WebBrowser
{
/// <summary>
/// Redirect events to MainForm.
/// </summary>
public override bool PreProcessMessage(ref Message msg)
{
return ((Form)PluginBase.MainForm).PreProcessMessage(ref msg);
}

=> ((Form)PluginBase.MainForm).PreProcessMessage(ref msg);
}

#endregion

}
}
Loading