root/BF_GUI_NodePanel.cpp

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

DEFINITIONS

This source file includes following definitions.
  1. FrameResized
  2. ClientRect
  3. Calc
  4. OnEnable
  5. DrawStringRight
  6. DrawStringCenter
  7. DrawPanel
  8. DrawLines
  9. DrawListInfo
  10. DrawNodeInfo
  11. DrawSelListInfo
  12. DrawColTitles
  13. DrawNodes
  14. DrawNodeAt
  15. DrawNode
  16. DrawNodeSelf
  17. DrawNode_SetNodeColor
  18. DrawNode_CursorBack
  19. MouseMoved
  20. OnMouseUp
  21. OnMouseDown
  22. PrepareTopMenuItem
  23. PrepareKeysMenu
  24. PrepareHotKeys
  25. OnBeforeKeyDown
  26. OnKeyDown
  27. Action_Alert
  28. NavChangeCursor
  29. OnFocus
  30. RefreshNodeList
  31. Action_SwitchShowIcons
  32. MessageReceived
  33. Nodes_Focus
  34. Nodes_GetSelecting
  35. Nodes_SetSelectingByName
  36. Nodes_GetAll
  37. Nodes_Add
  38. Nodes_Remove
  39. Nodes_Update
  40. ModeShowSIcon
  41. SetModeShowSIcon
  42. ChangeSortType
  43. NavUp
  44. NavDown
  45. NavRight
  46. NavLeft
  47. NavPgDown
  48. NavPgUp
  49. NavSelect
  50. NavToStart
  51. NavToEnd
  52. NavEnter
  53. NavGoParentDir
  54. BF_GUI_NodePanel_PulseThread
  55. PulseAction_Add
  56. Pulse
  57. PulseAction_Remove
  58. NavSelectAll_0
  59. NavDeselectAll
  60. NavSelectAll_1
  61. PanelSetup_0
  62. PanelSetup_1
  63. ActionMakeDir_Start
  64. ActionMakeDir_Run
  65. ActionCopyFrom_Run
  66. ActionCopyTo_Start
  67. ActionCopyTo_Run
  68. ActionMoveTo_Start
  69. ActionMoveTo_Run
  70. ActionDelete_Start
  71. ActionDelete_Run
  72. ActionRename_Start
  73. ActionRename_Run
  74. StoreVars

   1 #include <stdio.h>
   2 #include <stdlib.h>
   3 #include <string.h>
   4 #include <Clipboard.h>
   5 #include <Locker.h>
   6 //#include <time.h>
   7 #include <NodeMonitor.h>
   8 //#include <InputServerDevice.h>
   9 
  10 #include "BF_Dict.h"
  11 #include "BF_Roster.h"
  12 #include "BF_Msg.h"
  13 #include "BF_GUI_NodePanel.h"
  14 #include "BF_GUI_NodePanel_Tools.h"
  15 #include "BF_GUI_DlgViews.h"
  16 #include "BF_GUI_KeysMenu.h"
  17 #include "BF_GUI_CmdLine.h"
  18 #include "BF_GUI_WinMain.h"
  19 
  20 #define INFO_SIZE       30 
  21 
  22 BF_GUI_NodePanel::BF_GUI_NodePanel(
  23         const BRect & o_Rect,
  24         bool b_WinPos_OnLeft)
  25 :BF_GUI_Panel(o_Rect,"file",b_WinPos_OnLeft) 
  26 {
  27         iPulseActions = BF_NODEPANEL_PULSE_NONE;
  28         /**/
  29         fFullName = 0;
  30         fFullSize = 0;
  31         fFullDate = 0;
  32         iNodesOnScreen = 0;
  33         iMode = BF_NODEPANEL_MODE_FULL;
  34         iModeFullStyles = BF_NODEPANEL_FULL_SIZE 
  35                 | BF_NODEPANEL_FULL_SICON 
  36                 | BF_NODEPANEL_FULL_NAME 
  37                 | BF_NODEPANEL_FULL_DATE
  38                 //| BF_NODEPANEL_FULL_TYPE
  39                 ;
  40                 
  41         fNodeInfoHeight = 0;
  42         fNodeInfoHeight = 0;
  43         idThreadPulse = 0;
  44         /**/
  45         //if(BF_PANEL_WINPOS_LEFT!=i_WinPosition){
  46         {
  47                 iMode = BF_NODEPANEL_MODE_COLS; 
  48                 iModeColsStyles = BF_NODEPANEL_COLS_NAME;
  49                 iModeColsStyles = iModeColsStyles | BF_NODEPANEL_COLS_SICON;
  50                 iColsColCount = 3;
  51         }
  52         /**/
  53         iSortType = BF_NODELIST_SORT_NAME;//BF_NODELIST_SORT_EXT;
  54         iNavFirstIndex = 0;
  55         iNavCursorIndex = 0;
  56         sNodeSelMask = "*.*";
  57         bSelectDirAlso = false;
  58         bCanSelect = true;
  59         /**/
  60         {
  61                 BF_Node *poNode = new BF_Node(" none ");
  62                 poNode->iType = BF_NODE_TYPE_UNKNOWN;
  63                 loNode.AddItem(poNode);
  64         }
  65         //
  66         sDictDir = BF_DictAt(BF_DICT_PANEL_DIR);
  67 }
  68 
  69 BF_GUI_NodePanel::~BF_GUI_NodePanel()
  70 {
  71         if(idThreadPulse) while(B_OK!=kill_thread(idThreadPulse));
  72 }
  73 
  74 
  75 void                                    
  76 BF_GUI_NodePanel::FrameResized(float width, float height)    /* [previous][next][first][last][top][bottom][index][help] */
  77 {
  78         Calc();
  79         BF_GUI_Panel::FrameResized(width,height);
  80 }
  81 
  82 
  83 BRect
  84 BF_GUI_NodePanel::ClientRect()    /* [previous][next][first][last][top][bottom][index][help] */
  85 {
  86         BRect oRect(Bounds());
  87         oRect.left = 6;
  88         oRect.right -= 6;       
  89         oRect.top = HeaderHeight() + fColTitleHeight;
  90         oRect.bottom = oRect.top + fNodesHeight;
  91         
  92         return oRect;
  93 }
  94 
  95 void                                    
  96 BF_GUI_NodePanel::Calc()    /* [previous][next][first][last][top][bottom][index][help] */
  97 {
  98         SetFont(&poSysSetup->oFontNode.oFont,B_FONT_ALL);
  99         //
 100         fNodeHeight = (float)(int) ( poSysSetup->oFontNode.fHeight );   
 101         if(     ModeShowSIcon() && fNodeHeight<17) fNodeHeight = 18; 
 102         fNodeInfoHeight = poSysSetup->oFontNode.fHeight;
 103         fSelInfoHeight = poSysSetup->oFontNode.fHeight;
 104         fColTitleHeight = poSysSetup->oFontNode.fHeight+4;
 105         //
 106         BRect oRect(Bounds());
 107         /* reserve place for path title */
 108         oRect.top += HeaderHeight();            
 109         oRect.top += fColTitleHeight;
 110         /* reserve place for bottom line,info line,selected line */
 111         oRect.bottom -= BottomHeight();
 112         oRect.bottom -= fNodeInfoHeight;
 113         oRect.bottom -= fSelInfoHeight;
 114         fWidth = oRect.Width();
 115         /* reserve place for vertical lines */
 116         fWidth -= 6;
 117         /* calc total count of items */
 118         iNodesOnScreen = (int)( oRect.Height()/fNodeHeight );
 119         fNodesHeight = iNodesOnScreen * fNodeHeight;
 120         /* calc */
 121         switch(iMode){
 122         case BF_NODEPANEL_MODE_FULL:{
 123                 fFullDate = 0;
 124                 fFullSize = 0;
 125                 fFullType = 0;  
 126                 fFullSIcon = 0; 
 127                 if(iModeFullStyles & BF_NODEPANEL_FULL_SICON) fFullSIcon=20;
 128                 if(iModeFullStyles & BF_NODEPANEL_FULL_DATE)
 129                         fFullDate= (float) (int ) ( poSysSetup->oFontNode.oFont.StringWidth("99-99-9999 99:99")+5 );
 130                 if(iModeFullStyles & BF_NODEPANEL_FULL_SIZE)
 131                         fFullSize=(float) (int ) ( poSysSetup->oFontNode.oFont.StringWidth("99999999999")+5 );
 132                 fFullName = (float) (int ) ( fWidth -  fFullDate - fFullSize- fFullSIcon );
 133                 if(iModeFullStyles & BF_NODEPANEL_FULL_TYPE){
 134                         fFullType=(float) (int ) fFullName / 3;
 135                         fFullName -= fFullType;
 136                 }
 137                 break;}
 138         case BF_NODEPANEL_MODE_COLS:{   
 139                 fColsSIcon = 0;
 140                 fColsColWidth = (float)(int) ( fWidth/iColsColCount );
 141                 if(iModeColsStyles & BF_NODEPANEL_COLS_SICON)   fColsSIcon=20;
 142                 fColsName = (float)(int) (fColsColWidth - fColsSIcon-6);
 143                 
 144                 iColsNodesInCol = iNodesOnScreen;
 145                 iNodesOnScreen = iColsNodesInCol*iColsColCount;
 146                 
 147                 break;}
 148         }               
 149 }
 150 
 151 void                                    
 152 BF_GUI_NodePanel::OnEnable(bool b_Enable)    /* [previous][next][first][last][top][bottom][index][help] */
 153 {
 154         if(b_Enable){
 155                 if(bNeedUpdateAfterEnable){
 156                         if(!(poSysSetup->MainStyle() & BF_SETUP_DEB_NOSORTING)){
 157                                 loNode.Sort(iSortType);
 158                         }
 159                 }
 160         }else{
 161                 PulseAction_Remove(BF_NODEPANEL_PULSE_ALL);
 162         }
 163         BF_GUI_Panel::OnEnable(b_Enable);
 164 }
 165 
 166 void
 167 BF_GUI_NodePanel::DrawStringRight(const char *pc_Text,BPoint &o_Point,float f_Width)    /* [previous][next][first][last][top][bottom][index][help] */
 168 {
 169         float f = poSysSetup->oFontNode.oFont.StringWidth(pc_Text);
 170         poRender->MovePenTo(o_Point.x+f_Width-f,o_Point.y);
 171         poRender->DrawString(pc_Text);
 172 }
 173 
 174 void
 175 BF_GUI_NodePanel::DrawStringCenter(const char *pc_Text,BPoint &o_Point,float f_Width)    /* [previous][next][first][last][top][bottom][index][help] */
 176 {
 177         float f = poSysSetup->oFontNode.oFont.StringWidth(pc_Text);
 178         poRender->MovePenTo(o_Point.x+f_Width/2-f/2,o_Point.y);
 179         poRender->DrawString(pc_Text);
 180 }
 181 
 182 
 183 void                                    
 184 BF_GUI_NodePanel::DrawPanel(BRect & o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 185 {
 186         BF_GUI_Panel::DrawPanel(o_Rect);
 187         // draw bottom_info     
 188         DrawListInfo(false);
 189         // draw selected bottom_info
 190         DrawSelListInfo(false); 
 191         // draw verticals lines 
 192         DrawLines(false);       
 193         // draw headers 
 194         DrawColTitles();
 195         // draw fileinfo
 196         DrawNodeInfo();
 197         // draw items 
 198         DrawNodes();
 199 }
 200 
 201 void 
 202 BF_GUI_NodePanel::DrawLines(bool b_OnlyNodes)    /* [previous][next][first][last][top][bottom][index][help] */
 203 {
 204         //
 205         switch(iMode){
 206         case BF_NODEPANEL_MODE_COLS:{   
 207                 if(poSysSetup->FPanelColsStyle() & BF_SETUP_FPANELMODE_COLS_DRAWLINES){
 208                         BRect oRect = poRender->Bounds();
 209                         oRect.top=HeaderHeight();                       
 210                         oRect.bottom -= BottomHeight();
 211                         oRect.bottom -= fNodeInfoHeight;
 212                         oRect.bottom -= fSelInfoHeight;
 213                         oRect.left+=4;
 214                         oRect.left--;
 215                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));      
 216                         for(uint32 i=0;i<iColsColCount-1;i++){
 217                                 oRect.left+=fColsColWidth;
 218                                 oRect.right = oRect.left;                               
 219                                 poRender->StrokeRect(oRect);
 220                         }
 221                 }
 222                 break;}
 223         case BF_NODEPANEL_MODE_FULL:{
 224                 if(poSysSetup->FPanelFullStyle() & BF_SETUP_FPANELMODE_FULL_DRAWLINES){
 225                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));      
 226                         BRect oRect = poRender->Bounds();
 227                         oRect.top=HeaderHeight();                       
 228                         oRect.bottom -= BottomHeight();
 229                         oRect.bottom -= fNodeInfoHeight;
 230                         oRect.bottom -= fSelInfoHeight;
 231                         oRect.left+=4;
 232                         //
 233                         if(iModeFullStyles & BF_NODEPANEL_FULL_SICON)   oRect.left+=fFullSIcon;
 234                         oRect.left+=fFullName;
 235                         /* line |type */                                
 236                         if(iModeFullStyles & BF_NODEPANEL_FULL_TYPE){                                           
 237                                 oRect.right = oRect.left;
 238                                 poRender->StrokeRect(oRect);
 239                                 oRect.left+=fFullType;
 240                         }                       
 241                         /* line |size */                                
 242                         if(iModeFullStyles & BF_NODEPANEL_FULL_SIZE){
 243                                 oRect.right = oRect.left;
 244                                 poRender->StrokeRect(oRect);
 245                                 oRect.left+=fFullSize;
 246                         }                                               
 247                         /* line |date */
 248                         if(iModeFullStyles & BF_NODEPANEL_FULL_DATE){                                           
 249                                 oRect.right = oRect.left;
 250                                 poRender->StrokeRect(oRect);            
 251                                 oRect.left+=fFullDate;
 252                         }
 253                 }
 254                 break;}
 255         };
 256 }
 257 
 258 void 
 259 BF_GUI_NodePanel::DrawListInfo(bool b_DrawBack)    /* [previous][next][first][last][top][bottom][index][help] */
 260 {
 261         /* make info */
 262         BL_String s;
 263         s<<loNode.SizeAll(false);       
 264         s.SetDigits();
 265         s<<BF_DictAt(BF_DICT_PANEL_BYTESIN);
 266         s<<loNode.CountRealNodes();
 267         s<<BF_DictAt(BF_DICT_PANEL_FILES);
 268         DrawBottom(s.String(), b_DrawBack);
 269 }
 270 
 271 void
 272 BF_GUI_NodePanel::DrawNodeInfo()    /* [previous][next][first][last][top][bottom][index][help] */
 273 {
 274         BRect oRect;
 275         /* erase background  */
 276         oRect = poRender->Bounds();
 277         oRect.left+=6;
 278         oRect.right-=6;
 279         oRect.bottom -= BottomHeight();
 280         oRect.top = oRect.bottom - fNodeInfoHeight-1;
 281         poRender->SetHighColor(SYS_COLOR(BF_COLOR_BACK));
 282         poRender->FillRect(oRect);              
 283         
 284         BF_Node         *poNode = loNode.NodeAt(iNavCursorIndex);               
 285                 
 286         /* draw icon */
 287         if(poNode && poNode->poSIcon){
 288                 BPoint oPoint(6,oRect.top);
 289                 poRender->SetDrawingMode(B_OP_ALPHA);                           
 290                 poRender->DrawBitmap(poNode->poSIcon,oPoint);
 291                 poRender->SetDrawingMode(B_OP_COPY);
 292         }
 293         /* draw text */ 
 294         BPoint          o;      
 295         BL_String       s;      
 296         
 297         o.Set(6+25/*25 for icon */,oRect.bottom-poSysSetup->oFontNode.fDescent);
 298         poRender->SetHighColor(SYS_COLOR(BF_COLOR_PANEL_INFO_TEXT));    
 299         poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
 300         
 301         /* draw size */ 
 302         if(poNode){
 303                 switch(poNode->iType){
 304                 case BF_NODE_TYPE_PARENTDIR:
 305                         poRender->DrawString("..",o);   
 306                         break;
 307                 case BF_NODE_TYPE_DIR:
 308                         //s=poNode->sName;
 309                         //CheckStringWidth(s,oRect.Width()-12,NULL);
 310                         DrawStringCheck(poNode->sName.String(),oRect.Width()-12,o);     
 311                         break;
 312                 case BF_NODE_TYPE_FILE:
 313                         poRender->DrawString("Size : ",o);
 314                         s = poNode->iSize;
 315                         s.SetDigits();
 316                         DrawStringRight(s.String(),o,oRect.Width()-12-25/*25 for icon */);
 317                         break;
 318                 }
 319         }
 320                 
 321 }
 322 
 323 void
 324 BF_GUI_NodePanel::DrawSelListInfo(bool b_DrawBack)    /* [previous][next][first][last][top][bottom][index][help] */
 325 {
 326         BRect oRect(poRender->Bounds());
 327         
 328         oRect.left+=4;
 329         oRect.right-=4;         
 330         oRect.bottom -= BottomHeight() + fNodeInfoHeight;
 331         oRect.top = oRect.bottom - fSelInfoHeight;      
 332         /* erase background  */
 333         if(b_DrawBack){                                         
 334                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_BACK));
 335                 poRender->FillRect(oRect);
 336         }
 337         /* make info */
 338         //oRect = poRender->Bounds();
 339         BL_String       s;
 340         uint64          iBytes,iCount;          
 341         float           fTop = oRect.top + fSelInfoHeight/2;
 342         BPoint          o1,o2;
 343         /* get info */
 344         /* draw */
 345         loNode.SelectedInfo(iBytes,iCount);
 346         if(iCount){
 347                 s<<iBytes;      
 348                 s.SetDigits();
 349                 s<<BF_DictAt(BF_DICT_PANEL_BYTESIN);
 350                 s<<iCount;
 351                 s<<BF_DictAt(BF_DICT_PANEL_FILES);
 352             float fWidth = poSysSetup->oFontNode.oFont.StringWidth(s.String());         
 353                 float fLeft = (oRect.Width() - fWidth)/2;
 354                 /* draw lines */                
 355                 /* left line */
 356                 o1.Set(4,fTop);
 357                 o2.Set(fLeft-3,o1.y);
 358                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 359                 poRender->StrokeLine(o1,o2);    
 360                 /* right line */
 361                 o1.Set(fLeft+fWidth+3,fTop);
 362                 o2.Set(oRect.right-3,o1.y);     
 363                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 364                 poRender->StrokeLine(o1,o2);    
 365                 /* draw info */
 366                 o1.Set(fLeft,oRect.top + poSysSetup->oFontNode.fAscent);
 367                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE_FOCUSSELECT));
 368                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
 369                 poRender->DrawString(s.String(),o1);
 370         }else{          
 371                 /* full lines */
 372                 o1.Set(4,fTop);
 373                 o2.Set(oRect.right-3,o1.y);
 374                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_FRAME));
 375                 poRender->StrokeLine(o1,o2);    
 376         }
 377 }
 378 
 379 void 
 380 BF_GUI_NodePanel::DrawColTitles()    /* [previous][next][first][last][top][bottom][index][help] */
 381 {       
 382         switch(iMode){
 383         case BF_NODEPANEL_MODE_COLS:{   
 384                 BPoint          oPoint(7,HeaderHeight());
 385                 oPoint.y += poSysSetup->oFontNode.fAscent;
 386                 /* print headers */
 387                 /* set colors */
 388                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_HEADER_TEXT));        
 389                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));                        
 390                 oPoint.x = 5 ;//+ fColsColWidth/2;
 391                 //if(iModeColsStyles & BF_NODEPANEL_COLS_SICON)         oPoint.x+=fColsSIcon;
 392                 for(uint i=0;i<iColsColCount;i++){
 393                         /* header 'SmallIcon' */                        
 394                         /* header 'Name' */
 395                         DrawStringCenter(BF_DictAt(BF_DICT_PANEL_COL_NAME),oPoint,fColsColWidth);                       
 396                         oPoint.x+=fColsColWidth;
 397                 }
 398                 break;}
 399         case BF_NODEPANEL_MODE_FULL:{
 400                 BPoint          oPoint(4,HeaderHeight());               
 401                 /* start  */            
 402                 oPoint.y += poSysSetup->oFontNode.fAscent;
 403                 /*---------------*/             
 404                 /* print headers */
 405                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_HEADER_TEXT));        
 406                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));        
 407                 oPoint.x = 4;
 408                 /* header 'SmallIcon' */
 409                 if(iModeFullStyles & BF_NODEPANEL_FULL_SICON){  
 410                         //DrawStringCenter("Icon",oPoint,fFullSIcon);                   
 411                         oPoint.x+=fFullSIcon;
 412                 }
 413                 /* header 'Name' */
 414                 DrawStringCenter(BF_DictAt(BF_DICT_PANEL_COL_NAME),oPoint,fFullName);                   
 415                 oPoint.x+=fFullName;
 416                 /* header 'type' */
 417                 if(iModeFullStyles & BF_NODEPANEL_FULL_TYPE){   
 418                         DrawStringCenter(BF_DictAt(BF_DICT_PANEL_COL_TYPE),oPoint,fFullType);                   
 419                         oPoint.x+=fFullType;                    
 420                 }               
 421                 /* header 'Size' */
 422                 if(iModeFullStyles & BF_NODEPANEL_FULL_SIZE){   
 423                         DrawStringCenter(BF_DictAt(BF_DICT_PANEL_COL_SIZE),oPoint,fFullSize);                   
 424                         oPoint.x+=fFullSize;                    
 425                 }       
 426                 /* header 'Date' */
 427                 if(iModeFullStyles & BF_NODEPANEL_FULL_DATE){
 428                         DrawStringCenter(BF_DictAt(BF_DICT_PANEL_COL_DATE),oPoint,fFullDate);
 429                         oPoint.x+=fFullDate;
 430                 }
 431                 /**/    
 432                 break;}
 433         }
 434 }
 435 
 436 void 
 437 BF_GUI_NodePanel::DrawNodes(bool b_DrawBackground)    /* [previous][next][first][last][top][bottom][index][help] */
 438 {
 439         BRect oRect(ClientRect());
 440         
 441         // open transaction 
 442         Draw_OpenTransaction();         
 443         
 444         // check background
 445         if(RenderDeep()==1)     b_DrawBackground = true;
 446                 
 447         if(b_DrawBackground)
 448         {       
 449                 DrawBackground(oRect);                                  
 450                 DrawLines( true );
 451         }       
 452         /* draw  nodes */
 453         if(true)
 454         {
 455                 BPoint          oPoint(7,HeaderHeight());       
 456                 BRect           oRect;
 457                 bool            bShowFocus = IsFocus() || bFixedFocus;                  
 458                 char            pc[500];
 459                 int32           iRealIndex=0;
 460                 int                     iLastNode=0;
 461                 
 462                 
 463                 iLastNode = iNavFirstIndex + iNodesOnScreen;
 464                                 
 465                 if(iLastNode>loNode.CountItems()) iLastNode = loNode.CountItems();              
 466                 /* scan nodes */                        
 467                 for(iRealIndex=iNavFirstIndex;iRealIndex<iLastNode;iRealIndex++)
 468                 {               
 469                         DrawNode(iRealIndex,bShowFocus && (iRealIndex==iNavCursorIndex),oPoint,oRect,pc,NULL,false);
 470                 }
 471                 iRealIndex  = iRealIndex;
 472         }       
 473         if(b_DrawBackground){
 474         }
 475         // close trans 
 476         Draw_CloseTransaction(&oRect); 
 477 }
 478 
 479 void
 480 BF_GUI_NodePanel::DrawNodeAt(int32 i_Index)    /* [previous][next][first][last][top][bottom][index][help] */
 481 {
 482         if(i_Index<0) return;
 483         ///
 484         BRect   oRect,oRect2;
 485         BPoint  oPoint;
 486         char    pc[500];
 487         bool    bFocused=i_Index==iNavCursorIndex && (IsFocus() || bFixedFocus);
 488         
 489         DrawNode(i_Index,bFocused,oPoint,oRect,pc,&oRect2,true);
 490 }
 491 
 492 void 
 493 BF_GUI_NodePanel::DrawNode(    /* [previous][next][first][last][top][bottom][index][help] */
 494         int32 i_NodeIndex,
 495         bool b_ItCursor,
 496         BPoint &oPoint,
 497         BRect & oRect,
 498         char *pc_Buffer,
 499         BRect *po_RectBound,
 500         bool b_DrawBackground,
 501         bool b_UsePoint)
 502 {       
 503         /* draw in full_mode */
 504         switch(iMode){
 505         case BF_NODEPANEL_MODE_COLS:{
 506                 BF_Node *poNode = (BF_Node*)loNode.NodeAt(i_NodeIndex);
 507                 if(!poNode) return;
 508                 
 509                 uint32 iColIndex = (i_NodeIndex - iNavFirstIndex)/iColsNodesInCol;
 510                 i_NodeIndex -= iColIndex*iColsNodesInCol;
 511                                 
 512                 if(!b_UsePoint){
 513                         oPoint.x = 4;
 514                         oPoint.x += iColIndex * fColsColWidth;
 515                         oPoint.y = HeaderHeight() + fColTitleHeight + poSysSetup->oFontNode.fAscent;
 516                         oPoint.y += fNodeHeight * (i_NodeIndex - iNavFirstIndex);               
 517                 }
 518                 
 519                 if(po_RectBound){
 520                         po_RectBound->left = oPoint.x;
 521                         po_RectBound->right  = po_RectBound->left + fColsColWidth-12;
 522                         po_RectBound->top = oPoint.y - poSysSetup->oFontNode.fAscent;
 523                         po_RectBound->bottom = po_RectBound->top + fNodeHeight;
 524                 }               
 525                 /* set color */ 
 526                 DrawNode_SetNodeColor(poNode,false);            
 527                 /* draw node */                                 
 528                 {               
 529                         oPoint.x+=2;
 530                         if(b_ItCursor)                  DrawNode_CursorBack(poNode,oRect,oPoint,fColsColWidth-6,true);else 
 531                         if(b_DrawBackground)    DrawNode_CursorBack(poNode,oRect,oPoint,fColsColWidth-6,false);
 532                         oPoint.x+=2;
 533                         /* print small_icon */
 534                         if(iModeColsStyles & BF_NODEPANEL_COLS_SICON){                                                  
 535                                 if(poNode->poSIcon){
 536                                         poRender->SetDrawingMode(B_OP_ALPHA);           
 537                                         oPoint.y-=poSysSetup->oFontNode.fAscent;
 538                                         poRender->DrawBitmap(poNode->poSIcon,oPoint);
 539                                         oPoint.y+=poSysSetup->oFontNode.fAscent;
 540                                         poRender->SetDrawingMode(B_OP_COPY);
 541                                 }
 542                                 oPoint.x+=fColsSIcon;
 543                         }
 544                         /* print node_name */
 545                         DrawStringCheck(poNode->sName.String(),fColsName-3,oPoint);
 546                         
 547                         /* for link print dot */
 548                         if(false && poNode->bLink){
 549                                 BPoint o1(oPoint);
 550                                 o1.y += poSysSetup->oFontNode.fDescent-1;
 551                                 float fx1 = oPoint.x + poSysSetup->oFontNode.oFont.StringWidth(poNode->sName.String());
 552                                 for(float fx = oPoint.x;fx<fx1;fx+=2.0){                        
 553                                         StrokeLine(o1,o1);
 554                                         o1.x+=2.0;
 555                                 }
 556                         }
 557 
 558                         oPoint.x+=fColsColWidth;
 559                 }               
 560                 break;}
 561         case BF_NODEPANEL_MODE_FULL:{
 562                 oPoint.x = 4;
 563                 oPoint.y = HeaderHeight() + fColTitleHeight + poSysSetup->oFontNode.fAscent;
 564                 oPoint.y += fNodeHeight * (i_NodeIndex - iNavFirstIndex);
 565                 if(po_RectBound){
 566                         po_RectBound->left = oPoint.x;
 567                         po_RectBound->right  = po_RectBound->left + fWidth-12;
 568                         po_RectBound->top = oPoint.y - poSysSetup->oFontNode.fAscent;
 569                         po_RectBound->bottom = po_RectBound->top + fNodeHeight;
 570                 }
 571                 BF_Node *poNode = (BF_Node*)loNode.NodeAt(i_NodeIndex);
 572                 if(!poNode) return;
 573                 /* set color */ 
 574                 DrawNode_SetNodeColor(poNode,false);
 575                 /* draw node */                                 
 576                 {               
 577                         oPoint.x+=2;
 578                         /* print small_icon */                                          
 579                         if(b_ItCursor)                  DrawNode_CursorBack(poNode,oRect,oPoint,fFullSIcon + fFullName-5,true);else 
 580                         if(b_DrawBackground)    DrawNode_CursorBack(poNode,oRect,oPoint,fFullSIcon + fFullName-5,false);                        
 581                         oPoint.x+=2;
 582 
 583                         /* for link print dot */
 584                         if(poNode->bLink){
 585                                 oPoint.x-=1;
 586                                 poRender->DrawString(".",oPoint);
 587                                 oPoint.x+=1;
 588                         }                                               
 589 
 590                 
 591                         if(iModeFullStyles & BF_NODEPANEL_FULL_SICON){                          
 592                                 if(poNode->poSIcon){
 593                                         poRender->SetDrawingMode(B_OP_ALPHA);           
 594                                         oPoint.y-=poSysSetup->oFontNode.fAscent;
 595                                         poRender->DrawBitmap(poNode->poSIcon,oPoint);
 596                                         oPoint.y+=poSysSetup->oFontNode.fAscent;
 597                                         poRender->SetDrawingMode(B_OP_COPY);
 598                                 }
 599                                 oPoint.x+=fFullSIcon;
 600                         }
 601                         /* print node_name */
 602                         DrawStringCheck(poNode->sName.String(),fFullName-8,oPoint);
 603 
 604                         oPoint.x+=fFullName-4;
 605                         /* print node_type */
 606                         if(iModeFullStyles & BF_NODEPANEL_FULL_TYPE){
 607                                 oPoint.x+=2;
 608                                 
 609                                 if(b_ItCursor)                  DrawNode_CursorBack(poNode,oRect,oPoint,fFullType-5,true);else
 610                                 if(b_DrawBackground)    DrawNode_CursorBack(poNode,oRect,oPoint,fFullType-5,false);
 611                                 
 612                                 DrawStringCheck(poNode->sType.String(),fFullType-5,oPoint);
 613                                 /*
 614                                 if(CheckStringWidth(poNode->sType,fFullType-5,pc_Buffer)){
 615                                         poRender->DrawString(poNode->sType.String(),oPoint);
 616                                 }else{
 617                                         poRender->DrawString(pc_Buffer,oPoint);
 618                                 }*/
 619                                 //DrawString(poNode->sType.String(),oPoint);
 620                                 oPoint.x+=fFullType-2;
 621                         }                               
 622                         /* print node_size */
 623                         if(iModeFullStyles & BF_NODEPANEL_FULL_SIZE){
 624                                 oPoint.x+=2;
 625                                 if(b_ItCursor)                  DrawNode_CursorBack(poNode,oRect,oPoint,fFullSize-5,true);else
 626                                 if(b_DrawBackground)    DrawNode_CursorBack(poNode,oRect,oPoint,fFullSize-5,false);
 627                                 switch(poNode->iType){
 628                                 case BF_NODE_TYPE_FILE:{
 629                                         // this is not debug print !!! //
 630                                         sprintf(pc_Buffer,"%i",(int)poNode->iSize);     
 631                                         DrawStringRight(pc_Buffer,oPoint,fFullSize-5);
 632                                         break;}
 633                                 case BF_NODE_TYPE_DIR:{
 634                                         DrawStringRight(sDictDir.String(),oPoint,fFullSize-5);
 635                                         break;}
 636                                 };
 637                                 //if(poNode->bLink) poRender->DrawString(".",oPoint);
 638                                 oPoint.x+=fFullSize-2;
 639                         }
 640                         /* print node_date */
 641                         if(iModeFullStyles & BF_NODEPANEL_FULL_DATE){
 642                                 oPoint.x+=2;
 643                                 if(b_ItCursor)                  DrawNode_CursorBack(poNode,oRect,oPoint,fFullDate-5,true);else
 644                                 if(b_DrawBackground)    DrawNode_CursorBack(poNode,oRect,oPoint,fFullDate-5,false);
 645                                 if(poNode->iType!=BF_NODE_TYPE_PARENTDIR){
 646                                         strcpy(pc_Buffer,"");
 647                                         if(poNode->iType!=BF_NODE_TYPE_PARENTDIR){
 648                                                 //printf("name %s time %i\n",poNode->sName.String(),poNode->uCreateTime);                                                                                               
 649                                                 tm* puTime = localtime(&poNode->uCreateTime);
 650                                                 char pc1[10];
 651                                                 ASSERT(puTime);                                                                                         
 652                                                 strcpy(pc_Buffer,"");                                   
 653                                                 //
 654                                                 sprintf(pc1,"%i",puTime->tm_mday);
 655                                                 if(puTime->tm_mday<10) strcat(pc_Buffer,"0");
 656                                                 strcat(pc_Buffer,pc1);
 657                                                 strcat(pc_Buffer,".");
 658                                                 //
 659                                                 sprintf(pc1,"%i",puTime->tm_mon+1);
 660                                                 if(puTime->tm_mon<9) strcat(pc_Buffer,"0");
 661                                                 strcat(pc_Buffer,pc1);                                  
 662                                                 strcat(pc_Buffer,".");
 663                                                 //
 664                                                 sprintf(pc1,"%i",puTime->tm_year+1900);                                 
 665                                                 strcat(pc_Buffer,pc1);                                  
 666                                                 strcat(pc_Buffer," ");
 667                                                 //
 668                                                 sprintf(pc1,"%i",puTime->tm_hour);
 669                                                 if(puTime->tm_hour<10) strcat(pc_Buffer,"0");
 670                                                 strcat(pc_Buffer,pc1);
 671                                                 strcat(pc_Buffer,":");
 672                                                 //
 673                                                 sprintf(pc1,"%i",puTime->tm_min);
 674                                                 if(puTime->tm_min<10) strcat(pc_Buffer,"0");
 675                                                 strcat(pc_Buffer,pc1);                                  
 676                                                                                                                                                                                                                 
 677                                                 //sprintf(pc_Buffer,"%i",poNode->uCreateTime);
 678                                         }                       
 679                                         DrawStringRight(pc_Buffer,oPoint,fFullDate-5);
 680                                 }
 681                                 oPoint.x+=fFullDate-2;
 682                         }
 683                 }
 684                 break;};
 685         }
 686 }
 687 
 688 void                                    
 689 BF_GUI_NodePanel::DrawNodeSelf( /* wrapper for prev method  */    /* [previous][next][first][last][top][bottom][index][help] */
 690         int32 i_NodeIndex,
 691         bool b_ItCursor,                                                                                
 692         bool b_DrawBackground,
 693         bool b_OffScreen)
 694 {
 695         ASSERT(! b_OffScreen);
 696         
 697         char    pcBuffer[500];
 698         BPoint  oPoint;
 699         BRect   oRect;
 700         if(!b_OffScreen){
 701                 DrawNode(i_NodeIndex,b_ItCursor,oPoint,oRect,pcBuffer,NULL,b_DrawBackground);
 702         }else{
 703         /*
 704                 switch(iMode){
 705                 case BF_NODEPANEL_MODE_COLS:{
 706                         BRect oRectOld(0,0,fColsColWidth-1,fNodeHeight-1),oRect;
 707                         BRect oRectNew;
 708                         
 709                         oRectNew.left = 4;
 710                         oRectNew.left += ((i_NodeIndex - iNavFirstIndex)/iColsNodesInCol) * fColsColWidth;
 711                         oRectNew.right = oRectNew.left + oRectOld.Width();
 712                         oRectNew.top = HeaderHeight() + fColTitleHeight;
 713                         oRectNew.top += fNodeHeight * (i_NodeIndex - iNavFirstIndex);           
 714                         oRectNew.bottom = oRectNew.top + oRectOld.Height();
 715                         
 716                         oPoint.x = 0;
 717                         oPoint.y = poSysSetup->oFontNode.fAscent;
 718                         
 719                         
 720                         poRenderBitmap = new BBitmap(oRectOld,B_RGB16,true);            
 721                         poRenderBitmap->AddChild( poRender = new BView(oRectOld,"",B_FOLLOW_ALL,B_WILL_DRAW) );
 722                         poRenderBitmap->Lock();
 723                         poRender->SetViewColor(B_TRANSPARENT_COLOR);                                            
 724                         
 725                         oRect = oRectOld;
 726                         DrawNode(i_NodeIndex,b_ItCursor,oPoint,oRect,pcBuffer,NULL,true,true);
 727                         
 728                         poRender->Sync();
 729                         poRenderBitmap->Unlock();
 730                         
 731                         DrawBitmap(poRenderBitmap,oRectOld,oRectNew);
 732                                                                 
 733                         delete poRenderBitmap;          
 734                         
 735                         poRenderBitmap = NULL;
 736                         poRender = this;        
 737                         
 738                         break;}                 
 739                 default:
 740                         ASSERT(false);
 741                 }
 742                 */
 743         }
 744 }
 745 
 746 void 
 747 BF_GUI_NodePanel::DrawNode_SetNodeColor(BF_Node *po_Node,bool b_IsFocus)    /* [previous][next][first][last][top][bottom][index][help] */
 748 {
 749         if(b_IsFocus){
 750                 if(po_Node && po_Node->bSelect) poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE_FOCUSSELECT));
 751                 else                                                    poRender->SetHighColor(SYS_COLOR(BF_COLOR_CURSOR_TEXT));
 752                 poRender->SetLowColor(SYS_COLOR(BF_COLOR_CURSOR_BACK));
 753         }else{
 754                 if(po_Node && po_Node->bSelect){
 755                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE_SELECT));                
 756                         poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
 757                 }else{
 758                         switch(po_Node?po_Node->iType:BF_NODE_TYPE_UNKNOWN){
 759                         case BF_NODE_TYPE_FILE:
 760                                 if(po_Node->bLink)
 761                                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE_LINK));          
 762                                 else
 763                                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE));               
 764                                 break;
 765                                 break;
 766                         case BF_NODE_TYPE_DIR:
 767                                 if(po_Node->bLink)
 768                                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE_DIR_LINK));              
 769                                 else
 770                                         poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE_DIR));           
 771                                 break;
 772                         default:
 773                                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_NODE));                                       
 774                         }
 775                         poRender->SetLowColor(SYS_COLOR(BF_COLOR_BACK));
 776                 }
 777         }
 778 }
 779 
 780 void
 781 BF_GUI_NodePanel::DrawNode_CursorBack(    /* [previous][next][first][last][top][bottom][index][help] */
 782         BF_Node *po_Node
 783         ,BRect &oRect
 784         ,BPoint &oPoint
 785         ,float f_Width
 786         ,bool b_Cursor)
 787 {
 788         oRect.left=oPoint.x;
 789         oRect.right=oRect.left+f_Width;
 790         oRect.top = oPoint.y - poSysSetup->oFontNode.fAscent;
 791         oRect.bottom = oRect.top+fNodeHeight-1; 
 792         if(b_Cursor)    
 793                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_CURSOR_BACK));                
 794         else                    
 795                 poRender->SetHighColor(SYS_COLOR(BF_COLOR_BACK));
 796         poRender->FillRect(oRect);
 797         //
 798         DrawNode_SetNodeColor(po_Node,b_Cursor);
 799 }
 800 
 801 void
 802 BF_GUI_NodePanel::MouseMoved(BPoint o_Point,uint32 i_Transit,const BMessage *message)    /* [previous][next][first][last][top][bottom][index][help] */
 803 {
 804         if(B_EXITED_VIEW==i_Transit){
 805                 if(iPulseActions & BF_NODEPANEL_PULSE_MOVEDOWN){
 806                         PulseAction_Remove(BF_NODEPANEL_PULSE_MOVEDOWN);
 807                 }
 808                 if(iPulseActions & BF_NODEPANEL_PULSE_MOVEUP){
 809                         PulseAction_Remove(BF_NODEPANEL_PULSE_MOVEUP);
 810                 }
 811         }
 812 }
 813 
 814 bool
 815 BF_GUI_NodePanel::OnMouseUp(BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
 816 {
 817         if(iPulseActions & BF_NODEPANEL_PULSE_MOVEDOWN){
 818                 PulseAction_Remove(BF_NODEPANEL_PULSE_MOVEDOWN);
 819         }
 820         if(iPulseActions & BF_NODEPANEL_PULSE_MOVEUP){
 821                 PulseAction_Remove(BF_NODEPANEL_PULSE_MOVEUP);
 822         }
 823         return true;
 824 }
 825 
 826 
 827 
 828 bool
 829 BF_GUI_NodePanel::OnMouseDown(BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
 830 {
 831         if(BF_GUI_Panel::OnMouseDown(o_Point)) return true;
 832         /* check for focus */
 833         bool bOldFocus = IsFocus();
 834         if(!IsFocus()){
 835                 MakeFocus();
 836         }
 837         /* check for pressing in colstitle area */              
 838         if(o_Point.y<=(fColTitleHeight+HeaderHeight())){
 839                 NavUp();
 840                 PulseAction_Add(BF_NODEPANEL_PULSE_MOVEUP);
 841                 return true;
 842         }       
 843         /* check for pressing in under_nodes area */            
 844         if(o_Point.y>(fColTitleHeight+HeaderHeight()+fNodesHeight)){
 845                 NavDown();
 846                 PulseAction_Add(BF_NODEPANEL_PULSE_MOVEDOWN);
 847                 return true;
 848         }               
 849         /*  */  
 850         int32   iNewCursor=-1;  
 851         BPoint  oPoint(o_Point);
 852                 
 853         oPoint.y -= fColTitleHeight+HeaderHeight();
 854         
 855         switch(iMode){
 856         case BF_NODEPANEL_MODE_COLS:{
 857                 //oPoint.y -= poSysSetup->oFontNode.fAscent + fNodeHeight;
 858                 iNewCursor = (int32)(oPoint.y/fNodeHeight) + iNavFirstIndex;
 859                 iNewCursor+=iColsNodesInCol* int32((o_Point.x-5)/fColsColWidth);
 860                 break;} 
 861         case BF_NODEPANEL_MODE_FULL:{           
 862                 //oPoint.y -= poSysSetup->oFontNode.fAscent + fNodeHeight;
 863                 iNewCursor = (uint)(oPoint.y/fNodeHeight) + iNavFirstIndex;                             
 864                 break;}
 865         };
 866         int32 iNum;
 867         Window()->CurrentMessage()->FindInt32("clicks", &iNum);         
 868         if (iNum>1)
 869                 NavEnter();                     
 870         else
 871         if(iNewCursor==iNavCursorIndex && bOldFocus)            
 872                 NavSelect(false);
 873         else
 874                 NavChangeCursor(iNewCursor);
 875                 
 876         return true;
 877 }
 878 
 879 void
 880 BF_GUI_NodePanel::PrepareTopMenuItem(BF_GUI_TopMenu_HItem *po_HItem)    /* [previous][next][first][last][top][bottom][index][help] */
 881 {
 882         BF_GUI_Panel::PrepareTopMenuItem(po_HItem);
 883 
 884         ASSERT(po_HItem);       
 885         
 886         char pcSortKeyTitle[BF_NODELIST_SORT_UNSORTED][100] = 
 887                 {"Ctrl+F1","Ctrl+F2","Ctlr+F3","","Ctlr+F4"};
 888         int iSortCode[BF_NODELIST_SORT_UNSORTED] = 
 889                 {BF_NODELIST_SORT_NAME,BF_NODELIST_SORT_SIZE,BF_NODELIST_SORT_DATE,BF_NODELIST_SORT_TYPE,
 890                         BF_NODELIST_SORT_EXT};
 891         
 892         for(int i=0;i<BF_NODELIST_SORT_UNSORTED;i++){   
 893                 BMessage *poMessage = new BMessage(BF_MSG_NODEPANEL_SORT);
 894                 poMessage->AddInt32("bf_sorttype",iSortCode[i]);
 895                 poMessage->AddPointer("bf_view",this);
 896                 const char *pc=NULL;
 897                 switch(i){
 898                 case 0: pc = BF_DictAt(BF_DICT_MENU_SORTNAME);break;
 899                 case 1: pc = BF_DictAt(BF_DICT_MENU_SORTSIZE);break;
 900                 case 2: pc = BF_DictAt(BF_DICT_MENU_SORTDATE);break;
 901                 case 3: pc = BF_DictAt(BF_DICT_MENU_SORTTYPE);break;
 902                 case 4: pc = BF_DictAt(BF_DICT_MENU_SORTEXT);break;
 903                 default:        ASSERT(FALSE);
 904                 }
 905                 po_HItem->loVItem.AddItem(new BF_GUI_TopMenu_VItem(pc,poMessage,pcSortKeyTitle[i]));                    
 906         }
 907         po_HItem->AddHItem("",NULL);
 908         po_HItem->AddHItem(BF_DictAt(BF_DICT_MENU_SHOWHIDE_ICONS),BF_MSG_NODEPANEL_SHOW_ICONS,this,"Alt+P");            
 909         
 910         {
 911                 BMessage *poMessage = new BMessage(BF_MSG_NODEPANEL_COLSMODE_SET_COLSCOUNT);
 912                 poMessage->AddInt32("iCount",0);        
 913                 poMessage->AddPointer("bf_view",this);
 914                 po_HItem->AddHItem(BF_DictAt(BF_DICT_MENU_FULLMODE),poMessage,"Alt+0");
 915         }
 916         {
 917                 BMessage *poMessage = new BMessage(BF_MSG_NODEPANEL_COLSMODE_SET_COLSCOUNT);
 918                 poMessage->AddInt32("iCount",3);        
 919                 poMessage->AddPointer("bf_view",this);
 920                 po_HItem->AddHItem(BF_DictAt(BF_DICT_MENU_COLSMODE),poMessage,"Alt+1..9");
 921         }
 922         po_HItem->AddHItem(BF_DictAt(BF_DICT_MENU_PANELSETUP),BF_MSG_NODEPANEL_SETUP_0,this);
 923                 
 924         //po_HItem->loVItem.AddItem(new BF_GUI_TopMenu_VItem("Cols mode","vmode_cols","Alt+1..9"));
 925 //      po_HItem->loVItem.AddItem(new BF_GUI_TopMenu_VItem());
 926 }
 927 
 928 void
 929 BF_GUI_NodePanel::PrepareKeysMenu()    /* [previous][next][first][last][top][bottom][index][help] */
 930 {
 931         BF_GUI_Panel::PrepareKeysMenu();
 932         uint32  iKeysModifiers = modifiers();
 933         
 934         if(iKeysModifiers & B_RIGHT_OPTION_KEY){
 935                 BMessage *po;
 936                 
 937                 poSysKeysMenu->SetText(1,"SrtName");
 938                 po = new BMessage(BF_MSG_NODEPANEL_SORT);
 939                 po->AddInt32("bf_sorttype",BF_NODELIST_SORT_NAME);              
 940                 poSysKeysMenu->SetMessage(1,po,this);
 941                 
 942                 poSysKeysMenu->SetText(2,"SrtSize");
 943                 po = new BMessage(BF_MSG_NODEPANEL_SORT);
 944                 po->AddInt32("bf_sorttype",BF_NODELIST_SORT_SIZE);              
 945                 poSysKeysMenu->SetMessage(2,po,this);
 946                 
 947                 poSysKeysMenu->SetText(3,"SrtDate");
 948                 po = new BMessage(BF_MSG_NODEPANEL_SORT);
 949                 po->AddInt32("bf_sorttype",BF_NODELIST_SORT_DATE);              
 950                 poSysKeysMenu->SetMessage(3,po,this);
 951                 
 952                 poSysKeysMenu->SetText(4,"SrtExt");
 953                 po = new BMessage(BF_MSG_NODEPANEL_SORT);
 954                 po->AddInt32("bf_sorttype",BF_NODELIST_SORT_EXT);               
 955                 poSysKeysMenu->SetMessage(4,po,this);                           
 956         }else{                                  
 957                 
 958         }
 959 }
 960 
 961 void
 962 BF_GUI_NodePanel::PrepareHotKeys(bool b_Focused)    /* [previous][next][first][last][top][bottom][index][help] */
 963 {
 964         if(b_Focused){
 965                 /* set keyboard shortcats */
 966                 poWin->AddShortcut(B_BACKSPACE,B_COMMAND_KEY,new BMessage(BF_MSG_FILEPANEL_HISTORY_BACK),this);         
 967                 for(int i=0;i<10;i++){
 968                         BMessage *poMessage = new BMessage(BF_MSG_NODEPANEL_COLSMODE_SET_COLSCOUNT);
 969                         poMessage->AddInt32("iCount",(int32)i);
 970                         poWin->AddShortcut((char)('0'+i),B_COMMAND_KEY,poMessage,this);         
 971                 }
 972                 poWin->AddShortcut('p',B_COMMAND_KEY,new BMessage(BF_MSG_NODEPANEL_SHOW_ICONS),this);           
 973                 poWin->AddShortcut('q',B_COMMAND_KEY,new BMessage(BF_MSG_MAINVIEW_ASK_QUIT),poWinView);                         
 974         }else{                  
 975                 /* clear keyboard shortcats */
 976                 poWin->RemoveShortcut(B_BACKSPACE,B_COMMAND_KEY);               
 977                 poWin->RemoveShortcut(B_LEFT_ARROW,B_COMMAND_KEY);              
 978                 for(int i=0;i<10;i++){                  
 979                         poWin->RemoveShortcut((char)('1'+i),B_COMMAND_KEY);
 980                 }
 981                 poWin->RemoveShortcut('p',B_COMMAND_KEY);
 982                 poWin->RemoveShortcut('q',B_COMMAND_KEY);
 983         }                               
 984 }
 985 
 986 bool
 987 BF_GUI_NodePanel::OnBeforeKeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
 988 {
 989         if(numBytes==1){
 990                 BMessage *poMsg = Window()->CurrentMessage(); 
 991                 if(poMsg){
 992                         int32 iKey = poMsg->FindInt32("key");           
 993                         
 994                         if(BL_KEY_PLUS == iKey ){
 995                                 NavSelectAll_0(iKey);
 996                                 return true;
 997                         }else           
 998                         if(BL_KEY_MUL== iKey){
 999                                 NavSelectAll_0(iKey);
1000                                 return true;
1001                         }else                   
1002                         if(BL_KEY_MINUS == iKey){
1003                                 NavSelectAll_0(iKey);
1004                                 return true;
1005                         };
1006                         
1007                 }
1008         }               
1009         return false;
1010 }
1011 
1012 bool
1013 BF_GUI_NodePanel::OnKeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
1014 {
1015         if(numBytes==1 && bytes[0]==B_BACKSPACE && (poSysSetup->MainStyle() & BF_SETUP_NODEPANEL_USE_BACKSPACE)){
1016                 NavGoParentDir();
1017         }else   
1018         if(numBytes==1 && bytes[0]==B_ENTER){
1019                 NavEnter();
1020         }else
1021         if(numBytes==1 && bytes[0]==B_DOWN_ARROW){
1022                 NavDown();
1023         }else
1024         if(numBytes==1 && bytes[0]==B_UP_ARROW){
1025                 NavUp();
1026         }else
1027         if(numBytes==1 && bytes[0]==B_RIGHT_ARROW && (BF_NODEPANEL_MODE_COLS==iMode)){
1028                 NavRight();             
1029         }else
1030         if(numBytes==1 && bytes[0]==B_LEFT_ARROW && (BF_NODEPANEL_MODE_COLS==iMode)){
1031                 NavLeft();
1032         }else   
1033         if(numBytes==1 && bytes[0]==B_UP_ARROW){
1034                 NavUp();
1035         }else   
1036         if(numBytes==1 && bytes[0]==B_HOME){
1037                 NavToStart();
1038         }else
1039         if(numBytes==1 && bytes[0]==B_END){
1040                 NavToEnd();
1041         }else   
1042         if(numBytes==1 && bytes[0]==B_INSERT){
1043                 NavSelect();
1044         }else           
1045         if(numBytes==1 && bytes[0]==B_PAGE_UP){
1046                 NavPgUp();
1047         }else                   
1048         if(numBytes==1 && bytes[0]==B_PAGE_DOWN){
1049                 NavPgDown();
1050         }else                           
1051         if(numBytes==1 && bytes[0]=='*'){
1052                 NavSelectAll_0(bytes[0]);
1053         }else           
1054         if(numBytes==1 && bytes[0]=='+'){
1055                 NavSelectAll_0(bytes[0]);
1056         }else                   
1057         if(numBytes==1 && bytes[0]=='-'){
1058                 NavSelectAll_0(bytes[0]);
1059         };
1060         
1061         return  BF_GUI_Panel::OnKeyDown(bytes,numBytes);
1062 }
1063 
1064 void 
1065 BF_GUI_NodePanel::Action_Alert(const char *pc_Title,const char *pc_Text)    /* [previous][next][first][last][top][bottom][index][help] */
1066 {
1067         /* disable panels */
1068         /* start thread */
1069         BF_Dialog_Alert_Sep(pc_Title,pc_Text,NULL,this);
1070                 
1071 }
1072 
1073 bool 
1074 BF_GUI_NodePanel::NavChangeCursor(int i_NewCursor,bool b_DrawNodes,bool b_ChangeVars)    /* [previous][next][first][last][top][bottom][index][help] */
1075 {
1076         if(b_ChangeVars){
1077                 if(i_NewCursor<0) i_NewCursor = 0;
1078                 if(i_NewCursor>=loNode.CountItems()) i_NewCursor = loNode.CountItems()-1;
1079                 ///
1080                 /* if go up */
1081                 if(i_NewCursor<iNavFirstIndex){
1082                         iNavFirstIndex = i_NewCursor;
1083                         iNavCursorIndex = i_NewCursor;  
1084                         if(b_DrawNodes)         DrawNodes(true);
1085                 }else
1086                 /* if go down */        
1087                 if((i_NewCursor - iNavFirstIndex+1)>iNodesOnScreen){
1088                         iNavFirstIndex = i_NewCursor - iNodesOnScreen+1;                
1089                         iNavCursorIndex = i_NewCursor;
1090                         if(b_DrawNodes) DrawNodes(true);
1091                 }else
1092                 /* change on screen */
1093                 {
1094                         if(b_DrawNodes){                
1095                                 BRect   oRect,oRect1,oRect2;
1096                                 BPoint  oPoint;
1097                                 char    pc[500];
1098                                 bool    bFocused=IsFocus() || bFixedFocus;
1099                                 
1100                                 if(bFocused){
1101                                         DrawNode(iNavCursorIndex,false,oPoint,oRect,pc,&oRect1,true);                           
1102                                         DrawNode(i_NewCursor,true,oPoint,oRect,pc,&oRect2,true);
1103                                 }
1104                         }
1105                         iNavCursorIndex = i_NewCursor;  
1106                 }
1107         }
1108         DrawNodeInfo();
1109         
1110         return true;
1111 }
1112 
1113 
1114 void                                    
1115 BF_GUI_NodePanel::OnFocus(bool b_Focused)    /* [previous][next][first][last][top][bottom][index][help] */
1116 {
1117         if(!bFixedFocus){               
1118                 /* redraw focus_node */
1119                 BRect   oRect,oRect1;
1120                 BPoint  oPoint;
1121                 char    pc[500];
1122                 DrawNode(iNavCursorIndex,b_Focused,oPoint,oRect,pc,&oRect1,true);       
1123         }
1124         /* call parent */
1125         BF_GUI_Panel::OnFocus(b_Focused);
1126         
1127         if(!b_Focused){
1128                 PulseAction_Remove(BF_NODEPANEL_PULSE_ALL);
1129         }               
1130 
1131         /* prepare hot keys */
1132         {
1133                 LOCK_WIN();
1134                 PrepareHotKeys(b_Focused);
1135         }
1136         
1137 }
1138 
1139 void
1140 BF_GUI_NodePanel::RefreshNodeList()    /* [previous][next][first][last][top][bottom][index][help] */
1141 {
1142 
1143 }
1144 
1145 void                                    
1146 BF_GUI_NodePanel::Action_SwitchShowIcons()    /* [previous][next][first][last][top][bottom][index][help] */
1147 {
1148         switch(iMode){
1149         case BF_NODEPANEL_MODE_COLS:{
1150                 if(ModeShowSIcon())     iModeColsStyles = iModeColsStyles & (~BF_NODEPANEL_COLS_SICON);
1151                 else                                    iModeColsStyles = iModeColsStyles | BF_NODEPANEL_COLS_SICON;
1152                 break;}
1153         case BF_NODEPANEL_MODE_FULL:{
1154                 if(ModeShowSIcon())     iModeFullStyles = iModeFullStyles & (~BF_NODEPANEL_FULL_SICON);
1155                 else                                    iModeFullStyles = iModeFullStyles | BF_NODEPANEL_FULL_SICON;
1156                 break;}                 
1157         }
1158         Calc();
1159         RefreshNodeList();
1160         Invalidate();
1161 }
1162 
1163 void
1164 BF_GUI_NodePanel::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
1165 {
1166         switch(po_Message->what) {
1167         case BF_MSG_PULSE:{
1168                 Pulse();
1169                 break;}
1170         /*=======================*/             
1171         case BF_MSG_NODEPANEL_RENAME_START:
1172                 ActionRename_Start();
1173                 break;
1174         case BF_MSG_NODEPANEL_RENAME_RUN:{              
1175                 BF_GUI_Func_PanelsEnable(true);
1176                 MakeFocus();
1177                 
1178                 int32 iResult=-1;
1179                 po_Message->FindInt32("menu",&iResult);
1180                 if(0!=iResult) return;
1181                 
1182                 const char *pcOldName;
1183                 if(B_OK!=po_Message->FindString("bf_cOldName",&pcOldName) || !pcOldName) return;
1184                 const char *pcNewName;
1185                 if(B_OK!=po_Message->FindString("bf_cNewName",&pcNewName) || !pcNewName) return;                        
1186         
1187         
1188                 BF_NodeCollection loOpNode;
1189                 if(strcmp(pcOldName,"*.*")==0){
1190                         loNode.GetSelecting(loOpNode);
1191                 }else{          
1192                         BF_Node *poNode = loNode.NodeByName(pcOldName);         
1193                         if(!poNode) return;
1194                         loOpNode.AddItem(poNode);
1195                 }
1196                 
1197                 BL_String sNewName(pcNewName);
1198                 /*
1199                 {// rename by mask 
1200                         BL_String sMask(pcNewName);
1201                         if(poNode->ConvertNameByMask(sMask,sNewName)){
1202                                 pcNewName = sNewName.String();
1203                         }
1204                 }
1205                 */
1206                         
1207                 if(sNewName==""){
1208                         BF_Dialog_Alert_Sep("Error",BF_DictAt(BF_DICT_PANEL_FILEEMPTYNAME),NULL,this);
1209                         return;
1210                 }       
1211                 ActionRename_Run(loOpNode,sNewName);
1212                         
1213                 break;}
1214         //
1215         case BF_MSG_NODEPANEL_DELETE_START:
1216                 ActionDelete_Start();
1217                 break;
1218         case BF_MSG_NODEPANEL_DELETE_RUN:{              
1219                 BF_GUI_Func_PanelsEnable(true);
1220                 MakeFocus();
1221                 
1222                 int32 iResult=-1;
1223                 if(B_OK!=po_Message->FindInt32("menu",&iResult)) return;
1224                 if(0!=iResult) return;
1225                 
1226                 BF_NodeCollection* ploSel = Nodes_GetSelecting();
1227                 ActionDelete_Run(*ploSel);
1228                 DELETE(ploSel);                         
1229                 break;}         
1230         //
1231         case BF_MSG_NODEPANEL_COPY_START:
1232                 ActionCopyTo_Start();
1233                 break;
1234         case BF_MSG_NODEPANEL_COPY_RUN:{                
1235                 BF_GUI_Func_PanelsEnable(true);
1236                 MakeFocus();
1237                 
1238                 int32 iResult=-1;
1239                 po_Message->FindInt32("menu",&iResult);
1240                 if(B_OK!=po_Message->FindInt32("menu",&iResult)) return;
1241                 if(0!=iResult) return;
1242                 
1243                 const char *pcPath;
1244                 if(B_OK!=po_Message->FindString("bf_cPath",&pcPath) || !pcPath) return;
1245                 BL_String sPath(pcPath);
1246                 
1247                 BF_NodeCollection* ploSel = Nodes_GetSelecting();
1248                 ActionCopyTo_Run(sPath,*ploSel);
1249                 DELETE(ploSel);         
1250                 
1251                 break;}         
1252         case BF_MSG_NODEPANEL_MOVE_START:
1253                 ActionMoveTo_Start();
1254                 break;          
1255         case BF_MSG_NODEPANEL_MOVE_RUN:{                
1256                 BF_GUI_Func_PanelsEnable(true);
1257                 MakeFocus();
1258                 
1259                 int32 iResult=-1;
1260                 po_Message->FindInt32("menu",&iResult);
1261                 if(0!=iResult) return;
1262                 
1263                 const char *pcPath;
1264                 if(B_OK!=po_Message->FindString("bf_cPath",&pcPath) || !pcPath) return;
1265                 BL_String sPath(pcPath);
1266 
1267                 
1268                 BF_NodeCollection* ploSel = Nodes_GetSelecting();
1269                 ActionMoveTo_Run(sPath,*ploSel);
1270                 DELETE(ploSel);         
1271                 
1272                 break;}                         
1273         case BF_MSG_NODEPANEL_MAKEDIR_START:
1274                 ActionMakeDir_Start(); 
1275                 break;          
1276         case BF_MSG_NODEPANEL_MAKEDIR_RUN:{             
1277                 BF_GUI_Func_PanelsEnable(true);
1278                 MakeFocus();
1279                 
1280                 int32 iResult=-1;
1281                 po_Message->FindInt32("menu",&iResult);
1282                 if(0!=iResult) return;
1283                 
1284                 const char *pcTitle;
1285                 if(B_OK!=po_Message->FindString("bf_cName",&pcTitle) || !pcTitle) return;
1286                 BL_String sTitle(pcTitle);
1287                 
1288                 ActionMakeDir_Run(sTitle);              
1289                 break;}                                         
1290         /*=======================*/     
1291         case BF_MSG_NODEPANEL_SETUP_0:
1292                 PanelSetup_0();
1293                 break;
1294         case BF_MSG_NODEPANEL_SETUP_1:
1295                 PanelSetup_1(po_Message);
1296                 break;
1297         case BF_MSG_NODEPANEL_SORT:{
1298                 BF_NodeList_SortType iSort;
1299                 iSort = (BF_NodeList_SortType)po_Message->FindInt32("bf_sorttype");
1300                 ChangeSortType(iSort);
1301                 break;
1302                 };
1303         case BF_MSG_NODEPANEL_SHOW_ICONS:{
1304                 Action_SwitchShowIcons();  
1305                 break;}
1306         case BF_MSG_NODEPANEL_COLSMODE_SET_COLSCOUNT:{
1307                 int32 iCount=0;
1308                 ASSERT(B_OK==po_Message->FindInt32("iCount",&iCount) && iCount>=0 && iCount<10);
1309                 if( iColsColCount == (uint32)iCount) break;
1310                 switch(iMode){
1311                 case BF_NODEPANEL_MODE_FULL:{           
1312                         bool bIconLoaded = ModeShowSIcon();
1313                         if(iCount>0)    iMode = BF_NODEPANEL_MODE_COLS; else break;
1314                         if(!bIconLoaded && ModeShowSIcon()) RefreshNodeList();
1315                         iColsColCount = iCount;
1316                         Calc();
1317                         Invalidate();           
1318                         break;}         
1319                 case BF_NODEPANEL_MODE_COLS:{
1320                         bool bIconLoaded = ModeShowSIcon();
1321                         if(iCount==0)   iMode = BF_NODEPANEL_MODE_FULL; 
1322                         if(!bIconLoaded && ModeShowSIcon()) RefreshNodeList();
1323                         iColsColCount = iCount;
1324                         Calc();
1325                         Invalidate();
1326                         break;}
1327                 }
1328                 break;}
1329         /*=======================*/                             
1330         case BF_MSG_NODEPANEL_INPUTMASK:{
1331                 NavSelectAll_1(po_Message);
1332                 break;};        
1333         default:{
1334                 //printf("uknown message %i\n",po_Message->what);
1335                 BF_GUI_Panel::MessageReceived(po_Message);
1336                 break;}         
1337         }
1338 }
1339 
1340 
1341 BF_Node*        
1342 BF_GUI_NodePanel::Nodes_Focus()    /* [previous][next][first][last][top][bottom][index][help] */
1343 {
1344         return (BF_Node*)loNode.ItemAt(iNavCursorIndex);
1345 }
1346 
1347 BF_NodeCollection*
1348 BF_GUI_NodePanel::Nodes_GetSelecting()    /* [previous][next][first][last][top][bottom][index][help] */
1349 {
1350         BF_NodeCollection *ploSelNode = new BF_NodeCollection();
1351         loNode.GetSelecting(*ploSelNode);
1352         if(ploSelNode->CountItems()==0){
1353                 BF_Node *poNode = Nodes_Focus();
1354                 if(!poNode) return(FALSE);              
1355                 ploSelNode->AddItem(poNode);
1356         }
1357         return ploSelNode;
1358 }
1359 
1360 void                                    
1361 BF_GUI_NodePanel::Nodes_SetSelectingByName( BF_NodeList* plo_ReqNode,uint i_SelAction,bool b_ReqUpdate)    /* [previous][next][first][last][top][bottom][index][help] */
1362 {
1363         BF_Node *poSrcNode,*poSelfNode; 
1364         ///////
1365         if(plo_ReqNode){
1366                 for(int i=0;i<plo_ReqNode->CountItems();i++){
1367                         poSrcNode = plo_ReqNode->NodeAt(i);
1368                         poSelfNode = loNode.NodeByName(poSrcNode->sName.String());
1369                         if(poSelfNode) poSelfNode->SetSelect(i_SelAction);
1370                 }       
1371         }else{
1372                 loNode.SetSelectAll(i_SelAction);
1373         }
1374         //
1375         if(b_ReqUpdate){
1376                 if(Enabled()){          
1377                         Draw(Bounds());
1378                 }else
1379                         bNeedUpdateAfterEnable = true;
1380         }
1381 }
1382 
1383 void
1384 BF_GUI_NodePanel::Nodes_GetAll(BF_NodeList      & lo_ResultNode,bool b_ReqIcons)    /* [previous][next][first][last][top][bottom][index][help] */
1385 {
1386         lo_ResultNode.DeleteItems();
1387 
1388         BF_Node *poNode;        
1389         for(int i=0;i<loNode.CountItems();i++){
1390                 poNode = loNode.NodeAt(i);
1391                 lo_ResultNode.AddItem(new BF_Node(poNode,b_ReqIcons));
1392         }
1393 }
1394 
1395 void                                    
1396 BF_GUI_NodePanel::Nodes_Add(BF_Node *po_Node, BF_NodeCollection *plo_Node)    /* [previous][next][first][last][top][bottom][index][help] */
1397 {
1398         if(po_Node)             loNode.AddItem(po_Node);
1399         if(plo_Node)    loNode.AddList(plo_Node);
1400         if(Enabled()){
1401                 if(!(poSysSetup->MainStyle() & BF_SETUP_DEB_NOSORTING)){
1402                         loNode.Sort(iSortType); 
1403                 }
1404                 Draw(Bounds());
1405         }else
1406                 bNeedUpdateAfterEnable = true;
1407         if(iNavCursorIndex>=loNode.CountItems()) NavChangeCursor(iNavCursorIndex,false);
1408 
1409 }
1410 
1411 void                                    
1412 BF_GUI_NodePanel::Nodes_Remove( BF_Node *po_Node, BF_NodeCollection *plo_Node)    /* [previous][next][first][last][top][bottom][index][help] */
1413 {
1414                 
1415         if(po_Node)             loNode.RemoveItem(po_Node);
1416         if(plo_Node)    loNode.RemoveList(plo_Node);
1417         if(!po_Node && !plo_Node) loNode.DeleteItems();
1418         if(Enabled()){
1419                 if(!(poSysSetup->MainStyle() & BF_SETUP_DEB_NOSORTING)){
1420                         loNode.Sort(iSortType); 
1421                 }
1422                 Draw(Bounds());
1423         }else
1424                 bNeedUpdateAfterEnable = true;
1425         //
1426         NavChangeCursor(iNavCursorIndex,Enabled());
1427 }
1428 
1429 void                                    
1430 BF_GUI_NodePanel::Nodes_Update( BF_Node *po_Node, BF_NodeCollection *plo_Node)    /* [previous][next][first][last][top][bottom][index][help] */
1431 {
1432         if(Enabled()){
1433                 if(!(poSysSetup->MainStyle() & BF_SETUP_DEB_NOSORTING)){
1434                         loNode.Sort(iSortType );        
1435                 }
1436                 Draw(Bounds());
1437         }else
1438                 bNeedUpdateAfterEnable = true;
1439 }
1440 
1441 bool                                    
1442 BF_GUI_NodePanel::ModeShowSIcon()    /* [previous][next][first][last][top][bottom][index][help] */
1443 {
1444         if(BF_NODEPANEL_MODE_FULL==iMode && (iModeFullStyles & BF_NODEPANEL_FULL_SICON)) return true;
1445         if(BF_NODEPANEL_MODE_COLS==iMode && (iModeColsStyles & BF_NODEPANEL_COLS_SICON)) return true;   
1446         return false;
1447 }
1448 
1449 void
1450 BF_GUI_NodePanel::SetModeShowSIcon(bool b_ShowIcons)    /* [previous][next][first][last][top][bottom][index][help] */
1451 {
1452         if(BF_NODEPANEL_MODE_FULL==iMode){
1453                 if(b_ShowIcons)
1454                         iModeFullStyles = iModeFullStyles | BF_NODEPANEL_FULL_SICON;
1455                 else
1456                         iModeFullStyles = iModeFullStyles & (~BF_NODEPANEL_FULL_SICON);
1457         }else
1458         if(BF_NODEPANEL_MODE_COLS==iMode){
1459                 if(b_ShowIcons)
1460                         iModeColsStyles = iModeColsStyles | BF_NODEPANEL_COLS_SICON;            
1461                 else
1462                         iModeColsStyles = iModeColsStyles & (~BF_NODEPANEL_COLS_SICON);         
1463         }
1464 }
1465 
1466 
1467 void
1468 BF_GUI_NodePanel::ChangeSortType(BF_NodeList_SortType i_NewSortType)    /* [previous][next][first][last][top][bottom][index][help] */
1469 {
1470         Window()->Lock();
1471         //
1472         iSortType = i_NewSortType;
1473         loNode.Sort(iSortType );        
1474         DrawNodes(true);
1475         //
1476         Window()->Unlock();
1477 }
1478 
1479 
1480 /////////////////////////////////////////////////////////////////////////////////////////////
1481 bool
1482 BF_GUI_NodePanel::NavUp()    /* [previous][next][first][last][top][bottom][index][help] */
1483 {
1484         /* check for first node */
1485         if(0==iNavCursorIndex) return false;
1486         
1487         if(iNavCursorIndex == iNavFirstIndex){
1488                 switch(iMode){
1489                 case BF_NODEPANEL_MODE_COLS:
1490                         DrawMove_ColsUp();
1491                         return true;
1492                         break;
1493                 case BF_NODEPANEL_MODE_FULL:{
1494                         DrawMove_FullUp();                      
1495                         return true;
1496                         break;}
1497                 }
1498         }       
1499         NavChangeCursor(iNavCursorIndex-1);
1500         return true;                    
1501 }
1502 
1503 bool 
1504 BF_GUI_NodePanel::NavDown()    /* [previous][next][first][last][top][bottom][index][help] */
1505 {
1506         /* check limit */
1507         if((iNavCursorIndex+1)>=loNode.CountItems()) return false;
1508         
1509         int iNewCursor = iNavCursorIndex+1;
1510         /* check finishing screen */
1511         if(iNewCursor >= (iNavFirstIndex+iNodesOnScreen)){      
1512                 switch(iMode){
1513                 case BF_NODEPANEL_MODE_COLS:{
1514                         DrawMove_ColsDown();                    
1515                         return true;
1516                         break;}
1517                 case BF_NODEPANEL_MODE_FULL:{
1518                         DrawMove_FullDown();                    
1519                         return true;
1520                         break;}
1521                 }
1522         }
1523         /* go to new pos */
1524         NavChangeCursor(iNewCursor);
1525         
1526         return true;                    
1527 }
1528 
1529 bool
1530 BF_GUI_NodePanel::NavRight()    /* [previous][next][first][last][top][bottom][index][help] */
1531 {
1532         if(iNavCursorIndex == (loNode.CountItems()-1))  return false;
1533         switch(iMode){
1534         case BF_NODEPANEL_MODE_COLS:{
1535                 if (iColsColCount==1) break;
1536                 uint32 iNewCursor = iNavCursorIndex+iColsNodesInCol;
1537                 if(iNewCursor>(uint32)(loNode.CountItems())) break;
1538                 if(iNewCursor< (iNavFirstIndex + iColsNodesInCol * iColsColCount)) break;
1539                 if( (iNewCursor+iColsNodesInCol-1)>(uint32)(loNode.CountItems())) break;
1540                                 
1541                 DrawMove_ColsRight();
1542                 
1543                 return true;                                                            
1544                 break;}
1545         }
1546         NavChangeCursor(iNavCursorIndex+iColsNodesInCol);
1547         return true;
1548 }
1549 
1550 
1551 bool
1552 BF_GUI_NodePanel::NavLeft()    /* [previous][next][first][last][top][bottom][index][help] */
1553 {
1554         if(iNavCursorIndex == 0)  return false;
1555 
1556         switch(iMode){
1557         case BF_NODEPANEL_MODE_COLS:{
1558                 if (iColsColCount==1) break;
1559                 int32 iNewCursor = iNavCursorIndex - iColsNodesInCol;
1560                 if(iNewCursor<0 || ((iNewCursor-iColsNodesInCol)<0) )break;                             
1561                 if( iNewCursor >= iNavFirstIndex) break;
1562                 if( (iNewCursor-(int32)iColsNodesInCol)<0) break;
1563                 
1564                 DrawMove_ColsLeft();
1565                 
1566                 return true;                                                            
1567                 break;}
1568         }
1569         NavChangeCursor(iNavCursorIndex - iColsNodesInCol);
1570         return true;
1571 }
1572 
1573 bool
1574 BF_GUI_NodePanel::NavPgDown()    /* [previous][next][first][last][top][bottom][index][help] */
1575 {
1576         /* check for last node */
1577         if(iNavCursorIndex == (loNode.CountItems()-1))  return false;
1578 
1579         NavChangeCursor(iNavCursorIndex + iNodesOnScreen );                     
1580         
1581         return true;                    
1582 }
1583 
1584 bool
1585 BF_GUI_NodePanel::NavPgUp()    /* [previous][next][first][last][top][bottom][index][help] */
1586 {
1587         /* check for first node */
1588         if(iNavCursorIndex == 0)  return false;
1589         NavChangeCursor(iNavCursorIndex - iNodesOnScreen);      
1590         return true;                    
1591 }
1592 
1593 bool
1594 BF_GUI_NodePanel::NavSelect(bool b_CursorGoNext)    /* [previous][next][first][last][top][bottom][index][help] */
1595 {
1596         if(!bCanSelect) return false;
1597         BF_Node *poNode = loNode.NodeAt(iNavCursorIndex);
1598         if(!poNode) return(false);
1599         poNode->SetSelect(BF_NODE_SELECT_INVERT);               
1600         if(b_CursorGoNext && iNavCursorIndex<(loNode.CountItems()-1))   NavDown();      else DrawNodeAt(iNavCursorIndex);
1601         DrawSelListInfo(true);
1602         return  true;
1603 }
1604 
1605 bool
1606 BF_GUI_NodePanel::NavToStart()    /* [previous][next][first][last][top][bottom][index][help] */
1607 {
1608         if(0==iNavCursorIndex) return(false );
1609         NavChangeCursor(0);
1610         return(true);
1611 }
1612 
1613 bool
1614 BF_GUI_NodePanel::NavToEnd()    /* [previous][next][first][last][top][bottom][index][help] */
1615 {
1616         if((loNode.CountItems()-1)==iNavCursorIndex) return(false );
1617         NavChangeCursor(loNode.CountItems()-1);
1618         return(true);
1619 }
1620 
1621 bool 
1622 BF_GUI_NodePanel::NavEnter()    /* [previous][next][first][last][top][bottom][index][help] */
1623 {       
1624 
1625         BF_Node *poNode = loNode.NodeAt(iNavCursorIndex);
1626         if(!poNode) return(false);
1627         
1628         switch(poNode->iType){
1629         /* go to parent dir */
1630         case BF_NODE_TYPE_PARENTDIR:{
1631                 NavGoParentDir();
1632                 return true;
1633                 break;}
1634         }
1635         return false;
1636 }
1637 
1638 
1639 
1640 void                                    
1641 BF_GUI_NodePanel::NavGoParentDir()    /* [previous][next][first][last][top][bottom][index][help] */
1642 {
1643 }
1644 
1645 /////////////////////////////////////////////////////////////////////////////////////////////
1646 int32 
1647 BF_GUI_NodePanel_PulseThread(void *data)    /* [previous][next][first][last][top][bottom][index][help] */
1648 {
1649         ASSERT(data);
1650         BView *poView = (BView*)data;
1651         BMessage oMessage(BF_MSG_PULSE);
1652         BMessenger oMessenger(poView);
1653         
1654         while(true){
1655                 snooze(50000);
1656                 oMessenger.SendMessage(&oMessage);
1657         }
1658 }
1659 
1660 void
1661 BF_GUI_NodePanel::PulseAction_Add(int32 i_NewActions)    /* [previous][next][first][last][top][bottom][index][help] */
1662 {
1663         iPulseActions = iPulseActions | i_NewActions;
1664         
1665         if(!idThreadPulse){             
1666                 idThreadPulse = spawn_thread(BF_GUI_NodePanel_PulseThread,"BeFar:nodepanel_pulse",B_THREAD_SUSPENDED,(void*)this);      
1667                 ASSERT(idThreadPulse>0,"can`t start thread BeFar:nodepanel_pulse\n");   
1668                 ASSERT(B_OK==resume_thread(idThreadPulse));             
1669                 set_thread_priority(idThreadPulse,2);
1670         }       
1671 }
1672 
1673 void                                    
1674 BF_GUI_NodePanel::Pulse(void)    /* [previous][next][first][last][top][bottom][index][help] */
1675 {
1676         if(iPulseActions & BF_NODEPANEL_PULSE_MOVEDOWN) NavDown();
1677         if(iPulseActions & BF_NODEPANEL_PULSE_MOVEUP)   NavUp();        
1678 }
1679 
1680 void
1681 BF_GUI_NodePanel::PulseAction_Remove(int32 i_Actions)    /* [previous][next][first][last][top][bottom][index][help] */
1682 {
1683         if(iPulseActions==BF_NODEPANEL_PULSE_NONE) return;
1684         iPulseActions = iPulseActions & (!i_Actions);
1685         if(iPulseActions==BF_NODEPANEL_PULSE_NONE){
1686                 while(B_OK!=kill_thread(idThreadPulse));
1687                 idThreadPulse = 0;
1688         }
1689 }
1690 
1691 /////////////////////////////////////////////////////////////////////////////////////////////
1692 
1693 /*=====================================================================*/
1694 /* select files                                                                                                            */
1695 /*=====================================================================*/
1696 
1697 bool
1698 BF_GUI_NodePanel::NavSelectAll_0(int32 i_Key)    /* [previous][next][first][last][top][bottom][index][help] */
1699 {
1700         BMessage oMessage(BF_MSG_NODEPANEL_INPUTMASK);
1701         oMessage.AddPointer("bf_focus",this);
1702         //
1703         BString sTitle;
1704         switch(i_Key){
1705         case BL_KEY_MUL :       sTitle=BF_DictAt(BF_DICT_PANEL_SEL_INVERT);break;
1706         case BL_KEY_PLUS :      sTitle=BF_DictAt(BF_DICT_PANEL_SEL_SET);break;          
1707         case BL_KEY_MINUS :     sTitle=BF_DictAt(BF_DICT_PANEL_SEL_UNSET);break;                        
1708         };
1709         oMessage.AddInt32("bf_iKey",i_Key);             
1710         /* */
1711         BF_GUI_Func_PanelsEnable(false);
1712         /* make dialog */       
1713         BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,300,0),
1714                 sTitle.String(),"dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER); 
1715         BRect oRect;    
1716         /* insert edit */
1717         poDialog->LocalBounds(oRect);   
1718         oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
1719         BF_GUI_ViewEdit_Create(oRect,BF_DictAt(BF_DICT_PANEL_MASK),poDialog,"edit",
1720                                         sNodeSelMask.String(),
1721                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1722         /* insert check */
1723         oRect.top = oRect.bottom+5;
1724         oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
1725         BF_GUI_ViewCheck *poCheck = new BF_GUI_ViewCheck(oRect,"dir_also",
1726                                         BF_DictAt(BF_DICT_PANEL_FOLDERALSO),bSelectDirAlso,
1727                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1728         poDialog->AddChild(poCheck);
1729         /* menu */
1730         poDialog->AddOkCancelMenu(oRect);
1731         /* finish */    
1732         poDialog->SetHeightFromLastChild();
1733         poDialog->MoveToCenter( poWinView );    
1734         BF_GUI_Func_AddChildToMainView ( poDialog );    
1735         /* */           
1736         return true;
1737 }
1738 
1739 void
1740 BF_GUI_NodePanel::NavDeselectAll()    /* [previous][next][first][last][top][bottom][index][help] */
1741 {
1742         loNode.SetSelectAll(BF_NODE_SELECT_OFF,NULL,BF_NODELIST_NODETYPE_ALL);  
1743 
1744         if(Enabled()){  
1745                 DrawNodes(true);
1746                 DrawSelListInfo(true);
1747         }else
1748                 bNeedUpdateAfterEnable=true;
1749 }
1750 
1751 void
1752 BF_GUI_NodePanel::NavSelectAll_1(BMessage *po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
1753 {       
1754         bool    bOk;
1755         ASSERT(B_OK==po_Message->FindBool(BF_GUI_DIALOG_MESSAGE_DATA_OK,&bOk));
1756         if(bOk){
1757                 char    *pcEditResult;
1758                 ASSERT(B_OK==po_Message->FindString("edit",(const char**)&pcEditResult));
1759                 ASSERT(B_OK==po_Message->FindBool("dir_also",&bSelectDirAlso));
1760                 /* prep  */
1761                 uint32 iWhatSelect = 0;
1762                 iWhatSelect=iWhatSelect | BF_NODELIST_NODETYPE_FILES;
1763                 iWhatSelect=iWhatSelect | BF_NODELIST_NODETYPE_LINKS;
1764                 if(bSelectDirAlso)
1765                 iWhatSelect=iWhatSelect | BF_NODELIST_NODETYPE_DIRS;
1766                 /* */
1767                 int32 iKey;             
1768                 ASSERT(B_OK==po_Message->FindInt32("bf_iKey",(int32*)&iKey));
1769                 switch(iKey){
1770                 case BL_KEY_MUL :
1771                         loNode.SetSelectAll(BF_NODE_SELECT_INVERT,pcEditResult,iWhatSelect);break;
1772                 case BL_KEY_PLUS:
1773                         loNode.SetSelectAll(BF_NODE_SELECT_ON,pcEditResult,iWhatSelect);break;
1774                 case BL_KEY_MINUS:
1775                         loNode.SetSelectAll(BF_NODE_SELECT_OFF,pcEditResult,iWhatSelect);break;                 
1776                 }
1777                 sNodeSelMask = pcEditResult;
1778                 
1779                 DrawNodes(true);
1780                 DrawSelListInfo(true);
1781         }
1782         //
1783         BF_GUI_Func_PanelsEnable(true);
1784         MakeFocus();
1785 }
1786 /////////////////////////////////////////////////////////////////////
1787 void
1788 BF_GUI_NodePanel::PanelSetup_0()    /* [previous][next][first][last][top][bottom][index][help] */
1789 {
1790         /* prepare message */
1791         BMessage oMessage(BF_MSG_NODEPANEL_SETUP_1);
1792         oMessage.AddPointer("bf_focus",this);
1793         /* */
1794         BF_GUI_Func_PanelsEnable(false);
1795         /* make dialog */       
1796         BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,200,0),
1797                 BF_DictAt(BF_DICT_PANEL_SETUP),"dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);  
1798         /* resize dialog */     
1799         BRect oRect;
1800         poDialog->LocalBounds(oRect);           
1801         BF_GUI_ViewCheck *poCheck;      
1802         /* show icons */
1803         //roRect.top = oRect.bottom+5;
1804         oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
1805         poCheck = new BF_GUI_ViewCheck(oRect,"show_icons",
1806                                         BF_DictAt(BF_DICT_PANEL_SHOWICONS),ModeShowSIcon(),
1807                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1808         poDialog->AddChild(poCheck);            
1809         /* full_mode */
1810         switch(iMode){
1811         case BF_NODEPANEL_MODE_FULL:{
1812                 // date 
1813                 oRect.top = oRect.bottom+5;
1814                 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
1815                 poCheck = new BF_GUI_ViewCheck(oRect,"full_date",
1816                                         BF_DictAt(BF_DICT_PANEL_SHOWDATES),iModeFullStyles & BF_NODEPANEL_FULL_DATE,
1817                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1818                 poDialog->AddChild(poCheck);
1819                 // size 
1820                 oRect.top = oRect.bottom+5;
1821                 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
1822                 poCheck = new BF_GUI_ViewCheck(oRect,"full_size",
1823                                         BF_DictAt(BF_DICT_PANEL_SHOWSIZES),iModeFullStyles & BF_NODEPANEL_FULL_SIZE,
1824                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1825                 poDialog->AddChild(poCheck);            
1826                 // type
1827                 oRect.top = oRect.bottom+5;
1828                 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
1829                 poCheck = new BF_GUI_ViewCheck(oRect,"full_type",
1830                                         BF_DictAt(BF_DICT_PANEL_SHOWTYPES),iModeFullStyles & BF_NODEPANEL_FULL_TYPE,
1831                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1832                 poDialog->AddChild(poCheck);            
1833                 break;}
1834         }
1835         ////////////////////                    
1836         /* menu */
1837         poDialog->AddOkCancelMenu(oRect);               
1838         /* finish */
1839         poDialog->SetHeightFromLastChild();
1840         poDialog->MoveToCenter( poWinView );                    
1841         BF_GUI_Func_AddChildToMainView ( poDialog );    
1842         /* */           
1843 }
1844 
1845 void
1846 BF_GUI_NodePanel::PanelSetup_1(BMessage *po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
1847 {
1848         BF_GUI_Func_PanelsEnable(true); 
1849         MakeFocus();
1850 
1851         bool bOk;
1852         ASSERT(B_OK==po_Message->FindBool(BF_GUI_DIALOG_MESSAGE_DATA_OK,&bOk));                         
1853         if(bOk && po_Message->FindInt32("menu")==0){                    
1854                 //
1855                 ASSERT(B_OK==po_Message->FindBool("show_icons",&bOk));
1856                 SetModeShowSIcon(bOk);
1857                 //              
1858                 if(B_OK==po_Message->FindBool("full_date",&bOk)){
1859                         if(bOk) iModeFullStyles = iModeFullStyles | BF_NODEPANEL_FULL_DATE;
1860                         else    iModeFullStyles = iModeFullStyles & (~BF_NODEPANEL_FULL_DATE);
1861                 }                       
1862                 //
1863                 if(B_OK==po_Message->FindBool("full_size",&bOk)){
1864                         if(bOk) iModeFullStyles = iModeFullStyles | BF_NODEPANEL_FULL_SIZE;
1865                         else    iModeFullStyles = iModeFullStyles & (~BF_NODEPANEL_FULL_SIZE);                  
1866                 }
1867                 //
1868                 if(B_OK==po_Message->FindBool("full_type",&bOk)){
1869                         if(bOk) iModeFullStyles = iModeFullStyles | BF_NODEPANEL_FULL_TYPE;
1870                         else    iModeFullStyles = iModeFullStyles & (~BF_NODEPANEL_FULL_TYPE);                  
1871                 }
1872                 //
1873                 Calc();
1874                 RefreshNodeList();
1875                 Invalidate();
1876         }               
1877 }
1878 
1879 void
1880 BF_GUI_NodePanel::ActionMakeDir_Start()    /* [previous][next][first][last][top][bottom][index][help] */
1881 {
1882         /* */
1883         BF_GUI_Func_PanelsEnable(false);
1884         /* make dialog */       
1885         BMessage oMessage(BF_MSG_NODEPANEL_MAKEDIR_RUN);
1886         oMessage.AddPointer("bf_focus",this);
1887                         
1888         BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,300,0),
1889                 BF_DictAt(BF_DICT_PANEL_CREATEFOLDER_TITLE),"dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_NONE);
1890         BRect oRect;    
1891         /* insert edit */
1892         poDialog->LocalBounds(oRect);   
1893         oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
1894         BF_GUI_ViewEdit_Create(oRect,BF_DictAt(BF_DICT_NAME),poDialog,"bf_cName",
1895                                         "New folder",
1896                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1897         /* menu */                                                              
1898         poDialog->AddOkCancelMenu(oRect);
1899         
1900         /* finish */    
1901         poDialog->SetHeightFromLastChild();
1902         poDialog->MoveToCenter( poWinView );    
1903         BF_GUI_Func_AddChildToMainView ( poDialog );    
1904 }
1905 
1906 void
1907 BF_GUI_NodePanel::ActionMakeDir_Run(BL_String & s_Title)    /* [previous][next][first][last][top][bottom][index][help] */
1908 {
1909 }
1910 
1911 void                                    
1912 BF_GUI_NodePanel::ActionCopyFrom_Run(BL_String & s_Path,BF_NodeCollection & lo_Node,bool b_Move)    /* [previous][next][first][last][top][bottom][index][help] */
1913 {
1914 }
1915 
1916 void
1917 BF_GUI_NodePanel::ActionCopyTo_Start()    /* [previous][next][first][last][top][bottom][index][help] */
1918 {
1919         // prepare dest_path
1920         BL_String sDestPath;
1921         BF_GUI_Panel *poDestPanel = poWinView->PanelOnTop(!bWinPos_OnLeft);
1922         if(poDestPanel)
1923                 sDestPath = poDestPanel->Path();
1924         else
1925                 sDestPath = Path();
1926                 
1927         //
1928         if(poSysSetup->MainStyle() & BF_SETUP_MAIN_ASK_COPY){   
1929                 /* */
1930                 BF_GUI_Func_PanelsEnable(false);
1931                 /* make dialog */       
1932                 BMessage oMessage(BF_MSG_NODEPANEL_COPY_RUN);
1933                 oMessage.AddPointer("bf_focus",this);
1934                 oMessage.AddInt32(BF_NODEPANEL_COPY_NOTETYPES_FIELD,BF_NODELIST_NODETYPE_ALL);
1935                                 
1936                 BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,300,0),
1937                         BF_DictAt(BF_DICT_COPYTO),"dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);       
1938                 BRect oRect;    
1939                 /* insert edit */
1940                 poDialog->LocalBounds(oRect);   
1941                 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
1942                 BF_GUI_ViewEdit_Create(oRect,BF_DictAt(BF_DICT_PATH),poDialog,"bf_cPath",
1943                                                 sDestPath.String(),
1944                                                 B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
1945                 // menu 
1946                 {
1947                         BL_List *ploMenu = new BL_List();
1948                         ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
1949                         ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_CANCEL),"cancel"));
1950                         ploMenu->AddItem(new BF_GUI_NodePanel_Copy_SpecialItem(BF_DictAt(BF_DICT_SPECIAL),"special",poDialog->Message()));
1951                         poDialog->AddMenu(oRect,ploMenu);
1952                 }
1953                 
1954                 /* finish */    
1955                 poDialog->SetHeightFromLastChild();
1956                 poDialog->MoveToCenter( poWinView );    
1957                 BF_GUI_Func_AddChildToMainView ( poDialog );    
1958         }else{          
1959                 BF_NodeCollection* ploSel = Nodes_GetSelecting();
1960                 ActionCopyTo_Run(sDestPath,*ploSel);
1961                 DELETE(ploSel);                                         
1962         }
1963 }
1964 
1965 
1966 
1967 void
1968 BF_GUI_NodePanel::ActionCopyTo_Run(BL_String & s_Path,BF_NodeCollection & lo_Node)    /* [previous][next][first][last][top][bottom][index][help] */
1969 {
1970         if(poSysSetup->MainStyle() & BF_SETUP_NODEPANEL_DESELECT_AFTER_COPY) NavDeselectAll();
1971 }
1972 
1973 void
1974 BF_GUI_NodePanel::ActionMoveTo_Start()    /* [previous][next][first][last][top][bottom][index][help] */
1975 {
1976         // prepare dest_path
1977         BL_String sDestPath;
1978         BF_GUI_Panel *poDestPanel = poWinView->PanelOnTop(!bWinPos_OnLeft);
1979         if(poDestPanel)
1980                 sDestPath = poDestPanel->Path();
1981         else
1982                 sDestPath = Path();
1983                 
1984         if(poSysSetup->MainStyle() & BF_SETUP_MAIN_ASK_COPY){           
1985                 /* */
1986                 BF_GUI_Func_PanelsEnable(false);
1987                 /* make dialog */       
1988                 BMessage oMessage(BF_MSG_NODEPANEL_MOVE_RUN);
1989                 oMessage.AddPointer("bf_focus",this);
1990                                 
1991                 BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,300,0),
1992                         BF_DictAt(BF_DICT_MOVETO),"dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);       
1993                 BRect oRect;    
1994                 /* insert edit */
1995                 poDialog->LocalBounds(oRect);   
1996                 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
1997                 BF_GUI_ViewEdit_Create(oRect,BF_DictAt(BF_DICT_PATH),poDialog,"bf_cPath",
1998                                                 sDestPath.String(),
1999                                                 B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
2000                 /* menu */                                                              
2001                 //BF_Dialog_Alert_Sep("Question","Copy files ?",ploMenu,this,NULL,BF_MSG_NODEPANEL_COPY_START);
2002                 poDialog->AddOkCancelMenu(oRect);
2003                 
2004                 /* finish */    
2005                 poDialog->SetHeightFromLastChild();
2006                 poDialog->MoveToCenter( poWinView );    
2007                 BF_GUI_Func_AddChildToMainView ( poDialog );    
2008         }else{          
2009                 BF_NodeCollection* ploSel = Nodes_GetSelecting();
2010                 ActionMoveTo_Run(sDestPath,*ploSel);
2011                 DELETE(ploSel);                                         
2012         }
2013 }
2014 
2015 void
2016 BF_GUI_NodePanel::ActionMoveTo_Run(BL_String & s_Path,BF_NodeCollection & lo_Node)    /* [previous][next][first][last][top][bottom][index][help] */
2017 {
2018         if(poSysSetup->MainStyle() & BF_SETUP_NODEPANEL_DESELECT_AFTER_MOVE) NavDeselectAll();
2019 }
2020 
2021 void
2022 BF_GUI_NodePanel::ActionDelete_Start()    /* [previous][next][first][last][top][bottom][index][help] */
2023 {
2024         if(poSysSetup->MainStyle() & BF_SETUP_MAIN_ASK_DELETE){         
2025                 BL_List *ploMenu = new BL_List();
2026                 ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_YES),"yes"));
2027                 ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_NO),"no"));
2028                 BF_Dialog_Alert_Sep(BF_DictAt(BF_DICT_QUESTIONS),BF_DictAt(BF_DICT_PANEL_DELETEFILES),
2029                         ploMenu,this,NULL,BF_MSG_NODEPANEL_DELETE_RUN);
2030         }else{
2031                 BF_NodeCollection* ploSel = Nodes_GetSelecting();
2032                 ActionDelete_Run(*ploSel);
2033                 DELETE(ploSel);                         
2034         }
2035 }
2036 
2037 void
2038 BF_GUI_NodePanel::ActionDelete_Run(BF_NodeCollection & lo_Node)    /* [previous][next][first][last][top][bottom][index][help] */
2039 {
2040 }
2041 
2042 void
2043 BF_GUI_NodePanel::ActionRename_Start()    /* [previous][next][first][last][top][bottom][index][help] */
2044 {               
2045         uint64                          iSelCount = loNode.CountSelected();
2046         BF_Node                         *poNode = Nodes_Focus();
2047         BL_String                       s;
2048         
2049         if(iSelCount==0 && !poNode){
2050                 BF_Dialog_Alert_Sep(BF_DictAt(BF_DICT_WARNING),BF_DictAt(BF_DICT_PANEL_PANELEMPTY),NULL,this);
2051                 return;
2052         }
2053         /*
2054         if(poNode->Type()==BF_NODE_TYPE_PARENTDIR){
2055                 BF_Dialog_Alert_Sep("Warning","Sorry, but I can`t rename this node",NULL,this);
2056                 return;
2057         }
2058         */
2059         /* */
2060         BF_GUI_Func_PanelsEnable(false);
2061         /* make dialog */       
2062         BMessage oMessage(BF_MSG_NODEPANEL_RENAME_RUN);
2063         oMessage.AddPointer("bf_focus",this);
2064         oMessage.AddString("bf_cOldName",iSelCount==0?poNode->Name():"*.*");
2065                         
2066         BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,300,0),
2067                 BF_DictAt(BF_DICT_RENAME),"dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);
2068         BRect oRect;    
2069         /* insert comment */
2070         poDialog->LocalBounds(oRect);           
2071         oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
2072         if(iSelCount==0){
2073                 s=BF_DictAt(BF_DICT_PANEL_FROM);
2074                 s<<" ";
2075                 s<<poNode->Name();      
2076                 poDialog->AddChild(new BF_GUI_ViewText(oRect,"old_name",s.String(),B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_WILL_DRAW,false));
2077                 oRect.top = oRect.bottom+5;
2078                 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;                                     
2079         }
2080         /* insert edit */       
2081         BF_GUI_ViewEdit_Create(oRect,BF_DictAt(BF_DICT_PANEL_TO),poDialog,"bf_cNewName",
2082                                         iSelCount==0?poNode->Name():"*.*",
2083                                         B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);                                  
2084         /* menu */                                                              
2085         poDialog->AddOkCancelMenu(oRect);
2086         
2087         /* finish */    
2088         poDialog->SetHeightFromLastChild();
2089         poDialog->MoveToCenter( poWinView );    
2090         BF_GUI_Func_AddChildToMainView ( poDialog );    
2091 }
2092 
2093 
2094 void
2095 BF_GUI_NodePanel::ActionRename_Run(BF_NodeCollection & lo_Node,BL_String & s_NewName)    /* [previous][next][first][last][top][bottom][index][help] */
2096 {
2097 }
2098 
2099 void
2100 BF_GUI_NodePanel::StoreVars(BF_GUI_Setup_Vars_Panel & o_Setup) const    /* [previous][next][first][last][top][bottom][index][help] */
2101 {
2102         BF_GUI_Panel::StoreVars(o_Setup);
2103         o_Setup.sPath = Path();
2104         o_Setup.iModeFullStyles = iModeFullStyles;
2105         o_Setup.iModeColsStyles =iModeColsStyles;
2106         o_Setup.iMode = iMode;
2107         
2108 }

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