root/BF_GUI_Func.cpp

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MouseUp
  2. MouseDown
  3. OnMouseDown
  4. OnMouseUp
  5. KeyDown
  6. OnBeforeKeyDown
  7. PrepareCmdLine
  8. Close
  9. OnKeyDown
  10. Draw_OpenTransaction
  11. Draw_CloseTransaction
  12. DrawBackground
  13. DrawPanel
  14. Path
  15. Draw
  16. SetHeader
  17. HeaderHeight
  18. DrawStringCheck
  19. DrawHeader
  20. BottomHeight
  21. BottomRect
  22. ClientRect
  23. DrawBottom
  24. ActionCopyFrom_Run
  25. PrepareTopMenuItem
  26. PrepareKeysMenu
  27. SetupUpdated
  28. MessageReceived
  29. Run_TopMenu
  30. FrameResized
  31. NavPressInHeader
  32. Enable
  33. Enabled
  34. OnEnable
  35. MakeFocus
  36. OnFocus
  37. OnClose
  38. SayFriend_About_CursorChanged
  39. Nodes_GetAll
  40. Nodes_SetSelectingByName
  41. StoreVars
  42. BF_GUI_Func_PanelsEnable
  43. BF_GUI_Func_PanelsShow
  44. BF_GUI_Func_RedrawDialogs
  45. BF_GUI_Func_EnableDialog
  46. BF_GUI_Func_CloseDialog
  47. BF_GUI_Func_AddChildToMainView
  48. BF_GUI_MakeFocusTo

   1 #include <Autolock.h>
   2 
   3 #include "BF_Msg.h"
   4 #include "BF_GUI_Setup.h"       
   5 #include "BF_GUI_Func.h"
   6 #include "BF_GUI_KeysMenu.h"
   7 #include "BF_GUI_CmdLine.h"
   8 #include "BF_GUI_WinMain.h"
   9 #include "BF_GUI_OperRoster.h"
  10 
  11 BF_GUI_Panel::BF_GUI_Panel(
  12         const BRect&    o_Rect,         
  13         const char*             pc_FirstName,                                                   
  14         bool                    b_WinPos_OnLeft)
  15 :BView(o_Rect,"_panel",B_FOLLOW_NONE,B_WILL_DRAW|B_NAVIGABLE|B_FRAME_EVENTS)    
  16 {
  17         bWinPos_OnLeft = b_WinPos_OnLeft;
  18         SetViewColor(B_TRANSPARENT_COLOR);
  19         iDisableCount = 0;
  20         bFixedFocus = false;
  21         poHeaderSIcon = NULL;
  22         /* set name */
  23         {
  24                 ASSERT(pc_FirstName);
  25                 BL_String s;
  26                 s<<pc_FirstName;
  27                 s<<"_panel";
  28                 s<<"_";
  29                 s<<(b_WinPos_OnLeft?"_left":"_right");
  30                 SetName(s.String());
  31         }
  32         /**/
  33         poRender = this;
  34         poRenderBitmap = NULL;
  35         iRenderDeep = 0;
  36         bNeedUpdateAfterEnable = false;
  37 }
  38 
  39 BF_GUI_Panel::~BF_GUI_Panel()
  40 {
  41         if(poHeaderSIcon) delete poHeaderSIcon;
  42 }
  43 
  44 void
  45 BF_GUI_Panel::MouseUp(BPoint point)    /* [previous][next][first][last][top][bottom][index][help] */
  46 {
  47         OnMouseUp(point);
  48 }
  49 
  50 void                                    
  51 BF_GUI_Panel::MouseDown(BPoint point)    /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         OnMouseDown(point);
  54 }
  55 
  56 bool                                    
  57 BF_GUI_Panel::OnMouseDown(BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59         /* check for disable */
  60         if(!Enabled()){
  61                 BRect   oFrame = Frame();
  62                 BPoint  oPoint;
  63                 oPoint.x = oFrame.left + o_Point.x;
  64                 oPoint.y = oFrame.top + o_Point.y;
  65                 
  66                 BMessenger      oMessenger(poWinView);
  67                 BMessage        oMessage(BF_MSG_MAINVIEW_MOUSE_DOWN);
  68                 oMessage.AddPoint("bf_point",oPoint);
  69                 oMessage.AddPointer("bf_view",(void*)this);             
  70                 oMessenger.SendMessage(&oMessage);
  71                 return true;    
  72         }
  73         /* check for pressing in path_line */
  74         if(o_Point.y<=HeaderHeight()){
  75                 NavPressInHeader(o_Point);
  76                 return true;
  77         }       
  78         return false;
  79 }
  80 bool
  81 BF_GUI_Panel::OnMouseUp(BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
  82 {
  83         return false;
  84 }
  85 
  86 
  87 void            
  88 BF_GUI_Panel::KeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
  89 {
  90         if(OnBeforeKeyDown(bytes,numBytes)) return;
  91         if(poCmdLine && poCmdLine->OnKeyDown(bytes,numBytes)) return;
  92         if(poSysKeysMenu && poSysKeysMenu->OnKeyDown(bytes,numBytes)) return;   
  93         OnKeyDown(bytes,numBytes);
  94 }
  95 
  96 bool
  97 BF_GUI_Panel::OnBeforeKeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
  98 {
  99         return false;
 100 }
 101 
 102 void                                    
 103 BF_GUI_Panel::PrepareCmdLine()    /* [previous][next][first][last][top][bottom][index][help] */
 104 {
 105         if(!poCmdLine) return;
 106         poCmdLine->SetValues("","");
 107 }
 108 
 109 bool
 110 BF_GUI_Panel::Close()    /* [previous][next][first][last][top][bottom][index][help] */
 111 {
 112         if(!OnClose()) return false;
 113         
 114         poWinView->RemovePanel(this);
 115         
 116         return true;
 117 }
 118 
 119 bool
 120 BF_GUI_Panel::OnKeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
 121 {
 122         uint32  iKeysModifiers = modifiers();
 123 
 124         if(numBytes==1 && bytes[0]==B_ESCAPE){
 125                 Close();
 126                 return true;
 127         }
 128 
 129         if(bytes[0] == B_FUNCTION_KEY){
 130                 int32 iKey;
 131                 BMessage *poMsg = Window()->CurrentMessage();
 132                 if(!poMsg) return false;
 133                 poMsg->FindInt32("key", &iKey);
 134                 if(iKeysModifiers & B_RIGHT_OPTION_KEY){                
 135                 }else{
 136                         /*switch(iKey){
 137                         case B_F9_KEY:{
 138                                 Run_TopMenu();
 139                                 break;}
 140                         case B_F10_KEY:{        
 141                                 BMessage        oMessage(BF_MSG_MAINVIEW_ASK_QUIT);
 142                                 BMessenger      oMessenger(poWinView);
 143                                 oMessenger.SendMessage(&oMessage);
 144                                 return true;
 145                                 break;}
 146                         }*/
 147                 }
 148         }               
 149         BView::KeyDown(bytes,numBytes);         
 150         return false;
 151 }
 152 
 153 void
 154 BF_GUI_Panel::Draw_OpenTransaction()    /* [previous][next][first][last][top][bottom][index][help] */
 155 {
 156         iRenderDeep++;
 157         /* open transaction */
 158         if(     iRenderDeep == 1){
 159                 BRect oRect(Bounds());
 160                 poRenderBitmap = new BBitmap(oRect,B_RGB16,true);               
 161                 poRenderBitmap->AddChild( poRender = new BView(oRect,"",B_FOLLOW_ALL,B_WILL_DRAW) );
 162                 poRenderBitmap->Lock();
 163                 poRender->SetViewColor(B_TRANSPARENT_COLOR);
 164                 poRender->SetFont(&poSysSetup->oFontNode.oFont,B_FONT_ALL);
 165         }
 166 }
 167 
 168 void
 169 BF_GUI_Panel::Draw_CloseTransaction(BRect * po_RectDest)    /* [previous][next][first][last][top][bottom][index][help] */
 170 {       
 171         iRenderDeep--;
 172         /* close transaction */
 173         if(iRenderDeep==0){     
 174                 LOCK_WIN();
 175                 poRender->Sync();               
 176                 // poRenderBitmap->Unlock();
 177                 SetDrawingMode(B_OP_COPY);
 178                 if(po_RectDest)
 179                         DrawBitmap(poRenderBitmap,*po_RectDest,*po_RectDest);
 180                 else
 181                         DrawBitmap(poRenderBitmap,Bounds());
 182                 if(poRender->RemoveSelf())      DELETE(poRender);
 183                 poRenderBitmap->Unlock();//
 184                 DELETE(poRenderBitmap);         
 185                 poRender = this;                                        
 186         }
 187 }
 188 
 189 void 
 190 BF_GUI_Panel::DrawBackground(const BRect & o_Rect) const    /* [previous][next][first][last][top][bottom][index][help] */
 191 {
 192         poRender->SetHighColor(SYS_COLOR(BF_COLOR_BACK));               
 193         poRender->FillRect(o_Rect);
 194 }
 195 
 196 void
 197 BF_GUI_Panel::DrawPanel(BRect & o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 198 {
 199         BRect   oRect;
 200         BPoint  o1,o2;  
 201         float   fHeight = poSysSetup->oFontNode.fHeight;        
 202         
 203         oRect = poRender->Bounds();
 204         
 205         // draw background 
 206         DrawBackground(oRect);  
 207         // draw left_frame 
 208         poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));      
 209         oRect = poRender->Bounds();
 210         o1.Set(1,HeaderHeight()/2-1);
 211         o2.Set(o1.x,oRect.bottom-fHeight/2+1);
 212         poRender->StrokeLine(o1,o2);
 213         o1.x+=2;o2.x=o1.x;
 214         o1.y+=2;o2.y-=2;
 215         poRender->StrokeLine(o1,o2);
 216         /* draw right_frame */
 217         poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));      
 218         o1.Set(oRect.right-1,HeaderHeight()/2-1);
 219         o2.Set(o1.x,oRect.bottom-fHeight/2+1);
 220         poRender->StrokeLine(o1,o2);
 221         o1.x-=2;o2.x=o1.x;
 222         o1.y+=2;o2.y-=2;
 223         poRender->StrokeLine(o1,o2);
 224         
 225         /* draw path */ 
 226         DrawHeader(IsFocus());          
 227 }
 228 
 229 const BL_String
 230 BF_GUI_Panel::Path() const    /* [previous][next][first][last][top][bottom][index][help] */
 231 {
 232         BL_String sResult("//");
 233         return sResult;
 234 }
 235 
 236 void                                    
 237 BF_GUI_Panel::Draw(BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 238 {
 239         Draw_OpenTransaction(); 
 240         DrawPanel(o_Rect);
 241         Draw_CloseTransaction();
 242 }
 243 
 244 void
 245 BF_GUI_Panel::SetHeader(const char *pc_Header,BBitmap * po_SIcon)    /* [previous][next][first][last][top][bottom][index][help] */
 246 {
 247         sHeader=pc_Header?pc_Header:"";
 248         if(po_SIcon){
 249                 if(poHeaderSIcon) DELETE(poHeaderSIcon);
 250                 poHeaderSIcon = new BBitmap(po_SIcon);
 251         }
 252         
 253         if(Parent()) DrawHeader(IsFocus());
 254 }
 255 
 256 float
 257 BF_GUI_Panel::HeaderHeight()    /* [previous][next][first][last][top][bottom][index][help] */
 258 {
 259         float   fNodeHeight = poSysSetup->oFontNode.fHeight;
 260         if(poSysSetup->MainStyle() & BF_SETUP_MAIN_FP_HEADERICON)
 261         if(fNodeHeight<18) fNodeHeight = 18;
 262         return fNodeHeight;
 263 }
 264 
 265 void
 266 BF_GUI_Panel::DrawStringCheck(const char *pc_Text,float f_Width,BPoint & o_Point,BFont *po_Font)    /* [previous][next][first][last][top][bottom][index][help] */
 267 {
 268         ASSERT(pc_Text);
 269         
 270         if(!po_Font) po_Font = &poSysSetup->oFontNode.oFont;    
 271         ///
 272         BRect oRect;
 273         oRect.top = o_Point.y-1000;
 274         oRect.bottom = o_Point.y+1000;
 275         oRect.left = o_Point.x;
 276         oRect.right = o_Point.x + f_Width;      
 277 
 278         BRegion oReg;
 279         oReg.Set(oRect);
 280         poRender->ConstrainClippingRegion(&oReg);
 281         poRender->DrawString(pc_Text,o_Point);
 282         poRender->ConstrainClippingRegion(NULL);
 283         ///
 284                         
 285         //poRender->DrawString(s_Text.String(),BF_GUI_GetTextLength(s_Text,f_Width,*po_Font),o_Point);
 286 }
 287 
 288 void
 289 BF_GUI_Panel::DrawHeader(bool b_IsFocus)    /* [previous][next][first][last][top][bottom][index][help] */
 290 {
 291         BString s;
 292         BRect   oRect(poRender->Bounds());
 293         float   fPathWidth;     
 294         float   fNodeHeight = HeaderHeight();
 295         float   fIconWidth = ((poSysSetup->MainStyle() & BF_SETUP_MAIN_FP_HEADERICON) && poHeaderSIcon)?18.0:0.0;
 296         /* prepare path */      
 297         {
 298                 float fMax;
 299                 s = sHeader;
 300                 fMax = oRect.Width()-40-fIconWidth;
 301                 while(TRUE){
 302                         fPathWidth = poSysSetup->oFontNode.oFont.StringWidth(s.String());
 303                         if(fPathWidth<=fMax) break;
 304                         s.Remove(0,1);
 305                 }
 306         }       
 307         
 308         float fWidth = poSysSetup->oFontNode.oFont.StringWidth(s.String()) + fIconWidth;
 309         float fLeft = (oRect.Width() - fWidth)/2;       
 310 
 311         /* fill blue backround */       
 312         oRect = poRender->Bounds();
 313         oRect.left+=5;
 314         oRect.right-=5;
 315         oRect.bottom = fNodeHeight;
 316         poRender->SetHighColor(SYS_COLOR(BF_COLOR_PATH_BACK));  
 317         poRender->FillRect(oRect);
 318                 
 319         /* draw path */ 
 320         oRect = poRender->Bounds();
 321         oRect.left=fLeft-2;
 322         oRect.right=fLeft+fWidth+2;
 323         oRect.bottom = fNodeHeight;
 324         if(b_IsFocus)
 325                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_PATH_FOCUSBACK));     
 326         else
 327                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_PATH_BACK));  
 328         poRender->FillRect(oRect);
 329         /* title */      
 330         oRect = Bounds(); 
 331         /* draw lines */
 332         BPoint o1,o2;
 333         /* left line */
 334         o1.Set(1,fNodeHeight/2-1);
 335         o2.Set(fLeft-3,o1.y);
 336         poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 337         poRender->StrokeLine(o1,o2);    
 338         o1.x+=2;
 339         o1.y+=2;o2.y=o1.y;
 340         poRender->StrokeLine(o1,o2);    
 341         /* right line */
 342         o1.Set(fLeft+fWidth+3,fNodeHeight/2-1);
 343         o2.Set(oRect.right-1,o1.y);
 344         poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 345         poRender->StrokeLine(o1,o2);    
 346         o2.x-=2;
 347         o1.y+=2;o2.y=o1.y;
 348         poRender->StrokeLine(o1,o2);
 349         if(poSysSetup->MainStyle() & BF_SETUP_MAIN_FP_HEADERICON){
 350                 if(poHeaderSIcon){
 351                         BPoint o(fLeft,0);
 352                         poRender->SetDrawingMode(B_OP_ALPHA);           
 353                         poRender->DrawBitmap(poHeaderSIcon,o);
 354                         poRender->SetDrawingMode(B_OP_COPY);                    
 355                 }
 356         }                       
 357         /* print header */
 358         o1.Set(fLeft+fIconWidth,poSysSetup->oFontNode.fAscent); 
 359         if(b_IsFocus){
 360                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_PATH_FOCUSTEXT));
 361                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_PATH_FOCUSBACK));
 362         }else{
 363                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_PATH_TEXT));
 364                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_PATH_BACK));
 365         }
 366         poRender->SetFont(&poSysSetup->oFontNode.oFont);
 367         poRender->DrawString(s.String(),o1);
 368 }
 369 
 370 
 371 float
 372 BF_GUI_Panel::BottomHeight()    /* [previous][next][first][last][top][bottom][index][help] */
 373 {
 374         return poSysSetup->oFontNode.fHeight;
 375 }
 376 
 377 
 378 BRect 
 379 BF_GUI_Panel::BottomRect()    /* [previous][next][first][last][top][bottom][index][help] */
 380 {
 381         BRect oRect;
 382         oRect = poRender->Bounds();
 383         oRect.left+=4;
 384         oRect.right-=4;
 385         oRect.top = oRect.bottom-BottomHeight();
 386         
 387         return oRect;
 388 }
 389 
 390 BRect
 391 BF_GUI_Panel::ClientRect()    /* [previous][next][first][last][top][bottom][index][help] */
 392 {
 393         BRect oRect(Bounds());
 394         oRect.left = 6;
 395         oRect.right -= 6;       
 396         oRect.top += HeaderHeight();
 397         oRect.bottom -= BottomHeight();
 398         
 399         return oRect;
 400 }
 401 
 402 void 
 403 BF_GUI_Panel::DrawBottom(const char *pc_Text,bool b_DrawBack)    /* [previous][next][first][last][top][bottom][index][help] */
 404 {
 405         BRect oRect;
 406         float fNodeHeight = poSysSetup->oFontNode.fHeight;
 407         /* erase background  */
 408         if(b_DrawBack){
 409                 oRect = BottomRect();
 410                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_BACK));
 411                 poRender->FillRect(oRect);
 412         }
 413         /* print */     
 414         if(pc_Text && pc_Text[0]!='\0'){
 415                 BL_String s(pc_Text);   
 416             float fWidth = poSysSetup->oFontNode.oFont.StringWidth(s.String());
 417                 oRect = Bounds();
 418                 float fLeft = (oRect.Width() - fWidth)/2;
 419                 /* draw lines */
 420                 BPoint o1,o2;
 421                 /* left line */
 422                 o1.Set(1,oRect.bottom-fNodeHeight/2+1);
 423                 o2.Set(fLeft-(pc_Text?3.0:0.0),o1.y);
 424                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 425                 poRender->StrokeLine(o1,o2);    
 426                 o1.x+=2;
 427                 o1.y-=2;o2.y=o1.y;
 428                 poRender->StrokeLine(o1,o2);    
 429                 /* right line */
 430                 o1.Set(fLeft+fWidth+3.0,oRect.bottom-fNodeHeight/2+1);
 431                 o2.Set(oRect.right-1,o1.y);
 432                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 433                 poRender->StrokeLine(o1,o2);    
 434                 o2.x-=2;
 435                 o1.y-=2;o2.y=o1.y;
 436                 poRender->StrokeLine(o1,o2);            
 437                 /* draw info */
 438                 o1.Set(fLeft,oRect.bottom-poSysSetup->oFontNode.fDescent);
 439                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_PANEL_INFO_TEXT));
 440                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
 441                 poRender->DrawString(s.String(),o1);
 442         }else{
 443                 /* draw lines */
 444                 BPoint o1,o2;
 445                 oRect = poRender->Bounds();
 446                 /**/
 447                 o1.Set(1,oRect.bottom-fNodeHeight/2+1);
 448                 o2.Set(oRect.right-1,o1.y);
 449                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 450                 poRender->StrokeLine(o1,o2);    
 451                 o1.x+=2;
 452                 o2.x-=2;
 453                 o1.y-=2;o2.y=o1.y;
 454                 poRender->StrokeLine(o1,o2);    
 455         }
 456 }
 457 
 458 void                                    
 459 BF_GUI_Panel::ActionCopyFrom_Run(BL_String & s_Path,BF_NodeCollection & lo_Node,bool b_Move)    /* [previous][next][first][last][top][bottom][index][help] */
 460 {
 461 }
 462 
 463 void
 464 BF_GUI_Panel::PrepareTopMenuItem(BF_GUI_TopMenu_HItem *po_HItem)    /* [previous][next][first][last][top][bottom][index][help] */
 465 {
 466         
 467 }
 468 
 469 void
 470 BF_GUI_Panel::PrepareKeysMenu()    /* [previous][next][first][last][top][bottom][index][help] */
 471 {
 472         poSysKeysMenu->Clear();         
 473         uint32  iKeysModifiers = modifiers();
 474         
 475         if(iKeysModifiers & B_OPTION_KEY){
 476                 poSysKeysMenu->SetText(9,"SaveSetup");
 477                 poSysKeysMenu->SetMessage(9,new BMessage(BF_MSG_MAINVIEW_MAINSETUP_SAVE),poWinView);
 478         }else{                                  
 479                 poSysKeysMenu->SetText(1,"LeftVol");
 480                 poSysKeysMenu->SetMessage(1,new BMessage(BF_MSG_MAINVIEW_SELVOL_LEFT),poWinView);
 481                 
 482                 poSysKeysMenu->SetText(2,"RightVol");
 483                 poSysKeysMenu->SetMessage(2,new BMessage(BF_MSG_MAINVIEW_SELVOL_RIGHT),poWinView);
 484         
 485                 poSysKeysMenu->SetText(9,"Menu");
 486                 poSysKeysMenu->SetMessage(9,new BMessage(BF_MSG_PANEL_TOPMENU),this);
 487                 
 488                 poSysKeysMenu->SetText(10,"Exit");
 489                 poSysKeysMenu->SetMessage(10,new BMessage(BF_MSG_MAINVIEW_ASK_QUIT),poWinView);
 490         }       
 491 }
 492 
 493 void
 494 BF_GUI_Panel::SetupUpdated()    /* [previous][next][first][last][top][bottom][index][help] */
 495 {
 496         SetFont(&poSysSetup->oFontNode.oFont);
 497         Draw(Bounds());
 498 }
 499 
 500 void
 501 BF_GUI_Panel::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 502 {
 503         switch(po_Message->what) {      
 504         ///// set path /////
 505         case BF_MSG_TO_PANEL_SET_PATH:{
 506                 BF_GUI_Panel *poPrevPanel = poWinView->PanelByIndex(bWinPos_OnLeft,-1);
 507                 if(!Close()) break;             
 508                 if(!poPrevPanel) break;
 509                 BMessenger oMessenger(poPrevPanel);
 510                 oMessenger.SendMessage(po_Message);
 511                 break;}
 512         // cursor       
 513         case BF_MSG_TO_PANEL_FRIEND_NEWCURSOR:{
 514                 const char *pcNodePath;
 515                 if(B_OK!=po_Message->FindString("bf_pcNodePath",&pcNodePath) || !pcNodePath) return;
 516                 const char *pcNodeName;
 517                 if(B_OK!=po_Message->FindString("bf_pcNodeName",&pcNodeName) || !pcNodeName) return;
 518                 int32 iNodeType = po_Message->FindInt32("bf_iNodeType");
 519                 
 520                 Action_Friend_NewCursor(pcNodePath,pcNodeName,iNodeType);
 521                 
 522                 break;}
 523         case BF_MSG_MAKEFOCUS:
 524                 MakeFocus();
 525                 break;
 526         case BF_MSG_SETUP_UPDATED:
 527                 SetupUpdated();
 528                 break;
 529         /* buffer messages */
 530         case B_COPY:{
 531                 Action_CopyToBuffer();          
 532                 break;}         
 533         case B_PASTE:{
 534                 Action_PasteFromBuffer();               
 535                 break;}                         
 536         /* keyboard modifiers changed */
 537         case 1599425348:
 538         case 1599425365:
 539                 if(poSysKeysMenu)       PrepareKeysMenu();
 540                 break;
 541         /* main window  receive focus */
 542         case BF_MSG_TOTAL_WIN_RECEIVE_FOCUS:
 543                 if(poSysKeysMenu)       PrepareKeysMenu();
 544                 break;          
 545         case BF_MSG_PANEL_FOCUS_AND_ENABLE:
 546                 BF_GUI_Func_PanelsEnable(true);
 547                 MakeFocus();
 548                 break;
 549         case BF_MSG_MAINVIEW_MAINSETUP_CLOSE:
 550                 BF_GUI_Func_PanelsEnable(true);
 551                 MakeFocus();
 552                 break;
 553         case BF_MSG_PANEL_TOPMENU:{
 554                 Run_TopMenu();
 555                 break;}
 556         case BF_MSG_PANEL_TOPMENU_INVOKED:{
 557                 MakeFocus();
 558                 break;}
 559         /*=======================*/     
 560         case BF_MSG_VIEW_MAINWIN_RESIZED:{
 561                 if(!Parent()) break;
 562                                 
 563                 BRect oParRect = Parent()->Bounds();
 564                 float fBotHeight = poSysSetup->oFontNode.fHeight + poSysSetup->oFontCMDLine.fHeight;
 565                 fBotHeight += poOperRoster->fHeightInWinMain();
 566 
 567                 if(bWinPos_OnLeft){
 568                         ResizeTo(oParRect.Width()/2-1,oParRect.Height()- fBotHeight );
 569                 }else{
 570                         MoveTo(oParRect.Width()/2,0);
 571                         ResizeTo(oParRect.Width()/2,oParRect.Height()- fBotHeight);
 572                 }
 573                 
 574                 break;}
 575         default:{
 576                 BView::MessageReceived(po_Message);
 577                 break;}                         
 578         }
 579 };
 580 
 581 void
 582 BF_GUI_Panel::Run_TopMenu()    /* [previous][next][first][last][top][bottom][index][help] */
 583 {
 584         BF_GUI_TopMenu_Run();
 585 }
 586 
 587 void                                    
 588 BF_GUI_Panel::FrameResized(float width, float height)    /* [previous][next][first][last][top][bottom][index][help] */
 589 {
 590         Invalidate();
 591         BView::FrameResized(width,height);
 592 }
 593 void                                    
 594 BF_GUI_Panel::NavPressInHeader(const BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
 595 {
 596         BMessage oMessage(bWinPos_OnLeft?BF_MSG_MAINVIEW_SELVOL_LEFT:BF_MSG_MAINVIEW_SELVOL_RIGHT);
 597         BMessenger oMessenger(poWinView);
 598         oMessenger.SendMessage(&oMessage);
 599 }
 600 
 601 void
 602 BF_GUI_Panel::Enable(bool b_Enable)    /* [previous][next][first][last][top][bottom][index][help] */
 603 {
 604         if(b_Enable && iDisableCount==1){
 605                 bFixedFocus = false;
 606                 SetFlags(B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE);               
 607         }else
 608         if(!b_Enable && iDisableCount==0){
 609                 //if(IsFocus()) bFixedFocus = true;             
 610                 SetFlags(B_WILL_DRAW|B_FRAME_EVENTS);                   
 611         }
 612         
 613         iDisableCount += !b_Enable?+1:-1;
 614         ASSERT(iDisableCount>=0);
 615         
 616         if(iDisableCount==0 && b_Enable) OnEnable(true);
 617         if(iDisableCount==1 && !b_Enable) OnEnable(false);      
 618 }
 619 
 620 bool                                    
 621 BF_GUI_Panel::Enabled()    /* [previous][next][first][last][top][bottom][index][help] */
 622 {
 623         return iDisableCount==0 ;
 624 }
 625 
 626 void
 627 BF_GUI_Panel::OnEnable(bool b_Enable)    /* [previous][next][first][last][top][bottom][index][help] */
 628 {
 629         if(b_Enable && bNeedUpdateAfterEnable){
 630                 Draw(Bounds());
 631                 bNeedUpdateAfterEnable = false;
 632         }
 633 }
 634 
 635 void
 636 BF_GUI_Panel::MakeFocus(bool focused)    /* [previous][next][first][last][top][bottom][index][help] */
 637 {
 638         BView::MakeFocus(focused);
 639         OnFocus(focused);
 640 }
 641 void
 642 BF_GUI_Panel::OnFocus(bool b_Focused)    /* [previous][next][first][last][top][bottom][index][help] */
 643 {
 644         /* prepare keys_menu */
 645         if(b_Focused){
 646                 if(poSysKeysMenu)       PrepareKeysMenu();
 647                 if(poCmdLine)           PrepareCmdLine();
 648         }else{
 649                 if(poSysKeysMenu)       poSysKeysMenu->Clear();
 650          }              
 651         
 652         /* redraw path */
 653         DrawHeader(bFixedFocus || b_Focused);
 654 }
 655 
 656 bool                                    
 657 BF_GUI_Panel::OnClose(){    /* [previous][next][first][last][top][bottom][index][help] */
 658         return true;
 659 }
 660 
 661 void
 662 BF_GUI_Panel::SayFriend_About_CursorChanged(    /* [previous][next][first][last][top][bottom][index][help] */
 663         const char *pc_NodePath,
 664         const char *pc_NodeName,
 665         int i_NodeType)
 666 {
 667 
 668         BF_GUI_Panel *po = poWinView->PanelOnTop(!bWinPos_OnLeft);
 669         if(!po) return;
 670         
 671         BMessenger oMessenger(po);
 672         BMessage   oMessage(BF_MSG_TO_PANEL_FRIEND_NEWCURSOR);
 673         if(pc_NodePath) oMessage.AddString("bf_pcNodePath",pc_NodePath);
 674         if(pc_NodeName) oMessage.AddString("bf_pcNodeName",pc_NodeName);
 675         oMessage.AddInt32("bf_iNodeType",i_NodeType);
 676         oMessenger.SendMessage(&oMessage);
 677 }
 678 
 679 void
 680 BF_GUI_Panel::Nodes_GetAll(BF_NodeList& lo_ResultNode,bool b_ReqIcons)    /* [previous][next][first][last][top][bottom][index][help] */
 681 {
 682         lo_ResultNode.DeleteItems();    
 683 }
 684 
 685 void
 686 BF_GUI_Panel::Nodes_SetSelectingByName( BF_NodeList* plo_ReqNode,uint i_SelAction,bool b_ReqUpdate)    /* [previous][next][first][last][top][bottom][index][help] */
 687 {
 688 }
 689 
 690 void                                    
 691 BF_GUI_Panel::StoreVars(BF_GUI_Setup_Vars_Panel & o_Setup) const    /* [previous][next][first][last][top][bottom][index][help] */
 692 {       
 693 }
 694 /////////////////////////////////////////////////
 695 void
 696 BF_GUI_Func_PanelsEnable(bool b_Enable,bool b_OperRosterAlso)    /* [previous][next][first][last][top][bottom][index][help] */
 697 {
 698         BMessenger      oMessenger(poWinView);
 699         BMessage        oMessage(BF_MSG_ENABLEPANELS);
 700         oMessage.AddBool("bf_bEnable",b_Enable);
 701         oMessage.AddBool("bf_bOperRoster",b_OperRosterAlso);
 702         oMessenger.SendMessage(&oMessage);
 703 }
 704 
 705 void
 706 BF_GUI_Func_PanelsShow(bool b_Show)    /* [previous][next][first][last][top][bottom][index][help] */
 707 {
 708         BMessenger      oMessenger(poWinView);
 709         BMessage        oMessage(BF_MSG_SHOWPANELS);
 710         oMessage.AddBool("bf_bShow",b_Show);
 711         oMessenger.SendMessage(&oMessage);
 712 }
 713 
 714 void
 715 BF_GUI_Func_RedrawDialogs()    /* [previous][next][first][last][top][bottom][index][help] */
 716 {               
 717         BMessage        oMessage(BF_MSG_REDRAWDIALOGS);
 718         
 719         if(poWinView->CountChildren()<5) return;
 720         
 721         for(int i=0;i<poWinView->CountChildren();i++){
 722                 BMessenger      oMessenger(poWinView->ChildAt(i));
 723                 oMessenger.SendMessage(&oMessage);
 724         }               
 725 }
 726 
 727 /*=========================================================*/
 728 bool
 729 BF_GUI_Func_EnableDialog(const char *pc_Name,bool b_Enable)    /* [previous][next][first][last][top][bottom][index][help] */
 730 {
 731         ASSERT(pc_Name);
 732         BView *poView = poWin->FindView(pc_Name);
 733         if(!poView) return false;
 734           
 735         BMessage        oMessage(BF_MSG_DIALOG_ENABLE);
 736         BMessenger      oMessenger(poView);
 737         oMessage.AddBool("bf_bEnable",b_Enable);
 738         oMessenger.SendMessage(&oMessage);
 739         
 740         return true;
 741 }
 742 /*=========================================================*/
 743 void
 744 BF_GUI_Func_CloseDialog(BView *po_Dialog)    /* [previous][next][first][last][top][bottom][index][help] */
 745 {
 746         BMessage        oMessage(BF_MSG_DIALOG_CLOSE_NOW);
 747         BMessenger      oMessenger(po_Dialog);
 748         oMessenger.SendMessage(&oMessage);              
 749 }
 750 /*=========================================================*/
 751 bool
 752 BF_GUI_Func_AddChildToMainView(BView *po_View)    /* [previous][next][first][last][top][bottom][index][help] */
 753 {       
 754         ASSERT(po_View);
 755         LOCK_WIN();     
 756         
 757         poWinView->AddChild(po_View);   
 758         return true;
 759 }
 760 ////////////////////////////////////////////////////////
 761 void
 762 BF_GUI_MakeFocusTo(BView *po_View)    /* [previous][next][first][last][top][bottom][index][help] */
 763 {
 764         ASSERT(po_View);
 765         BMessage        oMessage(BF_MSG_MAKEFOCUS);
 766         BMessenger      oMessenger(po_View);
 767         oMessenger.SendMessage(&oMessage);
 768 }

/* [previous][next][first][last][top][bottom][index][help] */