OSDN Git Service

COUT切断機能を追加
[peercast-im/PeerCastIM.git] / PeerCast.root / PeerCast / ui / win32 / simple / gui.h
1 // ------------------------------------------------
2 // File : gui.h
3 // Date: 4-apr-2002
4 // Author: giles
5 // 
6 // (c) 2002 peercast.org
7 // ------------------------------------------------
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 // ------------------------------------------------
18
19 #ifndef _GUI_H
20 #define _GUI_H
21
22 #include "sys.h"
23 #include "gdiplus.h"
24 #include "channel.h"
25 #include "servent.h"
26
27 extern LRESULT CALLBACK GUIProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
28 extern void ADDLOG(const char *str,int id,bool sel,void *data, LogBuffer::TYPE type);
29
30 extern String iniFileName;
31 extern HWND guiWnd;
32 extern int logID;
33
34 enum 
35 {
36         WM_INITSETTINGS = WM_USER,
37         WM_GETPORTNUMBER,
38         WM_PLAYCHANNEL,
39         WM_TRAYICON,
40         WM_SHOWGUI,
41         WM_SHOWMENU,
42         WM_PROCURL,
43         WM_UPDATETRAFFIC
44 };
45
46 class IdData
47 {
48 private:
49         int channel_id;
50         int servent_id;
51         unsigned int ip_addr;
52
53 public:
54         IdData(int cid, int sid, unsigned int ip){
55                 channel_id = cid;
56                 servent_id = sid;
57                 ip_addr = ip;
58         }
59
60         int getChannelId(){return channel_id;};
61         int getServentId(){return servent_id;};
62         unsigned int getIpAddr(){return ip_addr;};
63 };
64
65 class ServentData
66 {
67 private:
68         int servent_id;
69         int type;
70 //      unsigned int tnum;
71         int status;
72 //      String agent;
73         Host host;
74         String hostname;
75 //      unsigned int syncpos;
76 //      char *typeStr;
77 //      char *statusStr;
78 //      bool infoFlg;
79 //      bool relay;
80 //      bool firewalled;
81         unsigned int totalRelays;
82         unsigned int totalListeners;
83 //      int vp_ver;
84 //      char ver_ex_prefix[2];
85 //      int ver_ex_number;
86
87         bool EnableFlg;
88         bool infoFlg;
89         ServentData *next;
90         ChanHit chanHit;
91         bool selected;
92         int posX;
93         int posY;
94         int     width;
95         int height;
96
97         unsigned int lastSkipTime;
98         unsigned int lastSkipCount;
99
100 public:
101         ServentData(){
102                 next = NULL;
103                 EnableFlg = false;
104                 infoFlg = false;
105
106                 posX = 0;
107                 posY = 0;
108                 width = 0;
109                 selected = false;
110
111         }
112         void setData(Servent *s, ChanHit *hit, unsigned int listeners, unsigned int relays, bool infoFlg);
113         bool getInfoFlg(){return infoFlg;}
114         ChanHit *getChanHit(){return &chanHit;};
115         int getStatus(){return status;};
116         Host getHost(){return host;};
117
118         int getServentId(){return servent_id;};
119
120         bool getEnableFlg(){return EnableFlg;};
121         void setEnableFlg(bool f){EnableFlg = f;};
122         ServentData *getNextData(){return next;};
123         void setNextData(ServentData *s){next = s;};
124         bool getSelected(){return selected;};
125         void setSelected(bool f){selected = f; if (!f){posX=0;posY=0;}};
126         int getWidth(){return width;};
127         void setWidth(int w){width = w;};
128         int getHeight(){return height;};
129         void setHeight(int h){height = h;};
130         String getName(){return hostname;};
131         void setName(String n){hostname = n;};
132
133         int drawServent(Gdiplus::Graphics *g, int x, int y);
134
135         bool checkDown(int x, int y);
136
137 };
138
139 class ChannelData {
140
141 private:
142         int channel_id;
143         char name[257];
144         int bitRate;
145         unsigned int lastPlayStart;
146         int status;
147         int totalListeners;
148         int totalRelays;
149         int localListeners;
150         int localRelays;
151         bool stayConnected;
152         ChanHit chDisp;
153         bool bTracker;
154         unsigned int lastSkipTime;
155         unsigned int skipCount;
156
157         bool EnableFlg;
158         ChannelData *next;
159
160         int posX;
161         int posY;
162         int width;
163         int height;
164         bool selected;
165         ServentData *serventDataTop;
166         bool openFlg;
167
168 public:
169         ChannelData(){
170                 EnableFlg = FALSE;
171                 next = NULL;
172                 posX = 0;
173                 posY = 0;
174                 width = 0;
175                 height = 0;
176                 selected = FALSE;
177                 serventDataTop = NULL;
178                 openFlg = FALSE;
179                 type = Servent::T_NONE;
180                 servent_id = -1;
181         }
182         int drawChannel(Gdiplus::Graphics *g, int x, int y);
183
184         void setData(Channel *);
185         int getChannelId(){return channel_id;};
186         char* getName(){return &(name[0]);};
187         int getBitRate(){return bitRate;};
188         bool isStayConnected(){return stayConnected;};
189         bool isTracker(){return bTracker;};
190         int getStatus(){return status;};
191         unsigned int getLastSkipTime(){return lastSkipTime;};
192
193         int getTotalListeners(){return totalListeners;};
194         int getTotalRelays(){return totalRelays;};
195         int getLocalListeners(){return localListeners;};
196         int getLocalRelays(){return localRelays;};
197
198         bool getEnableFlg(){return EnableFlg;};
199         void setEnableFlg(bool flg){EnableFlg = flg;};
200         ChannelData *getNextData(){return next;};
201         void setNextData(ChannelData* cd){next = cd;};
202
203         int getPosX(){return posX;};
204         void setPosX(int x){posX = x;}
205         int getPosY(){return posY;};
206         void setPosY(int y){posY = y;};
207         int getWidth(){return width;};
208         void setWidth(int w){width = w;};
209         int getHeight(){return height;};
210         void setHeight(int h){height = h;};
211         bool isSelected(){return selected;};
212         void setSelected(bool sel){selected = sel;};
213         bool getOpenFlg(){return openFlg;};
214         void setOpenFlg(bool b){openFlg = b;};
215
216         ServentData* getServentDataTop(){return serventDataTop;};
217         ServentData* findServentData(int servent_id);
218         void addServentData(ServentData *sd);
219         void deleteDisableServents();
220
221         bool setName(int servent_id, String name);
222         int getServentCount();
223
224         bool checkDown(int x, int y);
225
226         Servent::TYPE type; // COUT\82Ì\83T\81[\83o\83\93\83g\8fî\95ñ\95Û\8e\9d\97p
227         int servent_id; // \93¯\8fã\81Bchannel_id\82Å\91ã\97p\82Å\82«\82½\82¯\82ÇPublic\82É\82µ\82½\82­\82È\82¢
228 };
229
230
231
232 #endif