Skip to content
Browse files

Merge pull request #1 from himdel/master

mwf-designer pull request - loading files given on command line, Makefile changes
  • Loading branch information...
2 parents 1955b55 + 60924b0 commit 456981eb251334b790968a824669a3a75c5947c6 @migueldeicaza migueldeicaza committed May 19, 2011
Showing with 53 additions and 49 deletions.
  1. +1 −0 .gitignore
  2. +7 −9 Makefile
  3. +1 −0 src/DesignTime/CodeProvider.cs
  4. +26 −28 src/Program.cs
  5. +18 −12 src/UI/MainView.cs
View
1 .gitignore
@@ -0,0 +1 @@
+build/
View
16 Makefile
@@ -7,22 +7,20 @@ MD_DIST_DIR = ${MD_BUILD_DIR}/mwf-designer
ASSEMBLY=mwf-designer.exe
REFERENCES=System.Design,System.Windows.Forms,System.Drawing,System.Data,${DEPS_DIR}/ICSharpCode.NRefactory.dll
-all: prepare
- export MCS_COLORS=disable && gmcs -debug -r:${REFERENCES} -out:${BUILD_DIR}/${ASSEMBLY} ${SOURCES}
+all: ${BUILD_DIR}/${ASSEMBLY}
-prepare:
+${BUILD_DIR}/${ASSEMBLY}: ${SOURCES}
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}/*.mdb ${BUILD_DIR}
- cd ${BUILD_DIR} && mono --debug mwf-designer.exe
+ cp ${DEPS_DIR}/*.mdb ${BUILD_DIR} || true
+ mono --debug ${BUILD_DIR}/mwf-designer.exe
-mono-design: prepare
+mono-design: all
cd ${DEPS_DIR}/Mono.Design && make
export MCS_COLORS=disable;gmcs -debug -r:${REFERENCES},${DEPS_DIR}/Mono.Design.dll -out:${BUILD_DIR}/${ASSEMBLY} ${SOURCES}
mono-design-update:
cd ${DEPS_DIR}/Mono.Design && make update
-
-
View
1 src/DesignTime/CodeProvider.cs
@@ -89,6 +89,7 @@ public CodeProvider (string fileName, ITypeResolutionService resolutionSvc)
private static string FindCodeBehindFile (string file)
{
+ file = Path.GetFullPath (file);
string codeBehindFileName = Path.Combine (Path.GetDirectoryName (file),
(Path.GetFileNameWithoutExtension (file) +
".Designer" + Path.GetExtension (file)));
View
54 src/Program.cs
@@ -4,35 +4,33 @@
namespace mwf_designer
{
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs args) {
- System.Windows.Forms.MessageBox.Show (args.ExceptionObject.GetType ().Name);
- if (args.ExceptionObject is Exception)
- OnException ((Exception)args.ExceptionObject);
- };
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs ueargs) {
+ System.Windows.Forms.MessageBox.Show (ueargs.ExceptionObject.GetType ().Name);
+ if (ueargs.ExceptionObject is Exception)
+ OnException ((Exception) ueargs.ExceptionObject);
+ };
- try {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new MainView());
- } catch (Exception e) {
- OnException (e);
- System.Windows.Forms.Application.Exit ();
+ try {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainView(args));
+ } catch (Exception e) {
+ OnException (e);
+ System.Windows.Forms.Application.Exit ();
+ }
}
- }
- 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):" +
- System.Environment.NewLine + System.Environment.NewLine +
- e.ToString (), "Fatal Error");
+ 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):" + System.Environment.NewLine + System.Environment.NewLine + e.ToString (), "Fatal Error");
+ }
}
- }
-}
+}
View
30 src/UI/MainView.cs
@@ -53,10 +53,24 @@ public partial class MainView : Form
private ToolboxFiller _toolboxFiller;
private readonly string MODIFIED_MARKER = " *";
- public MainView ()
+ public MainView (string[] args)
{
InitializeComponent ();
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)
@@ -65,16 +79,8 @@ private void openToolStripMenuItem_Click (object sender, EventArgs e)
dialog.CheckFileExists = true;
dialog.Multiselect = false;
dialog.Filter = "C# Source Code (*.cs)|*.cs|VB.NET Source Code (*.vb)|*.vb";
- if (dialog.ShowDialog () == DialogResult.OK) {
- if (surfaceTabs.TabPages.ContainsKey (dialog.FileName)) {// tab page for file already existing
- 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);
- }
- }
+ if (dialog.ShowDialog () == DialogResult.OK)
+ LoadFile(dialog.FileName);
}
private void LoadWorkspace ()
@@ -241,4 +247,4 @@ private void OnDelete_Clicked (object sender, EventArgs args)
}
}
}
-}
+}

0 comments on commit 456981e

Please sign in to comment.
Something went wrong with that request. Please try again.