Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

mwf-designer pull request - loading files given on command line, Makefile changes #1

Merged
merged 4 commits into from

2 participants

Martin Hradil Miguel de Icaza
Martin Hradil

Hi,
I've added the possibility to load files given on the command line, so now
mwf-designer dialog.cs
just works (and uses the same code as the Open dialog).

Also, I've reworked the Makefile a bit to

  • not fail 'make run' when there's no .mdb file to copy
  • only recompile when source has changed

So, it's yours to pull.
Also, given that mwf-designer seems to be the only way of designing Windows.Forms GUIs under Linux (or is it?), I'll probably keep sending stuff.

Regards,
Martin Hradil

Miguel de Icaza migueldeicaza merged commit 456981e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  .gitignore
View
@@ -0,0 +1 @@
+build/
16 Makefile
View
@@ -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
-
-
1  src/DesignTime/CodeProvider.cs
View
@@ -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)));
54 src/Program.cs
View
@@ -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");
+ }
}
- }
-}
+}
30 src/UI/MainView.cs
View
@@ -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)
}
}
}
-}
+}
Something went wrong with that request. Please try again.