-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI_NetworkForm.h
194 lines (170 loc) · 7.95 KB
/
GUI_NetworkForm.h
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/* /////////////////////////////////////////////////////////////////////////////
NetSuite: NetClamp/NetSim/NetFit Neural Network Modeling and Dynamic Clamp Software
Copyright (C) 2011-2014 E. Brady Trexler, Ph.D.
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/>.
Please direct correspondence to ebtrexler _at_ gothamsci _dot_ com
///////////////////////////////////////////////////////////////////////////// */
//---------------------------------------------------------------------------
#ifndef GUI_NetworkFormH
#define GUI_NetworkFormH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "GR32_Image.hpp"
#include <ActnCtrls.hpp>
#include <ActnList.hpp>
#include <ActnMan.hpp>
#include <ActnMenus.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <ImgList.hpp>
#include <PlatformDefaultStyleActnCtrls.hpp>
#include <ToolWin.hpp>
#include <Menus.hpp>
#include "RT_Network.h"
#include "GenericUtilities.h"
#include <ExtActns.hpp>
#include <StdActns.hpp>
#include <Tabs.hpp>
#include <System.Actions.hpp>
enum ModelMouseModeEnum {PositionCell, PositionElectrode, PositionSynapse1,
PositionSynapse2, AddCurrent, EditAnObject, NoMouseObject};
void Circle(TArrayOfFixedPoint &pts, int center, int radius);
void Circle(TArrayOfFixedPoint &pts, double Xcenter, double Ycenter, double radius);
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
//
// ******************** TNetworkGUI ***************************
//
//
/// Graphical interface for creating, editing, and running a network
/*!
Master network builder and editor that contains 3 regions:
- An area with forms for designing connections (TGUI_CirclePerimeterForm and TGUI_SquareLatticeForm)
- A "tree" organization of the network that is used for selecting network elements, and
- An area to display the GUI edit forms for the selected network component.
@author E. Brady Trexler <ebtrexler (at) gothamsci.com>, 2011 - 2013
*/
class TNetworkGUI : public TForm
{
__published: // IDE-managed Components
TActionManager *ActionManager1;
TActionMainMenuBar *ActionMainMenuBar1;
TActionToolBar *ActionToolBar1;
TImageList *ImageList1;
TImageList *ImageList2;
TPanel *Panel1;
TPanel *Panel2;
TPanel *Panel3;
TPopupMenu *pmnuNetwork;
TMenuItem *RemoveItem1;
TSplitter *Splitter1;
TAction *ActionCreateCell;
TAction *ActionCreateSynapse;
TAction *ActionCreateElectrode;
TScrollBox *NetworkComponentEditScrollBox;
TGenericUtilities *GenericUtilities1;
TActionToolBar *ActionToolBar2;
TFileOpen *FileOpen1;
TFileSaveAs *FileSaveAs1;
TAction *ActionCurrentEdit;
TAction *ActionRun;
TAction *ActionClearNetwork;
TPanel *Panel4;
TTreeView *NetworkTreeView;
TPanel *Panel5;
TActionToolBar *ActionToolBar3;
TAction *ActionRemoveItem;
TPanel *Panel10;
TSplitter *Splitter2;
TPanel *NetworkPanel;
TTabControl *NetworkTabControl;
TAction *ActionVersionInfo;
TAction *CopyCurrentsAction;
TMenuItem *CollapseAll1;
void __fastcall pmnuNetworkPopup(TObject *Sender);
void __fastcall NetworkTreeViewMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y);
void __fastcall RemoveItem1Click(TObject *Sender);
void __fastcall CreateItem1Click(TObject *Sender);
void __fastcall NetworkTreeViewChanging(TObject *Sender, TTreeNode *Node, bool &AllowChange);
void __fastcall NetworkTreeViewChange(TObject *Sender, TTreeNode *Node);
void __fastcall ActionCreateCellExecute(TObject *Sender);
void __fastcall ActionCreateCellUpdate(TObject *Sender);
void __fastcall ActionCreateSynapseExecute(TObject *Sender);
void __fastcall ActionCreateSynapseUpdate(TObject *Sender);
void __fastcall ActionCreateElectrodeExecute(TObject *Sender);
void __fastcall ActionCreateElectrodeUpdate(TObject *Sender);
void __fastcall FileOpen1Accept(TObject *Sender);
void __fastcall FileSaveAs1Accept(TObject *Sender);
void __fastcall ActionCurrentEditExecute(TObject *Sender);
void __fastcall ActionCurrentEditUpdate(TObject *Sender);
void __fastcall ActionRunExecute(TObject *Sender);
void __fastcall ActionClearNetworkExecute(TObject *Sender);
void __fastcall ActionRemoveItemExecute(TObject *Sender);
void __fastcall NetworkTreeViewEdited(TObject *Sender, TTreeNode *Node, UnicodeString &S);
void __fastcall NetworkTreeViewEditing(TObject *Sender, TTreeNode *Node, bool &AllowEdit);
void __fastcall NetworkTreeViewDblClick(TObject *Sender);
void __fastcall NetworkTreeViewCancelEdit(TObject *Sender, TTreeNode *Node);
void __fastcall NetworkTabControlChange(TObject *Sender);
void __fastcall NetworkTreeViewMouseMove(TObject *Sender, TShiftState Shift, int X,
int Y);
void __fastcall CopyCurrentsActionExecute(TObject *Sender);
void __fastcall FileOpen1BeforeExecute(TObject *Sender);
void __fastcall FileSaveAs1BeforeExecute(TObject *Sender);
void __fastcall CollapseAll1Click(TObject *Sender);
private: // User declarations
// friend int GetModelMouseMode();
// static TNetwork *net;
// friend TNetwork* GetNet();
// TNetwork *net;
UnicodeString ExeVersion;
bool __fastcall GetTypeAndName(std::wstring & type, std::wstring & name);
void __fastcall UpdateDisplay();
// Network Tree Display functions
TTreeNode *NetworkNode, *CellRootNode, *SynapseRootNode, *ElectrodeRootNode;
TTreeNode *EditedNode;
void __fastcall SyncTreeViewToNetwork();
// map based functions
void __fastcall AddCells(const TCellsMap &cells, TTreeNode * node);
void __fastcall AddSynapses(const TSynapsesMap &synapses, TTreeNode * node);
void __fastcall AddElectrodes(const TElectrodesMap &electrodes, TTreeNode * node);
// vector based functions
void __fastcall AddSynapses(const TSynapsesArray &synapses, TTreeNode * node);
void __fastcall AddElectrodes(const TElectrodesArray &electrodes, TTreeNode * node);
void __fastcall AddCurrents(const TCurrentsArray ¤ts, TTreeNode * node);
// ptr based functions
TTreeNode * __fastcall AddSingleCell(const TCell * cell, TTreeNode * node);
TTreeNode * __fastcall AddSingleSynapse(const TSynapse * synapse, TTreeNode * node);
TTreeNode * __fastcall AddSingleElectrode(const TElectrode * electrode, TTreeNode * node);
TTreeNode * __fastcall AddSingleCurrent(const TCurrent * current, TTreeNode * node);
void __fastcall RemoveNetworkItem();
void __fastcall CreateNetworkItem();
bool __fastcall CheckNetworkTree();
void __fastcall LoadNetwork(UnicodeString filename, TNetwork *net);
void __fastcall WriteNetwork(UnicodeString filename, TNetwork *net);
void __fastcall RemoveEditPaneContents();
public: // User declarations
int ModelMouseMode;
bool __fastcall CreateCell(int X, int Y);
bool __fastcall CreateSynapse(const std::wstring & FirstCellName,
const std::wstring & SecondCellName,
int X, int Y);
bool __fastcall CreateElectrode(const std::wstring & cellname, int X, int Y);
__fastcall TNetworkGUI(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TNetworkGUI *NetworkGUI;
//---------------------------------------------------------------------------
#endif