This source file includes following definitions.
- DrawPanel
- Action_Friend_NewCursor
- MessageReceived
1 #include "stdio.h"
2
3 #include "BF_Dict.h"
4 #include "BF_Roster.h"
5 #include "BF_Msg.h"
6 #include "BF_GUI_DlgViews.h"
7 #include "BF_GUI_KeysMenu.h"
8
9 #include "BF_GUI_FilesPanel_InfoPanel.h"
10
11 #include "BF_Roster.h"
12
13
14
15
16 BF_GUI_FilesPanel_InfoPanel::BF_GUI_FilesPanel_InfoPanel(
17 const BRect & o_Rect,
18 bool b_WinPos_OnLeft
19 ):BF_GUI_Panel(o_Rect,"info",b_WinPos_OnLeft)
20 {
21 bNodeReady = false;
22 SetHeader(BF_DictAt(BF_DICT_INFOPANEL_TITLE));
23 }
24
25
26 void
27 BF_GUI_FilesPanel_InfoPanel::DrawPanel(BRect &o_Rect)
28 {
29 BF_GUI_Panel::DrawPanel(o_Rect);
30
31 float fHeight = poSysSetup->oFontNode.fHeight;
32
33
34
35 DrawBottom("", TRUE);
36
37 if(!bNodeReady) return;
38
39 float fy = HeaderHeight() + fHeight;
40 BPoint o,o1,o2;
41 BL_String s,s1;
42 BRect oRect;
43
44
45 poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE));
46 poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
47
48 if(oNode.poLIcon){
49 o.Set(10,fy);
50 poRender->SetDrawingMode(B_OP_ALPHA);
51 poRender->DrawBitmap(oNode.poLIcon,o);
52 poRender->SetDrawingMode(B_OP_COPY);
53 }
54
55 o.Set(50,fy+poSysSetup->oFontToolView.fAscent);
56 s="";
57 s<<oNode.sName;
58 poRender->DrawString(s.String(),o);
59 fy += fHeight+5;
60
61 o.Set(50,fy+poSysSetup->oFontToolView.fAscent);
62 s="";
63 s<<oPath.Path();
64 poRender->DrawString(s.String(),o);
65 fy += fHeight+5;
66
67 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
68 s=BF_DictAt(BF_DICT_INFOPANEL_SIZE);
69 s1=oNode.iSize;
70 s1.SetDigits();
71 s<<s1;
72 poRender->DrawString(s.String(),o);
73 fy += fHeight+5;
74
75 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
76 s=BF_DictAt(BF_DICT_INFOPANEL_DATE);
77 char pcBuffer[200]="";
78 {
79 tm* puTime = localtime(&oNode.uCreateTime);;
80 if(puTime){
81 sprintf(pcBuffer,"%i.%i.%i",
82 puTime->tm_mday,
83 puTime->tm_mon+1,
84 puTime->tm_year+1900);
85 }
86 }
87 s<<pcBuffer;
88 poRender->DrawString(s.String(),o);
89 fy += fHeight+5;
90
91 s=BF_DictAt(BF_DICT_INFOPANEL_PERMS);
92 oNode.PermsTo(s1);
93 s<<s1;
94 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
95 poRender->DrawString(s.String(),o);
96 fy += fHeight+5;
97
98 s=BF_DictAt(BF_DICT_INFOPANEL_MIME);
99 s<<oNode.sType;
100 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
101 poRender->DrawString(s.String(),o);
102 fy += fHeight+5;
103
104 oRect = poRender->Bounds();
105 o1.x = 5;
106 o1.y = fy;
107 o2 = o1;
108 o2.x = oRect.Width()-10;
109 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
110 poRender->StrokeLine(o1,o2);
111 fy += 5;
112
113 poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE));
114 poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
115
116 if(oVol.poLIcon){
117 o.Set(10,fy);
118 poRender->SetDrawingMode(B_OP_ALPHA);
119 poRender->DrawBitmap(oVol.poLIcon,o);
120 poRender->SetDrawingMode(B_OP_COPY);
121 }
122
123 o.Set(50,fy+poSysSetup->oFontToolView.fAscent);
124 s="";
125 s<<oVol.sName;
126 poRender->DrawString(s.String(),o);
127 fy += fHeight*2+5*2;
128
129 if(oVol.bLoadedOk)
130 {
131 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
132 s=BF_DictAt(BF_DICT_INFOPANEL_CAPACITY);
133 s1=oVol.iCapacity;
134 s1.SetDigits();
135 s<<s1;
136 poRender->DrawString(s.String(),o);
137 fy += fHeight+5;
138
139 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
140 s=BF_DictAt(BF_DICT_INFOPANEL_FREEBYTES);
141 s1=oVol.iFree;
142 s1.SetDigits();
143 s<<s1;
144 poRender->DrawString(s.String(),o);
145 fy += fHeight+5;
146
147 if(oVol.bRemovable){
148 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
149 s=BF_DictAt(BF_DICT_INFOPANEL_REMOVEABLE);
150 poRender->DrawString(s.String(),o);
151 fy += fHeight+5;
152 }
153
154 if(oVol.bRemovable){
155 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
156 s=BF_DictAt(BF_DICT_READONLY);
157 poRender->DrawString(s.String(),o);
158 fy += fHeight+5;
159 }
160 }else{
161 o.Set(10,fy+poSysSetup->oFontToolView.fAscent);
162 s=BF_DictAt(BF_DICT_CANTLOADINFO);
163 poRender->DrawString(s.String(),o);
164 fy += fHeight+5;
165 }
166 }
167
168 void
169 BF_GUI_FilesPanel_InfoPanel::Action_Friend_NewCursor(const char *pc_NodePath,const char *pc_NodeName,int32 i_NodeType)
170 {
171 if(pc_NodePath && pc_NodeName){
172
173 BF_Path oPath(pc_NodePath);
174 oNode.sName = pc_NodeName;
175 bNodeReady = true;
176 BF_Roster_ReloadNode(oPath.Path(),&oNode,BF_ROSTER_LOAD_LICON|BF_ROSTER_LOAD_TYPE|BF_ROSTER_LOAD_PERMS);
177
178
179 oVol.Load(oPath.GetVolume().String(),BF_ROSTER_LOAD_LICON);
180 }else{
181 bNodeReady = false;
182 }
183 if(Parent()) Invalidate();
184 }
185
186 void
187 BF_GUI_FilesPanel_InfoPanel::MessageReceived(BMessage* po_Message)
188 {
189 switch(po_Message->what){
190 default:
191 BF_GUI_Panel::MessageReceived(po_Message);
192 }
193 }
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219