root/BF_GUI_DlgViews.cpp

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

DEFINITIONS

This source file includes following definitions.
  1. BF_GUI_GetTextLength
  2. SetSetupFont
  3. MouseDown
  4. SetupUpdated
  5. MessageReceived
  6. KeyDownExt
  7. SetLimits
  8. SetCursor
  9. Draw
  10. Draw
  11. MouseDown
  12. AddOkCancelMenu
  13. AddMenu
  14. SetSizeBy
  15. SetHeightFromLastChild
  16. LocalBounds
  17. MessageReceived
  18. MoveToCenter
  19. Draw
  20. MouseDown
  21. FocusFirstView
  22. AttachedToWindow
  23. BF_GUI_Dialod_CalcCenter
  24. EnableDialog
  25. Message
  26. MessageReceived
  27. Save
  28. Draw
  29. BF_GUI_ViewEdit_Create
  30. BF_GUI_ViewCheck_PulseThread
  31. AttachedToWindow
  32. MessageReceived
  33. Pulse
  34. KeyDown
  35. MakeFocus
  36. MouseDown
  37. SaveToMessage
  38. DrawCursor
  39. Draw
  40. SaveToMessage
  41. SetControls
  42. AttachedToWindow
  43. Pulse
  44. Draw
  45. SetLimit
  46. Step
  47. MessageReceived
  48. MessageReceived
  49. BF_Dialog_Alert
  50. BF_Dialog_Alert_Sep_Thread
  51. BF_Dialog_Alert_Sep_Error
  52. BF_Dialog_Alert_Sep

   1 #include <stdio.h>
   2 
   3 #include "BF_Dict.h" 
   4 #include "BF_Msg.h" 
   5 #include "BF_GUI_Func.h" 
   6 #include "BF_GUI_DlgViews.h"  
   7 #include "BF_GUI_WinMain.h"  
   8 
   9 #include <Clipboard.h>
  10 
  11 //////////////////////////////////////////////
  12 uint32
  13 BF_GUI_GetTextLength(BString & s_Text,float f_Width,BFont & o_Font)    /* [previous][next][first][last][top][bottom][index][help] */
  14 {
  15         if(o_Font.StringWidth(s_Text.String())<f_Width) return s_Text.Length();          
  16 
  17         int iLength = s_Text.Length();   
  18         while(iLength>0 && o_Font.StringWidth(s_Text.String(),iLength)>=f_Width) iLength--;
  19         return iLength;          
  20 }        
  21 
  22 //////////////////////////////////////////////
  23 
  24 
  25 BF_GUI_DialogView::BF_GUI_DialogView(
  26         const BRect oRect,
  27         const char *pc_Name,
  28         uint32  i_FollowMode,
  29         uint32  i_Flags)
  30 :BView(oRect,pc_Name,i_FollowMode,i_Flags)
  31 {
  32         poFont = &poSysSetup->oFontToolView;
  33         SetFont(&poFont->oFont);
  34 }
  35 
  36 void
  37 BF_GUI_DialogView::SetSetupFont(BF_GUI_Setup_Font *po_Font)    /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39         ASSERT(po_Font);
  40         poFont = po_Font;
  41         SetFont(&poFont->oFont);
  42 }
  43 
  44 void                                    
  45 BF_GUI_DialogView::MouseDown(BPoint point)    /* [previous][next][first][last][top][bottom][index][help] */
  46 {
  47         if(!IsFocus() && (Flags() & B_NAVIGABLE)) MakeFocus();
  48 }
  49 
  50 void
  51 BF_GUI_DialogView::SetupUpdated()    /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         Draw(Bounds());
  54 }
  55 
  56 void                                    
  57 BF_GUI_DialogView::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59         switch(po_Message->what){
  60         case BF_MSG_DIALOG_ENABLE:{
  61                 bool bEnable;
  62                 ASSERT(B_OK==po_Message->FindBool("bf_bEnable",&bEnable));
  63                 if(bEnable)             SetFlags(Flags()|B_NAVIGABLE);
  64                 else                    SetFlags(Flags() & (!B_NAVIGABLE));
  65                 break;}
  66         case BF_MSG_SETUP_UPDATED:
  67                 SetupUpdated();
  68                 break;
  69         default:
  70                 BView::MessageReceived(po_Message);
  71         }
  72 }
  73 
  74 /* handle keys for set focus on next or prev view */
  75 bool
  76 BF_GUI_DialogView::KeyDownExt(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
  77 {
  78         if(numBytes==1 && bytes[0]==B_ENTER){
  79                 BMessage oMessage(BF_MSG_DIALOG_PRESSED_OK);
  80                 oMessage.AddPointer("bf_DlgView_Focus",this);
  81                 BMessenger oMessenger(Parent());                
  82                 oMessenger.SendMessage(&oMessage);              
  83         }else
  84         if(numBytes==1 && bytes[0]==B_ESCAPE){
  85                 BMessage oMessage(BF_MSG_DIALOG_PRESSED_CANCEL);
  86                 oMessage.AddPointer("bf_DlgView_Focus",this);
  87                 BMessenger oMessenger(Parent());                
  88                 oMessenger.SendMessage(&oMessage);              
  89         }else   
  90         if(numBytes==1 && (bytes[0]==B_DOWN_ARROW || bytes[0]==B_TAB)){
  91                 BView *poView = this;
  92                 while(TRUE){
  93                         poView = poView->NextSibling();
  94                         if(!poView) poView =  Parent()->ChildAt(0);     
  95                         if(!(poView->Flags() & B_NAVIGABLE)) continue;
  96                         break;
  97                 }
  98                 poView->MakeFocus(true);
  99         }else
 100         if(numBytes==1 && bytes[0]==B_UP_ARROW){
 101                 BView *poView=this;
 102                 while(TRUE){
 103                         poView = poView->PreviousSibling();
 104                         if(!poView) poView =  Parent()->ChildAt(Parent()->CountChildren()-1);
 105                         if(!(poView->Flags() & B_NAVIGABLE)) continue;
 106                         break;
 107                 }               
 108                 poView->MakeFocus(true);
 109         }else   
 110                 return false;
 111         return true;
 112 }
 113 ///////////////////////////////////////////////////////////////////////
 114 
 115 BF_GUI_VScrollBar::BF_GUI_VScrollBar(const BRect o_Rect,const char* pc_Name,uint32      i_FollowMode)
 116 :BF_GUI_DialogView(o_Rect,pc_Name,i_FollowMode,B_WILL_DRAW)
 117 {
 118         iLimit = 0;
 119         iVisibleLimit = 0;
 120         iCursor = 0;
 121         //
 122         SetViewColor(B_TRANSPARENT_COLOR);      
 123 }
 124 
 125 void                                    
 126 BF_GUI_VScrollBar::SetLimits(int i_Limit,int i_VisibleLimit)    /* [previous][next][first][last][top][bottom][index][help] */
 127 {
 128         iLimit = i_Limit;
 129         iVisibleLimit = i_VisibleLimit;
 130         iCursor = 0;
 131         Draw(Bounds());
 132 }
 133 
 134 void                                    
 135 BF_GUI_VScrollBar::SetCursor(int i_Cursor)    /* [previous][next][first][last][top][bottom][index][help] */
 136 {
 137         iCursor = i_Cursor;
 138         Draw(Bounds());
 139 }
 140 
 141 void                                    
 142 BF_GUI_VScrollBar::Draw(BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 143 {
 144         // create render 
 145         BRect   oRect(Bounds());
 146         BBitmap oB(oRect,B_RGBA32,TRUE);
 147         BView   *pv;
 148         oB.AddChild(pv = new BView(oRect,"",B_FOLLOW_ALL,B_WILL_DRAW)); 
 149         oB.Lock();      
 150         // init render 
 151         pv->SetFont(&poFont->oFont);
 152         pv->SetViewColor(B_TRANSPARENT_COLOR);
 153 
 154         // draw background
 155         pv->SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));              
 156         pv->FillRect(Bounds()); 
 157         
 158         //
 159         float fVDelta = iLimit!=0?(iVisibleLimit / iLimit):0;
 160         float fSDelta = iLimit!=0?((pv->Bounds().Height()-11) / iLimit):0;
 161         float fBarHeight =      iVisibleLimit*fSDelta;
 162         fSDelta = iLimit!=0?((pv->Bounds().Height()-fBarHeight-11) / iLimit):0;         
 163         
 164         // draw center_line
 165         pv->SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_PROGRESS_FILLED));
 166         oRect = pv->Bounds();
 167         pv->StrokeLine(BPoint(4,oRect.top),BPoint(4,oRect.bottom));
 168         
 169         //  draw bar
 170         oRect=pv->Bounds();
 171         oRect.top = iCursor * fSDelta+7;
 172         oRect.bottom = oRect.top + fBarHeight;
 173         oRect.left+=2;
 174         oRect.right-=2;
 175                 
 176         pv->SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_PROGRESS_FILLED));           
 177         pv->FillRect(oRect);    
 178                 
 179         {// draw bottom figure 
 180                 oRect = pv->Bounds();
 181                 BPoint o1(2,oRect.bottom-5),o2(6,o1.y),o3;              
 182                 o3.Set(4,oRect.bottom);
 183                 pv->SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_PROGRESS_FILLED));
 184                 pv->FillTriangle(o1,o2,o3);
 185         }
 186         
 187         {// draw top figure     
 188                 oRect = pv->Bounds();
 189                 BPoint o1(2,oRect.top+5),o2(6,o1.y),o3;         
 190                 o3.Set(4,oRect.top);
 191                 pv->SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_PROGRESS_FILLED));
 192                 pv->FillTriangle(o1,o2,o3);
 193         }
 194         
 195         // close render 
 196         pv->Sync();
 197         oB.Unlock();
 198         DrawBitmap(&oB,oRect);
 199 }
 200 
 201 ///////////////////////////////////////////////////////////////////////
 202 BF_GUI_ViewFrame::BF_GUI_ViewFrame(BRect & o_Rect,int32 i_FollowMode)
 203 :BF_GUI_DialogView(o_Rect,"frame",i_FollowMode,B_WILL_DRAW)
 204 {
 205 }
 206 void
 207 BF_GUI_ViewFrame::Draw(BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 208 {
 209         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));  
 210         FillRect(Bounds());
 211         
 212         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_VIEWBORDER_UNFOCUSED));
 213         StrokeRect(Bounds());
 214 }
 215 
 216 ////////////////////////////////////////////////////////////////////////
 217 BF_GUI_DlgPanel::BF_GUI_DlgPanel(
 218         const BRect & o_Rect,
 219         const char *pc_Title,           
 220         const char *pc_Name,
 221         int i_FollowMode,
 222         int i_Styles,
 223         bool b_DoubleBorder)
 224 :BView(o_Rect,pc_Name,i_FollowMode,i_Styles | B_WILL_DRAW)
 225 {
 226         sTitle = pc_Title;      
 227         /*===*/
 228         SetFont(&poSysSetup->oFontToolView.oFont);
 229         SetViewColor(B_TRANSPARENT_COLOR);              
 230         //
 231         fShadowX = 10.0;
 232         fShadowY = 9.0;
 233         fBorderH = 10;  
 234         fBorderTop = 10;
 235         if(fBorderTop<poSysSetup->oFontToolView.fHeight) fBorderTop = poSysSetup->oFontToolView.fHeight;
 236         fBorderBottom = 10;             
 237         if(b_DoubleBorder){
 238                 fBorderH += fBorderH;
 239                 fBorderTop += fBorderTop;
 240                 fBorderBottom += fBorderBottom;
 241         }
 242 }
 243 
 244 void
 245 BF_GUI_DlgPanel::MouseDown(BPoint point)    /* [previous][next][first][last][top][bottom][index][help] */
 246 {
 247         BView *poView;
 248         BRect oChildFrame;
 249         for(int iChild=CountChildren()-1;iChild>=0;iChild--){
 250                 poView = ChildAt(iChild);
 251                 
 252                 oChildFrame = poView->Frame();          
 253                 if(oChildFrame.Contains(point)){
 254                         BPoint oPoint(point);
 255                         oPoint.x -= oChildFrame.left;
 256                         oPoint.y -= oChildFrame.top;                    
 257                         poView->MouseDown(oPoint);
 258                         return;
 259                 }               
 260         }
 261 }
 262 void
 263 BF_GUI_DlgPanel::AddOkCancelMenu(BRect & o_Rect,bool b_RectInited)    /* [previous][next][first][last][top][bottom][index][help] */
 264 {
 265         // prepare items for menu
 266         BL_List *ploMenu = new BL_List();
 267         ploMenu = new BL_List();
 268         ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
 269         ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_CANCEL),"cancel"));
 270         
 271         AddMenu(o_Rect,ploMenu,b_RectInited);
 272 }
 273 
 274 void
 275 BF_GUI_DlgPanel::AddMenu(BRect & o_Rect,BL_List *plo_Menu,bool b_RectInited)    /* [previous][next][first][last][top][bottom][index][help] */
 276 {
 277         ASSERT(plo_Menu);       
 278         /* insert menu */               
 279         if(!b_RectInited){
 280                 /*LocalBounds(o_Rect);
 281                 o_Rect.top = o_Rect.bottom - poSysSetup->oFontToolView.fHeight;*/               
 282                 o_Rect.top = o_Rect.bottom+5;
 283                 o_Rect.bottom = o_Rect.top + poSysSetup->oFontToolView.fHeight;
 284         }       
 285                 
 286         BF_GUI_DlgView_HMenu *poMenu = new BF_GUI_DlgView_HMenu(o_Rect,"menu",B_FOLLOW_BOTTOM,plo_Menu);        
 287         AddChild(poMenu);       
 288 }
 289 
 290 void
 291 BF_GUI_DlgPanel::SetSizeBy(float f_X,float f_Y)    /* [previous][next][first][last][top][bottom][index][help] */
 292 {
 293         ResizeTo( fBorderH + fBorderH +fShadowX + f_X,
 294                 fBorderTop + fBorderBottom + fShadowY + f_Y );
 295 }
 296 
 297 void
 298 BF_GUI_DlgPanel::SetHeightFromLastChild()    /* [previous][next][first][last][top][bottom][index][help] */
 299 {
 300         BView *poChild = ChildAt( CountChildren()-1 );
 301         ASSERT(poChild);
 302         BRect oRect(Bounds());
 303         BRect oRectChild(poChild->Frame());
 304         ResizeTo( oRect.Width(),
 305                 fBorderBottom + fShadowY + oRectChild.bottom );
 306 }
 307 
 308 void                                    
 309 BF_GUI_DlgPanel::LocalBounds(BRect & o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 310 {
 311         o_Rect = Bounds();
 312         o_Rect.top += fBorderTop+1;
 313         o_Rect.left += fBorderH+1;
 314         o_Rect.right -= fShadowX+fBorderH+1;
 315         o_Rect.bottom -= fShadowY+fBorderBottom+1;
 316 }
 317 
 318 void                                    
 319 BF_GUI_DlgPanel::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 320 {
 321         switch(po_Message->what){
 322         case BF_MSG_SETUP_UPDATED:
 323                 Draw(Bounds());
 324                 break;
 325         default:
 326                 BView::MessageReceived(po_Message);
 327         };
 328 }
 329 
 330 
 331 void                                    
 332 BF_GUI_DlgPanel::MoveToCenter(BView *po_View)    /* [previous][next][first][last][top][bottom][index][help] */
 333 {
 334         ASSERT(po_View);
 335         /* move window to center of screen*/
 336         BRect oRect;
 337         {
 338                 BPoint  oPoint;
 339                 BRect   oRect1;
 340                 oRect = po_View->Frame();
 341                 oRect1 = Frame();
 342                 oPoint.x = oRect.Width()/2 - oRect1.Width()/2;
 343                 oPoint.y = oRect.Height()/2 - oRect1.Height()/2;
 344                 MoveTo(oPoint);         
 345         }
 346 }
 347 
 348 void                                    
 349 BF_GUI_DlgPanel::Draw(const BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 350 {
 351         ///
 352         BRect   oRect;
 353         BPoint  oPoint;
 354         rgb_color oBackColor;   
 355         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
 356         oRect = Bounds();
 357         oRect.right -= fShadowX;
 358         oRect.bottom -= fShadowY;       
 359         FillRect(oRect);
 360         /* draw border */
 361         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_TEXT));  
 362         oRect = Bounds();
 363         oRect.left += ((int)fBorderH)/2-1;
 364         oRect.right -= fShadowX + ((int)fBorderH)/2-1;
 365         oRect.top += ((int)fBorderTop)/2-1;
 366         oRect.bottom -= fShadowY + ((int)fBorderBottom)/2-1;
 367         //
 368         StrokeRect(oRect);
 369         oRect.bottom-=2;
 370         oRect.left+=2;
 371         oRect.right-=2;
 372         oRect.top+=2;
 373         StrokeRect(oRect);                      
 374         /* draw shadow */
 375         SetDrawingMode(B_OP_ALPHA);
 376         //SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
 377         oRect = Bounds();
 378         oRect.left = oRect.right-fShadowX+1;
 379         oRect.top = fShadowY;   
 380         rgb_color oCol;
 381         RGBA_SET(oCol,100,100,100,170);
 382         SetHighColor(oCol);
 383         FillRect(oRect);        
 384         oRect = Bounds();
 385         oRect.top = oRect.bottom-fShadowY+1;    
 386         oRect.left+=fShadowX;
 387         oRect.right-=fShadowX;
 388         FillRect(oRect);                
 389         SetDrawingMode(B_OP_COPY);
 390         /* draw title */
 391         if(sTitle!=""){
 392                 oRect=Bounds();
 393                 oRect.bottom = fBorderTop;
 394                 oRect.right -= fShadowX;
 395                 oPoint.y = fBorderTop/2 - poSysSetup->oFontToolView.fHeight/2 + poSysSetup->oFontToolView.fAscent;
 396                 float fTextWidth = poSysSetup->oFontToolView.oFont.StringWidth(sTitle.String());
 397                 oPoint.x=oRect.Width()/2-fTextWidth/2;
 398                 oRect.left = oPoint.x-5;
 399                 oRect.right = oRect.left + fTextWidth + 10;             
 400                 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));  
 401                 FillRect(oRect);
 402                 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_TEXT));  
 403                 SetLowColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));   
 404                 DrawString(sTitle.String(),oPoint);
 405         }
 406         /**/            
 407         BView::Draw(o_Rect);
 408         /**/    
 409         SetHighColor(oBackColor);
 410 };
 411 
 412 ////////////////////////////////////////////////////////////////////////
 413 BF_GUI_Dialog::BF_GUI_Dialog(
 414         const BRect & o_Rect,
 415         const char *pc_Title,
 416         const char *pc_Name,
 417         const BMessage &o_Message,
 418         uint32  i_WinResizeType,
 419         bool b_DoubleBorder
 420 )
 421 :BF_GUI_DlgPanel(o_Rect,pc_Title,pc_Name?pc_Name:"tool_view",
 422         i_WinResizeType!=BG_GUI_DIALOG_WINRESIZE_RESIZE_ALL?B_FOLLOW_NONE:B_FOLLOW_ALL, 
 423         B_WILL_DRAW|B_FULL_UPDATE_ON_RESIZE|B_FRAME_EVENTS,b_DoubleBorder)
 424 {
 425         iWinResizeType = i_WinResizeType;
 426         oMessage = o_Message;
 427 }
 428 
 429 void                                    
 430 BF_GUI_Dialog::MouseDown(BPoint point)    /* [previous][next][first][last][top][bottom][index][help] */
 431 {
 432         BView *poView;
 433         BRect oChildFrame;
 434         for(int iChild=CountChildren()-1;iChild>=0;iChild--){
 435                 poView = ChildAt(iChild);
 436                 
 437                 oChildFrame = poView->Frame();          
 438                 if(oChildFrame.Contains(point)){
 439                         BPoint oPoint(point);
 440                         oPoint.x -= oChildFrame.left;
 441                         oPoint.y -= oChildFrame.top;                    
 442                         poView->MouseDown(oPoint);
 443                         return;
 444                 }               
 445         }
 446 }
 447 
 448 void
 449 BF_GUI_Dialog::FocusFirstView()    /* [previous][next][first][last][top][bottom][index][help] */
 450 {
 451         /* set focus to first B_NAVIGABLE child */
 452         BView* poView;
 453         for(int i=0;i<CountChildren();i++){
 454                 poView = ChildAt(i);
 455                 if(poView->Flags() & B_NAVIGABLE){
 456                         poView->MakeFocus();
 457                         break;
 458                 }
 459         }
 460 }
 461 
 462 void                                    
 463 BF_GUI_Dialog::AttachedToWindow(void)    /* [previous][next][first][last][top][bottom][index][help] */
 464 {       
 465         FocusFirstView();
 466         BView::AttachedToWindow();
 467 }
 468 
 469 void BF_GUI_Dialod_CalcCenter(BRect & o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 470 {
 471         /* move window to center of screen*/
 472         BRect oRect;
 473                         
 474         oRect = poWinView->Frame();     
 475         o_Rect.left = oRect.Width()/2 - o_Rect.Width()/2;
 476         o_Rect.right+=o_Rect.left;
 477         o_Rect.top = oRect.Height()/2 - o_Rect.Height()/2;
 478         o_Rect.bottom+=o_Rect.top;
 479         
 480 }
 481 
 482 
 483 
 484 void
 485 BF_GUI_Dialog::EnableDialog(bool b_Enable)    /* [previous][next][first][last][top][bottom][index][help] */
 486 {
 487         BView *poView;
 488         BMessage oMessage(BF_MSG_DIALOG_ENABLE);
 489         oMessage.AddBool("bf_bEnable",b_Enable);
 490         //
 491         for(int i=0;i<CountChildren();i++){
 492                 poView = (BView*)ChildAt(i);
 493                 poView->MessageReceived(&oMessage);
 494         }                       
 495 }
 496 BMessage*                               
 497 BF_GUI_Dialog::Message()    /* [previous][next][first][last][top][bottom][index][help] */
 498 {
 499         return &oMessage;
 500 }
 501 
 502 void                                    
 503 BF_GUI_Dialog::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 504 {
 505         switch(po_Message->what){
 506         /////////////////////////////////       
 507         case BF_MSG_PANEL_FOCUS_AND_ENABLE:{
 508                 FocusFirstView();
 509                 break;};        
 510         /////////////////////////////////       
 511         case BF_MSG_VIEW_MAINWIN_RESIZED:{
 512                 switch(iWinResizeType){
 513                 case BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER:
 514                         MoveToCenter(Parent());
 515                         break;
 516                 case BG_GUI_DIALOG_WINRESIZE_MOVE_RCENTER:{
 517                         if(!Parent()) break;
 518                         BRect oRect = Parent()->Bounds();
 519                         oRect.left = oRect.Width()/2+30;
 520                         MoveTo(oRect.left,Frame().top);
 521                         break;}
 522                 }
 523                 break;}
 524         /////////////////////////////////
 525         case BF_MSG_DIALOG_FOCUS:
 526                 EnableDialog(true);     
 527                 FocusFirstView();
 528                 break;
 529         case BF_MSG_DIALOG_ENABLE:{     
 530                 bool bEnable;
 531                 ASSERT(B_OK==po_Message->FindBool("bf_bEnable",&bEnable));
 532                 EnableDialog(bEnable);  
 533                 break;}
 534         case BF_MSG_DIALOG_PRESSED_OK:          
 535         case BF_MSG_DIALOG_PRESSED_CANCEL:{
 536         
 537                 if(!ReadyForClose()) return;
 538         
 539                 if(po_Message->what==BF_MSG_DIALOG_PRESSED_OK)  Save(oMessage);
 540                 BView *poView=NULL;
 541                 ASSERT(B_OK==oMessage.FindPointer("bf_focus",(void**)&poView)); 
 542                 BMessenger oMessenger(poView);
 543                 oMessage.AddBool(BF_GUI_DIALOG_MESSAGE_DATA_OK,
 544                                                 BF_MSG_DIALOG_PRESSED_OK==po_Message->what);
 545                 oMessenger.SendMessage(&oMessage);
 546 
 547                 RemoveSelf();
 548                 delete this;
 549                 break;}
 550         case BF_MSG_REDRAWDIALOGS:{
 551                 Draw(Bounds());
 552                 BView *poView;
 553                 for(int i=0;i<CountChildren();i++){
 554                         poView = ChildAt(i);
 555                         poView->Draw(poView->Bounds());
 556                 }
 557                 break;}
 558         case BF_MSG_DIALOG_CLOSE_NOW:
 559                 RemoveSelf();
 560                 delete this;
 561                 break;
 562         default:
 563                 BView::MessageReceived(po_Message);
 564         }       
 565 }
 566 
 567 void                                    
 568 BF_GUI_Dialog::Save(BMessage& o_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 569 {
 570         BF_GUI_DialogView *po;
 571         for(int i=0;i<CountChildren();i++){
 572                 po = (BF_GUI_DialogView*)ChildAt(i);
 573                 po->SaveToMessage(&o_Message);
 574         }
 575 }
 576 
 577 
 578 
 579 ///////////////////////
 580 
 581 BF_GUI_ViewText::BF_GUI_ViewText(
 582         const BRect o_Rect,
 583         const char *pc_Name,
 584         const char *pc_Title,
 585         uint32  i_FollowMode,
 586         uint32  i_Flags,        
 587         bool b_AlignCenter
 588 ):BF_GUI_DialogView(o_Rect,pc_Name,i_FollowMode,i_Flags|B_WILL_DRAW)
 589 {
 590         sTitle = pc_Title;
 591         SetViewColor(B_TRANSPARENT_COLOR);              
 592         bAlignCenter = b_AlignCenter;
 593 }
 594 
 595 void                                    
 596 BF_GUI_ViewText::Draw(BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 597 {
 598         BRect oRect;
 599         /* draw back */
 600         oRect = Bounds();
 601         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
 602         FillRect(oRect);
 603         /* draw text */
 604         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BUTTON_TEXT));
 605         SetLowColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
 606         BPoint oPoint;
 607         if(bAlignCenter){
 608                 float fWidth = poFont->oFont.StringWidth(sTitle.String());
 609                 oPoint.Set(oRect.Width()/2-fWidth/2,poFont->fAscent);
 610         }else
 611                 oPoint.Set(0,poFont->fAscent);
 612         DrawString(sTitle.String(),oPoint);     
 613 }
 614 BF_GUI_ViewEdit*
 615 BF_GUI_ViewEdit_Create( const BRect &o_Rect,    /* [previous][next][first][last][top][bottom][index][help] */
 616                                                 const char*pc_Comment,
 617                                                 BView *po_Parent,
 618                                                 const char*pc_Name,
 619                                                 const char *pc_Value,
 620                                                 uint32  i_FollowMode,
 621                                                 uint32  i_Flags)
 622 {
 623         ASSERT(po_Parent && pc_Comment && pc_Name && pc_Value);
 624         float fCommentWidth = poSysSetup->oFontToolView.oFont.StringWidth(pc_Comment);
 625         ////////
 626         BRect oRect(o_Rect);
 627         BL_String s(pc_Name);
 628         s<<"_comment";
 629         oRect.right = oRect.left+fCommentWidth;
 630         BF_GUI_ViewText *poText = new BF_GUI_ViewText(oRect,s.String(),pc_Comment,B_FOLLOW_LEFT|B_FOLLOW_TOP,0);
 631         po_Parent->AddChild(poText);
 632         ///////
 633         oRect = o_Rect;
 634         oRect.left+=fCommentWidth+5;
 635         BF_GUI_ViewEdit* poEdit = new BF_GUI_ViewEdit(oRect,pc_Name,pc_Value,i_FollowMode,i_Flags);
 636         po_Parent->AddChild(poEdit);
 637         return poEdit;
 638 }                                               
 639 
 640 /*========================================================*/
 641 BF_GUI_ViewCheck::BF_GUI_ViewCheck(
 642         const BRect     o_Rect,
 643         const char      *pc_Name,
 644         const char      *pc_Title,
 645         bool            b_Value,
 646         uint32          i_FollowMode,
 647         uint32          i_Flags
 648 ):BF_GUI_DialogView(o_Rect,pc_Name,i_FollowMode,i_Flags|B_WILL_DRAW)
 649 {
 650         sTitle = pc_Title;
 651         bValue = b_Value;
 652         SetViewColor(B_TRANSPARENT_COLOR);      
 653         bPulseCursorShow = true;
 654         idThreadPulse = 0;
 655 }
 656 
 657 BF_GUI_ViewCheck::~BF_GUI_ViewCheck()
 658 {
 659         while(B_OK!=kill_thread(idThreadPulse));
 660 }
 661 
 662 int32 
 663 BF_GUI_ViewCheck_PulseThread(void *data)    /* [previous][next][first][last][top][bottom][index][help] */
 664 {
 665         ASSERT(data);
 666         BView *poView = (BView*)data;
 667         BMessage oMessage(BF_MSG_PULSE);
 668         BMessenger oMessenger(poView);
 669         
 670         while(true){
 671                 snooze(200000);
 672                 oMessenger.SendMessage(&oMessage);
 673         }
 674 }
 675 
 676 
 677 void            
 678 BF_GUI_ViewCheck::AttachedToWindow(void)    /* [previous][next][first][last][top][bottom][index][help] */
 679 {
 680         BView::AttachedToWindow();
 681         //Window()->SetPulseRate(100);  
 682         
 683         idThreadPulse = spawn_thread(BF_GUI_ViewCheck_PulseThread,"BeFar:check_pulse",B_THREAD_SUSPENDED,(void*)this);
 684         ASSERT(idThreadPulse>0,"can`t start thread BeFar:check_pulse\n");       
 685         ASSERT(B_OK==resume_thread(idThreadPulse));             
 686         set_thread_priority(idThreadPulse,1);
 687 }
 688 
 689 
 690 void                                    
 691 BF_GUI_ViewCheck::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 692 {
 693         switch(po_Message->what){
 694         case BF_MSG_PULSE:
 695                 Pulse();
 696                 break;
 697         default:
 698                 BView::MessageReceived(po_Message);
 699         }
 700 }
 701 void                                    
 702 BF_GUI_ViewCheck::Pulse(void)    /* [previous][next][first][last][top][bottom][index][help] */
 703 {
 704         if(!IsFocus()) return;
 705         bPulseCursorShow = !bPulseCursorShow;   
 706         DrawCursor(bPulseCursorShow);
 707 }
 708 
 709 void                                    
 710 BF_GUI_ViewCheck::KeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
 711 {
 712         if(numBytes==1 && bytes[0]==B_SPACE){
 713                 bValue = !bValue;
 714                 Draw(Bounds());
 715         }else
 716         if(KeyDownExt(bytes,numBytes)) return;else      
 717                 BF_GUI_DialogView::KeyDown(bytes,numBytes);
 718 }
 719 
 720 void                                    
 721 BF_GUI_ViewCheck::MakeFocus(bool focused)    /* [previous][next][first][last][top][bottom][index][help] */
 722 {       
 723         BView::MakeFocus(focused);
 724         if(focused){
 725                 resume_thread(idThreadPulse);           
 726                 DrawCursor(TRUE);
 727         }else{
 728                 suspend_thread(idThreadPulse);
 729                 DrawCursor(FALSE);
 730         }
 731 }
 732 
 733 void
 734 BF_GUI_ViewCheck::MouseDown(BPoint point)    /* [previous][next][first][last][top][bottom][index][help] */
 735 {
 736         bValue = !bValue;
 737         Draw(Bounds()); 
 738         
 739         BF_GUI_DialogView::MouseDown(point);  
 740 }
 741 
 742 void                                    
 743 BF_GUI_ViewCheck::SaveToMessage(BMessage *po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 744 {
 745         po_Message->AddBool(Name(),bValue);     
 746 }
 747 
 748 
 749 void                                    
 750 BF_GUI_ViewCheck::DrawCursor(bool b_Show)    /* [previous][next][first][last][top][bottom][index][help] */
 751 {
 752         /* draw value */        
 753         if(b_Show)      SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BUTTON_TEXT));
 754         else            SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));          
 755         BPoint  oPoint(StringWidth("[")+1,poFont->fHeight);             
 756         BPoint  oPoint1(oPoint.x+StringWidth("X")-2,oPoint.y);
 757         StrokeLine(oPoint,oPoint1);
 758         //      
 759 }
 760 
 761 void                                    
 762 BF_GUI_ViewCheck::Draw(BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 763 {
 764         BRect oRect;
 765         /* draw back */
 766         oRect = Bounds();
 767         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
 768         FillRect(oRect);
 769         /* draw */
 770         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BUTTON_TEXT));
 771         SetLowColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));   
 772         BPoint  oPoint(0,poFont->fAscent);                      
 773         /* draw value */
 774         DrawString("[",oPoint);                 
 775         oPoint.x+=StringWidth("[");
 776         DrawString(bValue?"X":" ",oPoint);      
 777         oPoint.x+=StringWidth("X");
 778         DrawString("]",oPoint); 
 779         /* draw text */         
 780         oPoint.x+=StringWidth("]")+2;
 781         DrawString(sTitle.String(),oPoint);     
 782         /* draw  */     
 783 }
 784 /*========================================================*/
 785 BF_GUI_ViewCheck_Style::BF_GUI_ViewCheck_Style(
 786         const BRect             o_Rect,
 787         const char      *pc_Name,
 788         const char      *pc_Title,
 789         uint32          *pi_SrcStyles,
 790         uint32          i_SrcStyle,
 791         uint32          i_FollowMode,
 792         uint32          i_Flags)
 793 :BF_GUI_ViewCheck(o_Rect,pc_Name,pc_Title,(*pi_SrcStyles) & i_SrcStyle,i_FollowMode,i_Flags)
 794 {
 795         piSrcStyles = pi_SrcStyles;
 796         iSrcStyle = i_SrcStyle;
 797 }
 798 
 799 void
 800 BF_GUI_ViewCheck_Style::SaveToMessage(BMessage *po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 801 {
 802         BF_GUI_ViewCheck::SaveToMessage(po_Message);
 803         if(!bValue)
 804                 *piSrcStyles = (*piSrcStyles) & (~iSrcStyle);
 805         else
 806                 *piSrcStyles = (*piSrcStyles) | iSrcStyle;
 807 }
 808 /*========================================================*/
 809 
 810 
 811 BF_GUI_ViewProgress::BF_GUI_ViewProgress(
 812         const BRect o_Rect,
 813         const char *pc_Name,
 814         const char *pc_Title,
 815         uint32  i_FollowMode,
 816         uint32  i_Flags,
 817         int64 *pi_Count,
 818         int64 *pi_Index
 819 ):BF_GUI_DialogView(o_Rect,pc_Name,i_FollowMode,i_Flags)
 820 {
 821         sTitle = pc_Title;
 822         SetViewColor(B_TRANSPARENT_COLOR);              
 823         //
 824         iCount = 0;
 825         iIndex = 0;
 826         fDelta = 0;
 827         //
 828         piCount = pi_Count;
 829         piIndex = pi_Index;
 830         //
 831 }
 832 
 833 BF_GUI_ViewProgress::~BF_GUI_ViewProgress()
 834 {
 835 /*      if(piCount){
 836                 (*piCount)=-2;
 837                 (*piIndex)=-2;
 838                 piCount=NULL;
 839                 piIndex = NULL;
 840         }*/
 841 }
 842 
 843 
 844 void                                    
 845 BF_GUI_ViewProgress::SetControls(int64 *pi_Count,int64 *pi_Index)    /* [previous][next][first][last][top][bottom][index][help] */
 846 {
 847         piCount = pi_Count;
 848         piIndex = pi_Index;
 849         BWindow *poWind = Window();
 850         if(poWind){
 851                 poWind->Lock();
 852                 poWind->SetPulseRate(100);
 853                 poWind->Unlock();               
 854         }
 855         //Draw(Bounds());
 856 }
 857 
 858 void                                    
 859 BF_GUI_ViewProgress::AttachedToWindow(void)    /* [previous][next][first][last][top][bottom][index][help] */
 860 {
 861         BView::AttachedToWindow();
 862         //
 863         Window()->SetPulseRate(100);
 864         //
 865 }
 866 
 867 void
 868 BF_GUI_ViewProgress::Pulse(void)    /* [previous][next][first][last][top][bottom][index][help] */
 869 {
 870         /* signal from owner */
 871         if(piCount && ((*piCount)==-1)){
 872                 (*piCount)=-2;
 873                 (*piIndex)=-2;
 874                 piCount=NULL;
 875                 piIndex = NULL;
 876         }
 877         if(!piCount || !piIndex) return;
 878         
 879         bool bRedraw=false;
 880         if(iCount!=(*piCount)){
 881                 SetLimit(*piCount);
 882                 bRedraw=true;
 883         }
 884         if(iIndex!=(*piIndex)){
 885                 iIndex=*piIndex;
 886                 if(iIndex>iCount) iIndex = iCount;
 887                 bRedraw=true;           
 888         }
 889         if(bRedraw) Draw(Bounds());
 890 }
 891 
 892 void                                    
 893 BF_GUI_ViewProgress::Draw(BRect o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 894 {
 895         BRect oRect;
 896         /* draw back */
 897         oRect = Bounds();
 898         oRect.bottom = poFont->fHeight;
 899         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
 900         FillRect(oRect);
 901         /* draw text */
 902         BL_String s,s1;
 903         s<<sTitle;
 904         s<<" ";
 905         //
 906         s1=iIndex;
 907         s1.SetDigits();
 908         s<<s1;
 909         s<<" of ";
 910         //
 911         s1=iCount;
 912         s1.SetDigits();
 913         s<<s1;
 914         float fWidth = poFont->oFont.StringWidth(s.String());
 915         BPoint oPoint(oRect.Width()/2-fWidth/2,
 916                 poFont->fAscent);
 917         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BUTTON_TEXT));
 918         SetLowColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
 919         DrawString(s.String(),oPoint);  
 920         ///
 921         oRect = Bounds();
 922         oRect.top += poFont->fHeight+1;
 923         oRect.right = oRect.left + (float)iIndex * fDelta;
 924         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BUTTON_TEXT));
 925         FillRect(oRect,B_MIXED_COLORS);
 926         //
 927         oRect.left = oRect.right+1;
 928         oRect.right = Bounds().right;
 929         SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_PROGRESS_EMPTY));
 930         FillRect(oRect);
 931         
 932         ///
 933 }
 934 
 935 void
 936 BF_GUI_ViewProgress::SetLimit(int64 i_Count)    /* [previous][next][first][last][top][bottom][index][help] */
 937 {
 938         iCount = i_Count;
 939         iIndex = 0;
 940         fDelta = Bounds().Width() / (float)iCount ;
 941         Draw(Bounds());
 942 }
 943 
 944 void
 945 BF_GUI_ViewProgress::Step(int64 i_Delta)    /* [previous][next][first][last][top][bottom][index][help] */
 946 {
 947         iIndex+=i_Delta;
 948         if(iIndex>iCount) iIndex = iCount;
 949         Draw(Bounds());
 950 }
 951 
 952 void    
 953 BF_GUI_ViewProgress::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
 954 {
 955         switch(po_Message->what){
 956         case BF_MSG_PROGRESS_SETLIMIT:{
 957                 int64 iNewLimit;
 958                 ASSERT(B_OK==po_Message->FindInt64("bf_iLimit",&iNewLimit),"BF_GUI_ViewProgress::MessageReceived_BF_MSG_PROGRESS_SETLIMIT");
 959                 SetLimit(iNewLimit);
 960                 break;}
 961         case BF_MSG_PROGRESS_STEP:{
 962                 int64 iDelta=1;
 963                 if(B_OK!= po_Message->FindInt64("bf_iDelta",&iDelta)) iDelta=1;
 964                 Step(iDelta);
 965                 break;}
 966         default:
 967                 BView::MessageReceived(po_Message);
 968         }
 969 }
 970 
 971 
 972 class BF_GUI_Dialog_Alert:public BF_GUI_Dialog{
 973 public:
 974                                                                 BF_GUI_Dialog_Alert(
 975                                                                                 const BRect & o_Rect,
 976                                                                                 const char *pc_Title,
 977                                                                                 const char *pc_Text,
 978                                                                                 const char *pc_Name,
 979                                                                                 int32* pi_Result,
 980                                                                                 BL_List *po_List,
 981                                                                                 const char *pc_Text1=NULL);
 982 virtual void                                    MessageReceived(BMessage* po_Message);                                                                                          
 983 private:
 984                 int32*                                  piResult;
 985                 BF_GUI_DlgView_HMenu            *poMenu;
 986 };
 987 
 988 BF_GUI_Dialog_Alert::BF_GUI_Dialog_Alert(
 989         const BRect & o_Rect,
 990         const char *pc_Title,           
 991         const char *pc_Text,
 992         const char *pc_Name,
 993         int32* pi_Result,
 994         BL_List *po_List,
 995         const char *pc_Text1
 996 ):BF_GUI_Dialog(o_Rect,pc_Title,pc_Name,BMessage(),BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER)
 997 {
 998         ASSERT(pi_Result);
 999         piResult = pi_Result;   
1000         /* make childs */
1001         BRect oRect;
1002         /* make text */ 
1003         LocalBounds(oRect);
1004         oRect.bottom=oRect.top+poSysSetup->oFontToolView.fHeight;
1005         BF_GUI_ViewText *poText =new BF_GUI_ViewText(oRect,"text",pc_Text,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER,0);
1006         AddChild(poText);
1007         if(pc_Text1){
1008                 /* make text1 */        
1009                 //LocalBounds(oRect);
1010                 oRect.top=oRect.bottom+5;
1011                 oRect.bottom=oRect.top+poSysSetup->oFontToolView.fHeight;
1012                 BF_GUI_ViewText *poText1 =new BF_GUI_ViewText(oRect,"text1",pc_Text1,B_FOLLOW_TOP|B_FOLLOW_LEFT_RIGHT,0);
1013                 AddChild(poText1);
1014         }
1015         /* make menu */
1016         if(po_List){
1017                 if(po_List->CountItems()>0){
1018                         LocalBounds(oRect);
1019                         oRect.top=oRect.bottom - poSysSetup->oFontToolView.fHeight;     
1020                         BMessage oMessage;
1021                         poMenu = new BF_GUI_DlgView_HMenu(oRect,"menu",B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT,po_List);                    
1022                         AddChild(poMenu);       
1023                 }else{
1024                         DELETE(po_List);
1025                 }
1026         }
1027 }
1028 
1029 void                                    
1030 BF_GUI_Dialog_Alert::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
1031 {
1032         switch(po_Message->what){
1033         case BF_MSG_DIALOG_PRESSED_OK:
1034                 *piResult = poMenu->iNavCursorIndex;
1035                 RemoveSelf();
1036                 delete this;
1037                 break;
1038         case BF_MSG_DIALOG_PRESSED_CANCEL:{
1039                 *piResult = -2;                         
1040                 RemoveSelf();
1041                 delete this;            
1042                 break;}
1043         default:
1044                 BF_GUI_Dialog::MessageReceived(po_Message);
1045         }
1046 }
1047 
1048 int32
1049 BF_Dialog_Alert(const char *pc_Title,const char *pc_Text,    /* [previous][next][first][last][top][bottom][index][help] */
1050         BL_List *plo_MenuItem,
1051         const char *pc_Text1)
1052 {
1053         ASSERT(pc_Text && pc_Title);
1054         int32 iResult = -1;
1055 
1056         if(!plo_MenuItem){
1057                 plo_MenuItem = new BL_List();           
1058                 plo_MenuItem->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
1059         }
1060         
1061         BRect oRect(poWin->Bounds());
1062         
1063         float fWidth = poSysSetup->oFontToolView.oFont.StringWidth(pc_Text);
1064         if(fWidth<100) fWidth=100;      
1065         
1066         float fMenuWidth = BF_GUI_ViewMenu_CalcTotalWidth(plo_MenuItem,&poSysSetup->oFontToolView,false);
1067         if(fWidth<fMenuWidth) fWidth = fMenuWidth;
1068         
1069         if((fWidth+120)>=oRect.Width()) fWidth=oRect.Width()-120;       
1070         
1071         oRect.Set(0,0,fWidth+100,100+(pc_Text1?(poSysSetup->oFontToolView.fHeight+2):0));
1072         {
1073                 LOCK_WIN();
1074                 BF_GUI_Dialod_CalcCenter(oRect);
1075         }
1076         BF_GUI_Dialog_Alert *poAlert = new BF_GUI_Dialog_Alert(oRect,pc_Title,
1077                 pc_Text,"dialog_alert",&iResult,plo_MenuItem,pc_Text1);         
1078         
1079         BF_GUI_Func_AddChildToMainView ( poAlert);
1080         
1081         while(iResult==-1){
1082                 snooze(1000);
1083         }       
1084         return iResult;
1085 }
1086 
1087 
1088 int32 BF_Dialog_Alert_Sep_Thread(void *pu_Data)    /* [previous][next][first][last][top][bottom][index][help] */
1089 {
1090         ASSERT(pu_Data);
1091         BMessage *poMessage = (BMessage*)pu_Data;
1092         
1093         char    *pcText,*pcText1,*pcTitle;
1094         BView   *poView;
1095         BL_List *ploMenuItem=NULL;
1096         
1097         ASSERT(B_OK==poMessage->FindString("bf_cTitle",(const char**)&pcTitle) && pcTitle);
1098         ASSERT(B_OK==poMessage->FindString("bf_cText",(const char**)&pcText) && pcText);
1099         if(B_OK!=poMessage->FindString("bf_cText1",(const char**)&pcText1)) pcText1 = NULL;
1100         ASSERT(B_OK==poMessage->FindPointer("bf_focus",(void**)&poView) && poView);
1101         ASSERT(B_OK==poMessage->FindPointer("bf_menu",(void**)&ploMenuItem));
1102         
1103         int32 iResult = BF_Dialog_Alert(pcTitle,pcText,ploMenuItem,pcText1);            
1104                 
1105         BMessage        oFinalMessage(poMessage->what); 
1106         BMessenger      oMessenger(poView);     
1107         DELETE(poMessage);
1108                 
1109         oFinalMessage.AddInt32("menu",iResult);
1110         oMessenger.SendMessage(&oFinalMessage);         
1111 
1112         return 0;
1113 }
1114 
1115 void
1116 BF_Dialog_Alert_Sep_Error(status_t uRes,BView *po_ViewOwner)    /* [previous][next][first][last][top][bottom][index][help] */
1117 {
1118         BL_String s;
1119         BL_System_TranslError(uRes,s);  
1120         BF_Dialog_Alert_Sep("Error",s.String(),NULL,po_ViewOwner);
1121 }
1122 
1123 void
1124 BF_Dialog_Alert_Sep(    /* [previous][next][first][last][top][bottom][index][help] */
1125         const char *pc_Title,
1126         const char *pc_Text,
1127         BL_List *plo_MenuItem,  
1128         BView *po_ViewOwner,
1129         const char *pc_Text1,
1130         int32   i_MessageWhat)
1131 {
1132         ASSERT(po_ViewOwner);
1133         
1134         BF_GUI_Func_PanelsEnable(false);        
1135         /* prepare message */
1136         BMessage *poMessage = new BMessage(i_MessageWhat);
1137         poMessage->AddString("bf_cTitle",pc_Title);     
1138         poMessage->AddString("bf_cText",pc_Text);               
1139         poMessage->AddPointer("bf_focus",po_ViewOwner);
1140         poMessage->AddPointer("bf_menu",plo_MenuItem);
1141         if(pc_Text1)    poMessage->AddString("bf_cText1",pc_Text1);     
1142         
1143         
1144         /* init thread */
1145         thread_id idThread = 
1146                 spawn_thread(BF_Dialog_Alert_Sep_Thread,"BeFar:AlertWindow_Thread",
1147                         B_THREAD_SUSPENDED,(void*)poMessage);   
1148         /* start thread */
1149         ASSERT(idThread>0,"can`t BeFar:AlertWindow_Thread\n");
1150         ASSERT(B_OK==resume_thread(idThread));                                          

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