This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
MainWindow.cs
73 lines (59 loc) · 2.08 KB
/
MainWindow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using Gtk;
using MonoHotDraw.Figures;
public partial class MainWindow: Gtk.Window
{
public MainWindow (): base (Gtk.WindowType.Toplevel) {
Build ();
UpdateUndoRedo();
mhdcanvas.UndoStackChanged += delegate {
UpdateUndoRedo();
};
visiblearea.Text = mhdcanvas.View.VisibleArea.ToString();
mhdcanvas.View.VisibleAreaChanged += delegate {
visiblearea.Text = mhdcanvas.View.VisibleArea.ToString();
};
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a) {
Application.Quit ();
a.RetVal = true;
}
protected virtual void OnAddEllipseActionActivated (object sender, System.EventArgs e) {
mhdcanvas.AddWithResizing(new EllipseFigure() );
}
protected virtual void OnAddRectangleActionActivated (object sender, System.EventArgs e) {
mhdcanvas.AddWithResizing(new RectangleFigure());
}
protected virtual void OnAddPolyLineActionActivated (object sender, System.EventArgs e) {
mhdcanvas.AddWithDragging(new PolyLineFigure());
}
protected virtual void OnAddSimpleTextActionActivated (object sender, System.EventArgs e) {
mhdcanvas.AddWithDragging(new SimpleTextFigure("Hello World"));
}
protected virtual void OnAddMultiLineTextActionActivated (object sender, System.EventArgs e) {
mhdcanvas.AddWithDragging(new MultiLineTextFigure("Hello\nWorld"));
}
protected virtual void OnAddLineConnectionActionActivated (object sender, System.EventArgs e) {
LineConnection connection = new LineConnection();
connection.ConnectionChanged += delegate {
System.Console.WriteLine("Connection Changed");
};
mhdcanvas.AddConnection(connection);
}
protected virtual void OnRedoActionActivated (object sender, System.EventArgs e)
{
mhdcanvas.Redo();
}
protected virtual void OnUndoActionActivated (object sender, System.EventArgs e)
{
mhdcanvas.Undo();
}
protected void UpdateUndoRedo() {
UndoAction.Sensitive = mhdcanvas.UndoManager.Undoable;
RedoAction.Sensitive = mhdcanvas.UndoManager.Redoable;
}
protected virtual void OnHscale1ValueChanged (object sender, System.EventArgs e)
{
mhdcanvas.View.Scale = zoomscale.Value / 100.0;
}
}