Initial revision
[citadel.git] / wincit / selectbb.frm
1 VERSION 4.00
2 Begin VB.Form SelectBBS 
3    Appearance      =   0  'Flat
4    BackColor       =   &H00C0C0C0&
5    BorderStyle     =   3  'Fixed Dialog
6    ClientHeight    =   3120
7    ClientLeft      =   2130
8    ClientTop       =   3780
9    ClientWidth     =   7500
10    ControlBox      =   0   'False
11    FillColor       =   &H00C0C0C0&
12    BeginProperty Font 
13       name            =   "MS Sans Serif"
14       charset         =   0
15       weight          =   700
16       size            =   8.25
17       underline       =   0   'False
18       italic          =   0   'False
19       strikethrough   =   0   'False
20    EndProperty
21    ForeColor       =   &H80000008&
22    Height          =   3525
23    Left            =   2070
24    LinkTopic       =   "Form1"
25    MaxButton       =   0   'False
26    MDIChild        =   -1  'True
27    MinButton       =   0   'False
28    ScaleHeight     =   3120
29    ScaleWidth      =   7500
30    Top             =   3435
31    Width           =   7620
32    Begin VB.CommandButton Prefs_button 
33       Appearance      =   0  'Flat
34       BackColor       =   &H80000005&
35       Caption         =   "Preferences..."
36       Height          =   492
37       Left            =   6000
38       TabIndex        =   5
39       Top             =   2520
40       Width           =   1452
41    End
42    Begin VB.CommandButton Call_button 
43       Appearance      =   0  'Flat
44       BackColor       =   &H80000005&
45       Caption         =   "Connect"
46       Height          =   495
47       Left            =   4560
48       TabIndex        =   4
49       Top             =   2520
50       Width           =   1215
51    End
52    Begin VB.CommandButton Delete_Button 
53       Appearance      =   0  'Flat
54       BackColor       =   &H80000005&
55       Caption         =   "Delete"
56       Height          =   495
57       Left            =   3120
58       TabIndex        =   3
59       Top             =   2520
60       Width           =   1215
61    End
62    Begin VB.CommandButton Edit_Button 
63       Appearance      =   0  'Flat
64       BackColor       =   &H80000005&
65       Caption         =   "Edit"
66       Height          =   495
67       Left            =   1560
68       TabIndex        =   2
69       Top             =   2520
70       Width           =   1335
71    End
72    Begin VB.CommandButton New_Button 
73       Appearance      =   0  'Flat
74       BackColor       =   &H80000005&
75       Caption         =   "New"
76       Height          =   495
77       Left            =   120
78       TabIndex        =   1
79       Top             =   2520
80       Width           =   1215
81    End
82    Begin VB.ListBox List1 
83       Appearance      =   0  'Flat
84       BeginProperty Font 
85          name            =   "Arial"
86          charset         =   0
87          weight          =   700
88          size            =   9
89          underline       =   0   'False
90          italic          =   0   'False
91          strikethrough   =   0   'False
92       EndProperty
93       Height          =   1830
94       Left            =   120
95       TabIndex        =   0
96       Top             =   120
97       Width           =   7335
98    End
99 End
100 Attribute VB_Name = "SelectBBS"
101 Attribute VB_Creatable = False
102 Attribute VB_Exposed = False
103 Dim myDirectory(30) As BBSdir
104 Dim maxEntries%
105
106 Private Sub call_button_click()
107     
108     If List1.ListIndex >= 0 Then
109
110         CurrBBS = myDirectory(List1.ListIndex)
111
112         Cancelled = False
113         Unload SelectBBS
114         Unload IPC
115         Load IPC
116         End If
117
118 End Sub
119
120 Private Sub Delete_Button_Click()
121     
122     If List1.ListIndex >= 0 Then
123         If (MsgBox("Are you sure you wish to delete this system from your list?", 4 + 48 + 256) = 6) Then
124             For a% = List1.ListIndex To maxEntries% - 1
125                 myDirectory(a%) = myDirectory(a% + 1)
126                 Next
127
128             maxEntries% = maxEntries% - 1
129
130             End If
131         
132         Call SaveDialingDirectory
133         Call display_directory
134         End If
135
136 End Sub
137
138 Private Sub display_directory()
139     List1.Clear
140     If maxEntries > 0 Then
141         For a% = 0 To maxEntries - 1
142             List1.AddItem (myDirectory(a%).Name)
143             Next a%
144         End If
145
146 End Sub
147
148 Private Sub edit_button_click()
149     If List1.ListIndex >= 0 Then
150         CurrBBS = myDirectory(List1.ListIndex)
151         editedBBSnum = List1.ListIndex
152         Load EditBBS
153         Unload SelectBBS
154         End If
155
156 End Sub
157
158 Private Sub Form_Load()
159
160     Cancelled = True
161     MainWin.Caption = "Citadel/UX Client for Windows"
162
163     Show
164     SelectBBS.Width = Int(MainWin.Width * 0.9)
165     SelectBBS.Height = Int(MainWin.Height * 0.7)
166     SelectBBS.Left = Int((MainWin.Width - SelectBBS.Width) / 2)
167     SelectBBS.Top = Int((MainWin.Height - SelectBBS.Height) / 4)
168     
169    
170     ' Initialize the dialing directory
171     maxEntries% = 0
172
173     Call LoadDialingDirectory
174
175 End Sub
176
177 Private Sub Form_Resize()
178
179     new_button.Top = Abs(SelectBBS.Height - 996)
180     edit_button.Top = Abs(SelectBBS.Height - 996)
181     delete_button.Top = Abs(SelectBBS.Height - 996)
182     call_button.Top = Abs(SelectBBS.Height - 996)
183     prefs_button.Top = Abs(SelectBBS.Height - 996)
184     List1.Height = Abs(SelectBBS.Height - 1212 - List1.Top + 120)
185     List1.Width = Abs(SelectBBS.Width - 288)
186
187 End Sub
188
189 Private Sub List1_DblClick()
190     Call call_button_click
191 End Sub
192
193 Private Sub List1_KeyPress(keyascii As Integer)
194     If keyascii = 13 Then Call call_button_click
195 End Sub
196
197 Private Sub LoadDialingDirectory()
198     On Error Resume Next
199     Open "dialing.dir" For Input As #1
200     If Err = 0 Then
201         maxEntries% = 0
202         Do
203             a% = maxEntries
204             Input #1, myDirectory(a%).Name, myDirectory(a%).PhoneOrAddress, myDirectory(a%).TCPport
205             If Err = 0 Then maxEntries = maxEntries + 1
206             Loop Until Err <> 0
207         Close #1
208         End If
209
210
211     b% = 0
212     If editedBBSnum >= 0 Then
213         myDirectory(editedBBSnum) = CurrBBS
214         editedBBSnum = (-1)
215         b% = 1
216         End If
217
218     If maxEntries% > 0 Then
219         For a% = 0 To maxEntries - 1
220             If Left$(myDirectory(a%).Name, 9) = "newbbs000" Then
221                 myDirectory(a%) = myDirectory(a% + 1)
222                 maxEntries% = maxEntries% - 1
223                 End If
224             Next
225         End If
226     
227     If b% = 1 Then Call SaveDialingDirectory
228     Call display_directory
229
230 End Sub
231
232 Private Sub New_Button_Click()
233     
234     maxEntries% = maxEntries% + 1
235
236     z = maxEntries% - 1
237
238     myDirectory(z).Name = "newbbs000"
239     myDirectory(z).PhoneOrAddress = ""
240     myDirectory(z).TCPport = 504
241     
242     Call SaveDialingDirectory
243     Call display_directory
244     List1.ListIndex = z
245     
246     Call edit_button_click
247 End Sub
248
249 Private Sub Prefs_button_Click()
250     Load Preferences
251     Unload SelectBBS
252 End Sub
253
254 Private Sub SaveDialingDirectory()
255     On Error Resume Next
256     Open "dialing.dir" For Output As #1
257     If Err = 0 Then
258         If maxEntries > 0 Then
259             For a% = 0 To maxEntries - 1
260                 Write #1, myDirectory(a%).Name, myDirectory(a%).PhoneOrAddress, myDirectory(a%).TCPport
261                 Next
262             End If
263         Close #1
264         End If
265
266 End Sub
267
268