|
|
1.1 root 1: /* $Id: PropertiesDlgUnit.cpp,v 1.5 2005/04/26 08:46:42 rswindell Exp $ */
2:
3: /****************************************************************************
4: * @format.tab-size 4 (Plain Text/Source Code File Header) *
5: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
6: * *
7: * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html *
8: * *
9: * This program is free software; you can redistribute it and/or *
10: * modify it under the terms of the GNU General Public License *
11: * as published by the Free Software Foundation; either version 2 *
12: * of the License, or (at your option) any later version. *
13: * See the GNU General Public License for more details: gpl.txt or *
14: * http://www.fsf.org/copyleft/gpl.html *
15: * *
16: * Anonymous FTP access to the most recent released source is available at *
17: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
18: * *
19: * Anonymous CVS access to the development source and modification history *
20: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
21: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
22: * (just hit return, no password is necessary) *
23: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
24: * *
25: * For Synchronet coding style and modification guidelines, see *
26: * http://www.synchro.net/source.html *
27: * *
28: * You are encouraged to submit any modifications (preferably in Unix diff *
29: * format) via e-mail to [email protected] *
30: * *
31: * Note: If this box doesn't appear square, then you need to fix your tabs. *
32: ****************************************************************************/
33:
34: //---------------------------------------------------------------------
35: #include <vcl.h>
36: #pragma hdrstop
37:
38: #include "NodeFormUnit.h"
39: #include "ClientFormUnit.h"
40: #include "TelnetFormUnit.h"
41: #include "EventsFormUnit.h"
42: #include "FtpFormUnit.h"
43: #include "WebFormUnit.h"
44: #include "MailFormUnit.h"
45: #include "ServicesFormUnit.h"
46: #include "PropertiesDlgUnit.h"
47: //---------------------------------------------------------------------
48: #pragma resource "*.dfm"
49: TPropertiesDlg *PropertiesDlg;
50: //---------------------------------------------------------------------
51: __fastcall TPropertiesDlg::TPropertiesDlg(TComponent* AOwner)
52: : TForm(AOwner)
53: {
54: }
55: //---------------------------------------------------------------------
56: void __fastcall TPropertiesDlg::FormShow(TObject *Sender)
57: {
58: TrayIconCheckBoxClick(Sender);
59: PageControl->ActivePage=SettingsTabSheet;
60: SourceComboBoxChange(Sender);
61: }
62: //---------------------------------------------------------------------------
63:
64: void __fastcall TPropertiesDlg::TrayIconCheckBoxClick(TObject *Sender)
65: {
66: PasswordEdit->Enabled=TrayIconCheckBox->Checked;
67: PasswordLabel->Enabled=PasswordEdit->Enabled;
68: }
69: //---------------------------------------------------------------------------
70:
71: void __fastcall TPropertiesDlg::SourceComboBoxChange(TObject *Sender)
72: {
73: TargetComboBox->ItemIndex=SourceComboBox->ItemIndex;
74: switch(SourceComboBox->ItemIndex) {
75: case 0: /* Node List */
76: ExampleEdit->Font=NodeForm->ListBox->Font;
77: ExampleEdit->Color=NodeForm->ListBox->Color;
78: break;
79: case 1: /* Client List */
80: ExampleEdit->Font=ClientForm->ListView->Font;
81: ExampleEdit->Color=ClientForm->ListView->Color;
82: break;
83: case 2: /* Telnet Server Log */
84: ExampleEdit->Font=TelnetForm->Log->Font;
85: ExampleEdit->Color=TelnetForm->Log->Color;
86: break;
87: case 3: /* Events Log */
88: ExampleEdit->Font=EventsForm->Log->Font;
89: ExampleEdit->Color=EventsForm->Log->Color;
90: break;
91: case 4: /* FTP Server Log */
92: ExampleEdit->Font=FtpForm->Log->Font;
93: ExampleEdit->Color=FtpForm->Log->Color;
94: break;
95: case 5: /* Mail Server Log */
96: ExampleEdit->Font=MailForm->Log->Font;
97: ExampleEdit->Color=MailForm->Log->Color;
98: break;
99: case 6: /* Web Server Log */
100: ExampleEdit->Font=WebForm->Log->Font;
101: ExampleEdit->Color=WebForm->Log->Color;
102: break;
103: case 7: /* Services Log */
104: ExampleEdit->Font=ServicesForm->Log->Font;
105: ExampleEdit->Color=ServicesForm->Log->Color;
106: break;
107: }
108: }
109: //---------------------------------------------------------------------------
110:
111: void __fastcall TPropertiesDlg::FontButtonClick(TObject *Sender)
112: {
113: TFontDialog *FontDialog=new TFontDialog(this);
114:
115: FontDialog->Font=ExampleEdit->Font;
116: if(FontDialog->Execute())
117: ExampleEdit->Font->Assign(FontDialog->Font);
118: delete FontDialog;
119: }
120: //---------------------------------------------------------------------------
121:
122: void __fastcall TPropertiesDlg::BackgroundButtonClick(TObject *Sender)
123: {
124: TColorDialog* ColorDialog=new TColorDialog(this);
125:
126: ColorDialog->Options << cdPreventFullOpen;
127: ColorDialog->Color=ExampleEdit->Color;
128: if(ColorDialog->Execute())
129: ExampleEdit->Color=ColorDialog->Color;
130: delete ColorDialog;
131: }
132: //---------------------------------------------------------------------------
133: void __fastcall TPropertiesDlg::ChangeScheme(int target)
134: {
135: switch(target) {
136: case 0: /* Node List */
137: NodeForm->ListBox->Font=ExampleEdit->Font;
138: NodeForm->ListBox->Color=ExampleEdit->Color;
139: break;
140: case 1: /* Client List */
141: ClientForm->ListView->Font=ExampleEdit->Font;
142: ClientForm->ListView->Color=ExampleEdit->Color;
143: break;
144: case 2: /* Telnet Server Log */
145: TelnetForm->Log->Font=ExampleEdit->Font;
146: TelnetForm->Log->Color=ExampleEdit->Color;
147: break;
148: case 3: /* Events Log */
149: EventsForm->Log->Font=ExampleEdit->Font;
150: EventsForm->Log->Color=ExampleEdit->Color;
151: break;
152: case 4: /* FTP Server Log */
153: FtpForm->Log->Font=ExampleEdit->Font;
154: FtpForm->Log->Color=ExampleEdit->Color;
155: break;
156: case 5: /* Mail Server Log */
157: MailForm->Log->Font=ExampleEdit->Font;
158: MailForm->Log->Color=ExampleEdit->Color;
159: break;
160: case 6: /* Web Server Log */
161: WebForm->Log->Font=ExampleEdit->Font;
162: WebForm->Log->Color=ExampleEdit->Color;
163: break;
164: case 7: /* Services Log */
165: ServicesForm->Log->Font=ExampleEdit->Font;
166: ServicesForm->Log->Color=ExampleEdit->Color;
167: break;
168: }
169: }
170: //---------------------------------------------------------------------------
171: void __fastcall TPropertiesDlg::ApplyButtonClick(TObject *Sender)
172: {
173: if(TargetComboBox->ItemIndex==SourceComboBox->Items->Count) {
174: for(int i=0;i<SourceComboBox->Items->Count;i++)
175: ChangeScheme(i);
176: } else
177: ChangeScheme(TargetComboBox->ItemIndex);
178: }
179: //---------------------------------------------------------------------------
180:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.