ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JDesigner/uSBWAccess.pas
Revision: 1.1.1.1 (vendor branch)
Committed: Mon Dec 10 19:29:13 2001 UTC (14 years, 6 months ago) by hsauro
Branch: MAIN, hsauro
CVS Tags: V10, HEAD_NEW, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
no message

Line File contents
1 unit uSBWAccess;
2
3 interface
4
5 Uses SysUtils, Graphics, uSBWUtils, uSBWCommon;
6
7 type
8 TJDesignerSBWMethods = class (TObject)
9 function GetVersion (ds : TSBWDataStream) : SBWDataBlockWriter;
10 function GetSBML (ds : TSBWDataStream) : SBWDataBlockWriter;
11 function LoadFile (ds : TSBWDataStream) : SBWDataBlockWriter;
12 function SaveFile (ds : TSBWDataStream) : SBWDataBlockWriter;
13 procedure newPathway (ds : TSBWDataStream);
14 function GetnReactions (ds : TSBWDataStream) : SBWDataBlockWriter;
15 function GetnFloats (ds : TSBWDataStream) : SBWDataBlockWriter;
16 function GetnFixed (ds : TSBWDataStream) : SBWDataBlockWriter;
17 function SetPath (ds : TSBWDataStream) : SBWDataBlockWriter;
18
19 function SetArcColour (ds : TSBWDataStream) : SBWDataBlockWriter;
20 procedure SetGlobalArcColour (ds : TSBWDataStream);
21 function SetNodeColour (ds : TSBWDataStream) : SBWDataBlockWriter;
22 procedure SetGlobalBoundaryNodeColour (ds : TSBWDataStream);
23 procedure SetGlobalFloatNodeColour (ds : TSBWDataStream);
24 procedure SetBackColour (ds : TSBWDataStream);
25 procedure SetGlobalFont (ds : TSBWDataStream);
26 procedure Redraw (ds : TSBWDataStream);
27 end;
28
29 implementation
30
31 Uses ufJDesigner;
32
33
34 function TJDesignerSBWMethods.GetVersion (ds : TSBWDataStream) : SBWDataBlockWriter;
35 begin
36 result := ds.pack ([Version]);
37 end;
38
39 function TJDesignerSBWMethods.GetSBML (ds : TSBWDataStream) : SBWDataBlockWriter;
40 begin
41 result:= ds.pack ([frmNetworkEd.Netpanel.Network.GetXMLString]);
42 end;
43
44 function TJDesignerSBWMethods.LoadFile (ds : TSBWDataStream) : SBWDataBlockWriter;
45 begin
46 result := ds.pack ([frmNetworkEd.loadFile (ds.getString())]);
47 end;
48
49 function TJDesignerSBWMethods.SaveFile (ds : TSBWDataStream) : SBWDataBlockWriter;
50 var str : string;
51 begin
52 str := ds.getString();
53 try
54 frmNetworkEd.NetPanel.Save (str);
55 result := ds.pack ('');
56 except
57 on E: Exception do
58 result := ds.pack ([E.message]);
59 end;
60 end;
61
62
63 procedure TJDesignerSBWMethods.NewPathway (ds : TSBWDataStream);
64 begin
65 frmNetworkEd.NewModel;
66 end;
67
68
69 function TJDesignerSBWMethods.GetnReactions (ds : TSBWDataStream) : SBWDataBlockWriter;
70 begin
71 result := ds.pack ([frmNetworkEd.NetPanel.Network.nEdges]);
72 end;
73
74
75 function TJDesignerSBWMethods.GetnFloats (ds : TSBWDataStream) : SBWDataBlockWriter;
76 begin
77 result := ds.pack ([frmNetworkEd.NetPanel.Network.GetnFloat]);
78 end;
79
80
81 function TJDesignerSBWMethods.GetnFixed (ds : TSBWDataStream) : SBWDataBlockWriter;
82 begin
83 result := ds.pack ([frmNetworkEd.NetPanel.Network.GetnFixed]);
84 end;
85
86
87 function TJDesignerSBWMethods.SetPath (ds : TSBWDataStream) : SBWDataBlockWriter;
88 var str : string;
89 begin
90 str := ds.getString ();
91 if SetCurrentDir (str) then
92 result := ds.pack ('')
93 else result := ds.pack (['Fail']);
94 end;
95
96
97 function TJDesignerSBWMethods.SetArcColour (ds : TSBWDataStream) : SBWDataBlockWriter;
98 var str : string; Index, c : integer;
99 begin
100 str := ds.getString ();
101 Index := frmNetworkEd.NetPanel.Network.FindEdge (Trim (str));
102 if Index = -1 then
103 result := ds.pack (['Reaction [' + str + '] does not exist'])
104 else
105 begin
106 c := ds.getInteger ();
107 if frmNetworkEd.NetPanel.Network <> nil then
108 frmNetworkEd.NetPanel.Network.ArcColor[Index] := TColor (c);
109 end;
110 result := ds.pack ('');
111 end;
112
113
114 procedure TJDesignerSBWMethods.SetGlobalArcColour (ds : TSBWDataStream);
115 var c : integer;
116 begin
117 c := ds.getInteger ();
118 if frmNetworkEd.NetPanel.Network <> nil then
119 frmNetworkEd.NetPanel.Network.GlobalArcColor := c;
120 end;
121
122
123 function TJDesignerSBWMethods.SetNodeColour (ds : TSBWDataStream) : SBWDataBlockWriter;
124 var str : string; Index, c : integer;
125 begin
126 str := ds.getString ();
127 Index := frmNetworkEd.NetPanel.Network.FindNode (Trim (str));
128 if Index = -1 then
129 result := ds.pack (['Node [' + str + '] does not exist'])
130 else
131 begin
132 c := ds.getInteger ();
133 if frmNetworkEd.NetPanel.Network <> nil then
134 frmNetworkEd.NetPanel.Network.NodeColor[Index] := TColor (c);
135 end;
136 result := ds.pack ('');
137 end;
138
139
140 procedure TJDesignerSBWMethods.SetGlobalBoundaryNodeColour (ds : TSBWDataStream);
141 var c : integer;
142 begin
143 c := ds.getInteger ();
144 if frmNetworkEd.NetPanel.Network <> nil then
145 frmNetworkEd.NetPanel.Network.GlobalBoundaryNodeColor := c;
146 end;
147
148
149 procedure TJDesignerSBWMethods.SetGlobalFloatNodeColour (ds : TSBWDataStream);
150 var c : integer;
151 begin
152 c := ds.getInteger ();
153 if frmNetworkEd.NetPanel.Network <> nil then
154 frmNetworkEd.NetPanel.Network.GlobalFloatingNodeColor := c;
155 end;
156
157
158 procedure TJDesignerSBWMethods.SetBackColour (ds : TSBWDataStream);
159 var c : integer;
160 begin
161 c := ds.getInteger ();
162 if frmNetworkEd.NetPanel.Network <> nil then
163 frmNetworkEd.NetPanel.Network.BackGroundColor := TColor (c);
164 end;
165
166
167 procedure TJDesignerSBWMethods.SetGlobalFont (ds : TSBWDataStream);
168 var fn : string; fs, fc : integer;
169 begin
170 fn := Trim (ds.getString ());
171 fs := ds.getInteger ();
172 fc := ds.getInteger ();
173 if frmNetworkEd.NetPanel.Network <> nil then
174 frmNetworkEd.NetPanel.Network.SetGlobalFont (PChar (fn), fs, fc);
175 end;
176
177
178 procedure TJDesignerSBWMethods.Redraw (ds : TSBWDataStream);
179 begin
180 frmNetworkEd.NetPanel.Paint;
181 end;
182
183 { JD_CLOSE :
184 begin
185 AThread.StopMode := smTerminate;
186 Stop; // Stop the thread
187 CloseSignal := True;
188 end;
189 JD_GETINTERFACE :
190 begin
191 nMethods := 0;
192 nFunctions := 1;
193 nProperties := 0;
194
195 WriteInteger (nMethods);
196 WriteInteger (nFunctions);
197 WriteInteger (nProperties);
198 for i := 1 to nMethods do
199 begin
200 end;
201 for i := 1 to nFunctions do
202 begin
203 WriteString ('version');
204 WriteInteger (dtString);
205 WriteString ('sbml');
206 WriteInteger (dtString);
207 end;
208 end;}
209
210
211 end.