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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
//
// HelloCube.cs
//
// Author:
// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
//
// Copyright (c) 2016 jp
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using Crow;
using System.Reflection;
using System.Collections.Generic;
using System.Collections;
using System.Xml.Serialization;
using System.IO;
//using Cairo;
namespace CrowIDE
{
class CrowIDE : Application
{
// public Command CMDLoad = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("Open"))) { Caption = "Open", Icon = new SvgPicture("#Crow.Icons.open-file.svg")};
// public Command CMDSave = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("Save"))) { Caption = "Save", Icon = new SvgPicture("#Crow.Icons.open-file.svg")};
public Command CMDQuit;
//// public Command CMDSave = new Command(actionOpenFile) { Caption = "Open...", Icon = new SvgPicture("#Crow.Icons.open-file.svg")};
// public Command CMDQuit = new Command(actionOpenFile) { Caption = "Open...", Icon = new SvgPicture("#Crow.Icons.open-file.svg")};
// public Command CMDCut = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("Cut"))) { Caption = "Cut", Icon = new SvgPicture("#Crow.Icons.scissors.svg")};
// public Command CMDCopy = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("Copy"))) { Caption = "Copy", Icon = new SvgPicture("#Crow.Icons.copy-file.svg")};
// public Command CMDPaste = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("Paste"))) { Caption = "Paste", Icon = new SvgPicture("#Crow.Icons.paste-on-document.svg")};
// public Command CMDHelp = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("Help"))) { Caption = "Help", Icon = new SvgPicture("#Crow.Icons.question.svg")};
public Command CMDViewGTExp;
public Command CMDViewProps;
public Command CMDViewProj;
//
ImlVisualEditor imlVE;
//
#region MAIN
[STAThread]
static void Main ()
{
try {
using (CrowIDE crowApp = new CrowIDE ())
crowApp.Run ();
} catch (Exception ex) {
Console.WriteLine (ex.ToString ());
}
}
#endregion
#region CTOR
public CrowIDE ()
: base()
{
System.Threading.Thread.Sleep (1000);
CMDQuit = new Command(new Action(() => Running = false)) { Caption = "Quit", Icon = new SvgPicture("#Crow.Icons.exit-symbol.svg")};
CMDViewGTExp = new Command(new Action(() => loadWindow ("#CrowIDE.ui.GTreeExplorer.crow"))) { Caption = "Graphic Tree Explorer"};
CMDViewProps = new Command(new Action(() => loadWindow ("#CrowIDE.ui.MemberView.crow"))) { Caption = "Properties View"};
// CMDViewProj = new Command(new Action(() => loadWindow ("#CrowIDE.ui.CSProjExplorer.crow"))) { Caption = "Project Explorer"};
//
// //this.KeyDown += CrowIDE_KeyDown;
//
//this.CrowInterface.LoadInterface ("#CrowIDE.ui.imlEditor.crow").DataSource = this;
// //GraphicObject go = this.CrowInterface.LoadInterface (@"ui/test.crow");
GraphicObject go = this.CrowInterface.LoadInterface (@"#CrowIDE.ui.imlEditor.crow");
imlVE = go.FindByName ("crowContainer") as ImlVisualEditor;
go.DataSource = this;
}
#endregion
// void CrowIDE_KeyDown (object sender, OpenTK.Input.KeyboardKeyEventArgs e)
// {
// if (e.Key == OpenTK.Input.Key.Escape) {
// Quit (null, null);
// return;
// } else if (e.Key == OpenTK.Input.Key.F4) {
// loadWindow ("#CrowIDE.ui.MemberView.crow");
// } else if (e.Key == OpenTK.Input.Key.F5) {
// loadWindow ("#CrowIDE.ui.GTreeExplorer.crow");
// } else if (e.Key == OpenTK.Input.Key.F6) {
// loadWindow ("#CrowIDE.ui.LQIsExplorer.crow");
// } else if (e.Key == OpenTK.Input.Key.F7) {
// loadWindow ("#CrowIDE.ui.CSProjExplorer.crow");
// }
// }
void loadWindow(string path){
try {
GraphicObject g = CrowInterface.FindByName (path);
if (g != null)
return;
g = CrowInterface.LoadInterface (path);
g.Name = path;
g.DataSource = imlVE;
} catch (Exception ex) {
System.Diagnostics.Debug.WriteLine (ex.ToString ());
}
}
void closeWindow (string path){
GraphicObject g = CrowInterface.FindByName (path);
if (g != null)
CrowInterface.DeleteWidget (g);
}
protected void onCommandSave(object sender, MouseButtonEventArgs e){
System.Diagnostics.Debug.WriteLine("save");
}
void actionOpenFile(){
System.Diagnostics.Debug.WriteLine ("OpenFile action");
}
}
}
|