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

Commit

Permalink
Merge pull request #1 from himdel/master
Browse files Browse the repository at this point in the history
mwf-designer pull request - loading files given on command line, Makefile changes
  • Loading branch information
migueldeicaza committed May 20, 2011
2 parents 1955b55 + 60924b0 commit 456981e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
build/
16 changes: 7 additions & 9 deletions Makefile
Expand Up @@ -7,22 +7,20 @@ MD_DIST_DIR = ${MD_BUILD_DIR}/mwf-designer
ASSEMBLY=mwf-designer.exe ASSEMBLY=mwf-designer.exe
REFERENCES=System.Design,System.Windows.Forms,System.Drawing,System.Data,${DEPS_DIR}/ICSharpCode.NRefactory.dll REFERENCES=System.Design,System.Windows.Forms,System.Drawing,System.Data,${DEPS_DIR}/ICSharpCode.NRefactory.dll


all: prepare all: ${BUILD_DIR}/${ASSEMBLY}
export MCS_COLORS=disable && gmcs -debug -r:${REFERENCES} -out:${BUILD_DIR}/${ASSEMBLY} ${SOURCES}


prepare: ${BUILD_DIR}/${ASSEMBLY}: ${SOURCES}
mkdir -p ${BUILD_DIR} mkdir -p ${BUILD_DIR}
MCS_COLORS=disable gmcs -debug -r:${REFERENCES} -out:${BUILD_DIR}/${ASSEMBLY} ${SOURCES}


run: prepare run: all
cp ${DEPS_DIR}/*.dll ${BUILD_DIR} cp ${DEPS_DIR}/*.dll ${BUILD_DIR}
cp ${DEPS_DIR}/*.mdb ${BUILD_DIR} cp ${DEPS_DIR}/*.mdb ${BUILD_DIR} || true
cd ${BUILD_DIR} && mono --debug mwf-designer.exe mono --debug ${BUILD_DIR}/mwf-designer.exe


mono-design: prepare mono-design: all
cd ${DEPS_DIR}/Mono.Design && make cd ${DEPS_DIR}/Mono.Design && make
export MCS_COLORS=disable;gmcs -debug -r:${REFERENCES},${DEPS_DIR}/Mono.Design.dll -out:${BUILD_DIR}/${ASSEMBLY} ${SOURCES} export MCS_COLORS=disable;gmcs -debug -r:${REFERENCES},${DEPS_DIR}/Mono.Design.dll -out:${BUILD_DIR}/${ASSEMBLY} ${SOURCES}


mono-design-update: mono-design-update:
cd ${DEPS_DIR}/Mono.Design && make update cd ${DEPS_DIR}/Mono.Design && make update


1 change: 1 addition & 0 deletions src/DesignTime/CodeProvider.cs
Expand Up @@ -89,6 +89,7 @@ public CodeProvider (string fileName, ITypeResolutionService resolutionSvc)


private static string FindCodeBehindFile (string file) private static string FindCodeBehindFile (string file)
{ {
file = Path.GetFullPath (file);
string codeBehindFileName = Path.Combine (Path.GetDirectoryName (file), string codeBehindFileName = Path.Combine (Path.GetDirectoryName (file),
(Path.GetFileNameWithoutExtension (file) + (Path.GetFileNameWithoutExtension (file) +
".Designer" + Path.GetExtension (file))); ".Designer" + Path.GetExtension (file)));
Expand Down
54 changes: 26 additions & 28 deletions src/Program.cs
Expand Up @@ -4,35 +4,33 @@


namespace mwf_designer namespace mwf_designer
{ {
static class Program static class Program
{ {
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main(string[] args)
{ {
AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs args) { AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs ueargs) {
System.Windows.Forms.MessageBox.Show (args.ExceptionObject.GetType ().Name); System.Windows.Forms.MessageBox.Show (ueargs.ExceptionObject.GetType ().Name);
if (args.ExceptionObject is Exception) if (ueargs.ExceptionObject is Exception)
OnException ((Exception)args.ExceptionObject); OnException ((Exception) ueargs.ExceptionObject);
}; };


try { try {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainView()); Application.Run(new MainView(args));
} catch (Exception e) { } catch (Exception e) {
OnException (e); OnException (e);
System.Windows.Forms.Application.Exit (); System.Windows.Forms.Application.Exit ();
}
} }
}


private static void OnException (Exception e) private static void OnException (Exception e)
{ {
MessageBox.Show ("A fatal error occurred. Please file a bug report with the following details (Ctrl-C to copy to clipboard):" + MessageBox.Show ("A fatal error occurred. Please file a bug report with the following details (Ctrl-C to copy to clipboard):" + System.Environment.NewLine + System.Environment.NewLine + e.ToString (), "Fatal Error");
System.Environment.NewLine + System.Environment.NewLine + }
e.ToString (), "Fatal Error");
} }
} }
}
30 changes: 18 additions & 12 deletions src/UI/MainView.cs
Expand Up @@ -53,10 +53,24 @@ public partial class MainView : Form
private ToolboxFiller _toolboxFiller; private ToolboxFiller _toolboxFiller;
private readonly string MODIFIED_MARKER = " *"; private readonly string MODIFIED_MARKER = " *";


public MainView () public MainView (string[] args)
{ {
InitializeComponent (); InitializeComponent ();
LoadWorkspace (); LoadWorkspace ();
foreach (string s in args)
LoadFile(s);
}

private void LoadFile(string f) {
System.Console.WriteLine("LoadFile: {0}", f);
if (surfaceTabs.TabPages.ContainsKey (f)) {// tab page for file already existing
surfaceTabs.SelectedTab = surfaceTabs.TabPages[f];
} else {
if (CodeProvider.IsValidFile (f))
LoadDocument (f, _workspace);
else
MessageBox.Show ("No corresponding .Designer file found for " + f);
}
} }


private void openToolStripMenuItem_Click (object sender, EventArgs e) private void openToolStripMenuItem_Click (object sender, EventArgs e)
Expand All @@ -65,16 +79,8 @@ private void openToolStripMenuItem_Click (object sender, EventArgs e)
dialog.CheckFileExists = true; dialog.CheckFileExists = true;
dialog.Multiselect = false; dialog.Multiselect = false;
dialog.Filter = "C# Source Code (*.cs)|*.cs|VB.NET Source Code (*.vb)|*.vb"; dialog.Filter = "C# Source Code (*.cs)|*.cs|VB.NET Source Code (*.vb)|*.vb";
if (dialog.ShowDialog () == DialogResult.OK) { if (dialog.ShowDialog () == DialogResult.OK)
if (surfaceTabs.TabPages.ContainsKey (dialog.FileName)) {// tab page for file already existing LoadFile(dialog.FileName);
surfaceTabs.SelectedTab = surfaceTabs.TabPages[dialog.FileName];
} else {
if (CodeProvider.IsValidFile (dialog.FileName))
LoadDocument (dialog.FileName, _workspace);
else
MessageBox.Show ("No corresponding .Designer file found for " + dialog.FileName);
}
}
} }


private void LoadWorkspace () private void LoadWorkspace ()
Expand Down Expand Up @@ -241,4 +247,4 @@ private void OnDelete_Clicked (object sender, EventArgs args)
} }
} }
} }
} }

0 comments on commit 456981e

Please sign in to comment.