This source file includes following definitions.
- Draw
- UpdateFont
- MakeFocus
- Save
- AttachedToWindow
- Invoke
- Draw
- MouseDown
- DrawCursor
- Draw
- Invoke
- Draw
- MessageReceived
- Insert_MainStyle_Check
- InvokeMenu
- Invoke_ColorsSetup
- Invoke_FlagsSetup
- BF_GUI_SetupDialog_Run
1
2
3
4
5
6
7
8
9
10
11
12 #include <Mime.h>
13 #include <stdio.h>
14 #include "BF_Dict.h"
15 #include "BF_GUI_SetupDialog.h"
16 #include "BF_GUI_Func.h"
17 #include "BF_GUI_WinMain.h"
18
19
20 BF_GUI_FontView::BF_GUI_FontView(
21 BRect &o_Rect,
22 int i_FollowMode
23 ):BF_GUI_DialogView(o_Rect,"test",i_FollowMode,B_WILL_DRAW)
24 {
25 SetViewColor(B_TRANSPARENT_COLOR);
26 oFont = poSysSetup->oFontToolView;
27 SetFont(&oFont.oFont);
28 }
29
30 void
31 BF_GUI_FontView::Draw(BRect o_Rect)
32 {
33
34 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
35 FillRect(Bounds());
36
37 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BUTTON_TEXT));
38 SetLowColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
39 DrawString("Test !",BPoint(0,oFont.fAscent));
40 }
41
42 void
43 BF_GUI_FontView::UpdateFont()
44 {
45 if(!Parent()) return;
46 BF_GUI_DlgView_VMenu *poStyles = (BF_GUI_DlgView_VMenu*)Parent()->FindView("styles");
47 BF_GUI_DlgView_VMenu *poFamilies = (BF_GUI_DlgView_VMenu*)Parent()->FindView("families");
48 BF_GUI_ViewEdit *poSize = (BF_GUI_ViewEdit*)Parent()->FindView("size");
49 ASSERT(poStyles && poFamilies && poSize,"BF_GUI_FontView::UpdateFont()");
50
51 BF_GUI_ViewMenu_Item *poFamily = poFamilies->FocusItem();
52
53
54 oFont.Set(poFamily->sTitle.String(),B_BOLD_FACE,B_FORCE_ANTIALIASING,poSize->sValue.Float());
55 SetFont(&oFont.oFont);
56
57 Draw(Bounds());
58 }
59
60
61 BF_GUI_SetupDialog_FontFamilyItem::BF_GUI_SetupDialog_FontFamilyItem(
62 const char *pc_Title,BL_List *plo_StyleItem
63 ):BF_GUI_ViewMenu_Item(pc_Title,pc_Title)
64 {
65 ASSERT(plo_StyleItem,"BF_GUI_SetupDialog_FontFamilyItem::BF_GUI_SetupDialog_FontFamilyItem");
66 ploStyleItem = plo_StyleItem;
67 }
68
69 BF_GUI_SetupDialog_FontFamilyItem::~BF_GUI_SetupDialog_FontFamilyItem()
70 {
71 DELETE(ploStyleItem);
72 }
73
74 void
75 BF_GUI_SetupDialog_FontFamilyItem::MakeFocus(BF_GUI_DlgView_Menu *po_Parent)
76 {
77 BF_GUI_ViewMenu_Item::MakeFocus(po_Parent);
78 if(!po_Parent->Parent() || !ploStyleItem) return;
79
80 BF_GUI_DlgView_VMenu *poStyles = (BF_GUI_DlgView_VMenu*)po_Parent->Parent()->FindView("styles");
81 if(!poStyles) return;
82
83 BL_List *ploStyle=new BL_List();
84 for(int i=0;i<ploStyleItem->CountItems();i++) ploStyle->AddItem(new BF_GUI_ViewMenu_Item( (BF_GUI_ViewMenu_Item*) ploStyleItem->ItemAt(i) ));
85
86 poStyles->SetList(ploStyle);
87 poStyles->Draw(poStyles->Bounds());
88
89 BF_GUI_FontView *poTest = (BF_GUI_FontView*)po_Parent->Parent()->FindView("test");
90 if(!poTest) return;
91 poTest->UpdateFont();
92 }
93
94
95 BF_GUI_SetupDialog_FontItem::BF_GUI_SetupDialog_FontItem(
96 const char *pc_Title,
97 const char *pc_Code,
98 BF_GUI_Setup_Font *po_Font,
99 BBitmap *po_SIcon
100 ):BF_GUI_ViewMenu_Item(pc_Title,pc_Code,po_SIcon)
101 {
102 ASSERT(po_Font,"BF_GUI_SetupDialog_FontItem::BF_GUI_SetupDialog_FontItem");
103 poFont = po_Font;
104 }
105
106 BF_GUI_SetupDialog_FontDialog::BF_GUI_SetupDialog_FontDialog(
107 BF_GUI_SetupDialog_FontItem *po_FontItem,
108 const BRect & o_Rect,
109 const char *pc_Title,
110 const char *pc_Name,
111 const BMessage &o_Message,
112 uint32 i_WinResizeType,
113 bool b_DoubleBorder
114 ):BF_GUI_Dialog(o_Rect,pc_Title,pc_Name,o_Message,i_WinResizeType,b_DoubleBorder)
115 {
116 ASSERT(po_FontItem,"BF_GUI_SetupDialog_FontDialog::BF_GUI_SetupDialog_FontDialog");
117 poFontItem = po_FontItem;
118 }
119
120 void
121 BF_GUI_SetupDialog_FontDialog::Save(BMessage& o_Message)
122 {
123 BF_GUI_Dialog::Save(o_Message);
124
125
126 int32 iIndex;
127 ASSERT(B_OK==o_Message.FindInt32("styles",&iIndex));
128
129 const char *pcStyle=NULL;
130 ASSERT(B_OK==o_Message.FindString("styles_code",&pcStyle));
131 const char *pcFamily=NULL;
132 ASSERT(B_OK==o_Message.FindString("families_code",&pcFamily));
133 const char *pcSize=NULL;
134 ASSERT(B_OK==o_Message.FindString("size",&pcSize) && pcSize);
135 bool bAntialising=false;
136 ASSERT(B_OK==o_Message.FindBool("anti_aliasing",&bAntialising));
137
138 BL_String s(pcSize);
139 float fSize = s.Float();
140
141 int32 iStyles=0;
142 s = pcStyle;
143 if(s.FindFirst("Bold")>=0) iStyles = iStyles | B_BOLD_FACE;
144 if(s.FindFirst("Regular")>=0) iStyles = iStyles | B_REGULAR_FACE;
145 if(s.FindFirst("Italic")>=0) iStyles = iStyles | B_ITALIC_FACE;
146
147 int32 iFlags = 0;
148 if(bAntialising)
149 iFlags = iFlags | B_FORCE_ANTIALIASING;
150 else
151 iFlags = iFlags | B_DISABLE_ANTIALIASING;
152
153 poFontItem->poFont->Set(pcFamily,iStyles,iFlags,fSize);
154 }
155
156 void
157 BF_GUI_SetupDialog_FontDialog::AttachedToWindow(void)
158 {
159 BF_GUI_Dialog::AttachedToWindow();
160
161 BF_GUI_DlgView_Menu *poMenu = (BF_GUI_DlgView_Menu*)FindView("families");
162 if(!poMenu) return;
163
164 BF_GUI_SetupDialog_FontFamilyItem *poItem =NULL;
165 poItem = (BF_GUI_SetupDialog_FontFamilyItem*)poMenu->ItemByTitle(poFontItem->poFont->sName.String());
166 if(poItem){
167 poMenu->NavChangeCursor(poMenu->ploMenu->IndexOf(poItem),BF_GUI_TOOLMENU_MOVE_POS,false);
168 }else{
169 poItem = (BF_GUI_SetupDialog_FontFamilyItem*)poMenu->ItemAt(0);
170 if(!poItem) return;
171 }
172 }
173
174 bool
175 BF_GUI_SetupDialog_FontItem::Invoke(BF_GUI_DlgView_Menu *po_Parent)
176 {
177 BF_GUI_Func_EnableDialog( po_Parent->Parent()->Name(),false );
178
179 BMessage oMessage(BF_MSG_DIALOG_FOCUS);
180 oMessage.AddPointer("bf_focus",po_Parent->Parent());
181
182 printf("BF_GUI_SetupDialog_FontItem::Invoke this=%i\n",this);
183 BF_GUI_SetupDialog_FontDialog *poDialog = new BF_GUI_SetupDialog_FontDialog(this,BRect(0,0,440,0),
184 sTitle.String(),"color_dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER,true);
185
186 BRect oRect;
187
188
189 BL_List *poList = new BL_List();
190 int32 iCountFam = count_font_families();
191 for(int32 iFam=0;iFam<iCountFam;iFam++){
192 font_family uFam;
193 uint32 iFlags;
194 if( B_OK != get_font_family(iFam,&uFam,&iFlags)) continue;
195
196
197 BL_List *plsStyle = new BL_List();
198 int32 iCountStyles = count_font_styles(uFam);
199 for(int iStyle=0;iStyle<iCountStyles;iStyle++){
200 font_style uStyle;
201 if(B_OK != get_font_style(uFam,iStyle,&uStyle,&iFlags)) continue;
202 plsStyle->AddItem( new BF_GUI_ViewMenu_Item(uStyle,uStyle));
203 }
204
205 BF_GUI_SetupDialog_FontFamilyItem *poItem = new BF_GUI_SetupDialog_FontFamilyItem(uFam,plsStyle);
206 poList->AddItem(poItem);
207 }
208 poDialog->LocalBounds(oRect);
209 oRect.bottom = oRect.top + 300;
210 oRect.right = oRect.left + 200;
211 poDialog->AddChild( new BF_GUI_DlgView_VMenu(oRect,"families",B_FOLLOW_ALL,poList,BF_GUI_DLGVIEW_VMENU_NAV_PARENTINFORM) );
212
213
214 poDialog->LocalBounds(oRect);
215 oRect.bottom = oRect.top + 300;
216 oRect.left += 210;
217 poDialog->AddChild( new BF_GUI_DlgView_VMenu(oRect,"styles",B_FOLLOW_ALL,new BL_List(),BF_GUI_DLGVIEW_VMENU_NAV_PARENTINFORM) );
218
219
220 {
221 poDialog->LocalBounds(oRect);
222 oRect.top += 310;
223 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight*2;
224 oRect.right = oRect.left + 140;
225 BF_GUI_ViewCheck *poCheck = new BF_GUI_ViewCheck(oRect,"anti_aliasing",BF_DictAt(BF_DICT_FONTSETUP_ANTI)
226 ,poFont->iFlags & B_FORCE_ANTIALIASING
227 ,B_FOLLOW_LEFT|B_FOLLOW_TOP,B_WILL_DRAW|B_NAVIGABLE);
228 poDialog->AddChild(poCheck);
229 }
230
231
232
233 poDialog->LocalBounds(oRect);
234 oRect.top += 310;
235 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight*3;
236 oRect.left += 160;
237 poDialog->AddChild( new BF_GUI_FontView(oRect,B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM) );
238
239
240 poDialog->LocalBounds(oRect);
241 oRect.top += 310+poSysSetup->oFontToolView.fHeight*2;
242 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
243 oRect.right = oRect.left + 150;
244 BL_String s;
245 s<<poFont->fSize;
246 BF_GUI_ViewEdit_Create(oRect,BF_DictAt(BF_DICT_SIZE),poDialog,"size",s.String()
247 ,B_FOLLOW_LEFT|B_FOLLOW_BOTTOM,B_NAVIGABLE);
248
249
250
251 BRect oRect1;
252 poDialog->LocalBounds(oRect1);
253 oRect.left = oRect1.left;
254 oRect.right = oRect1.right;
255 oRect.top = oRect.bottom+10;
256 oRect.bottom = oRect.top + poSysSetup->oFontToolView.fHeight;
257 BL_List *ploMenu = new BL_List();
258 ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
259 poDialog->AddMenu(oRect,ploMenu,true);
260
261
262 poDialog->SetHeightFromLastChild();
263 poDialog->MoveToCenter( poWinView );
264 BF_GUI_Func_AddChildToMainView( poDialog );
265
266 return true;
267 }
268
269
270
271 BF_GUI_ColorsView::BF_GUI_ColorsView(BRect &o_Rect,
272 int i_FollowMode,
273 rgb_color *pu_Color)
274 :BF_GUI_DialogView(o_Rect,"color_rgb",i_FollowMode,B_WILL_DRAW)
275 {
276 puColor = pu_Color;
277 SetViewColor(B_TRANSPARENT_COLOR);
278 }
279
280 void
281 BF_GUI_ColorsView::Draw(BRect o_Rect)
282 {
283
284 SetHighColor(*puColor);
285 BRect oRect(Bounds());
286 FillRect(oRect);
287 }
288
289
290 BF_GUI_ColorView::BF_GUI_ColorView(
291 BRect & o_Rect,
292 int32 i_FollowMode,
293 uint8 *pi_Color,
294 int8 i_ColorIndex,
295 BF_GUI_ColorsView *po_Unit
296 ):BF_GUI_DialogView(o_Rect,"colors",i_FollowMode,B_WILL_DRAW|B_NAVIGABLE)
297 {
298 ASSERT(po_Unit,"BF_GUI_ColorView::BF_GUI_ColorView");
299 poUnit = po_Unit;
300 piColor = pi_Color;
301 iColorIndex = i_ColorIndex;
302 SetFont(&poSysSetup->oFontToolView.oFont);
303 SetViewColor(B_TRANSPARENT_COLOR);
304 }
305
306 void
307 BF_GUI_ColorView::MouseDown(BPoint point)
308 {
309 if(point.x>255) return;
310 DrawCursor(false);
311 *piColor = (uint8)point.x;
312 DrawCursor(true);
313
314 poUnit->Draw(poUnit->Bounds());
315 }
316
317 void
318 BF_GUI_ColorView::DrawCursor(bool b_Show)
319 {
320
321 if(b_Show)
322 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_TEXT));
323 else
324 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
325
326 BPoint o1(*piColor-1,1),o2;
327 o2.Set(o1.x+3,1);
328 StrokeLine(o1,o2);
329 o1.x++;
330 o1.y++;
331 StrokeLine(o1,o2);
332
333 o1.Set(*piColor-1,Bounds().Height()-1);
334 o2.Set(o1.x+2,o1.y);
335 StrokeLine(o1,o2);
336 o1.x++;
337 o1.y--;
338 StrokeLine(o1,o2);
339
340 if(b_Show){
341
342 BRect oRect(Bounds());
343 oRect.left+=259;
344 oRect.top+=3;
345 oRect.bottom-=3;
346 rgb_color oCol={0,0,0};
347 if(iColorIndex==0) oCol.red = *piColor;else
348 if(iColorIndex==1) oCol.green = *piColor;else
349 if(iColorIndex==2) oCol.blue = *piColor;
350
351 SetHighColor(oCol);
352 FillRect(oRect);
353 }
354 }
355
356 void
357 BF_GUI_ColorView::Draw(BRect o_Rect)
358 {
359
360 SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
361 BRect oRect(Bounds());
362 FillRect(oRect);
363
364
365 BPoint oPointTop(0,4),oPointBottom(0,oRect.Height()-4);
366 rgb_color oCol;
367 RGB_SET(oCol,0,0,0);
368 for(int32 i=0;i<256;i++){
369 SetHighColor(oCol);
370
371 StrokeLine(oPointTop,oPointBottom);
372
373 oPointTop.x++;
374 oPointBottom.x++;
375
376 if(iColorIndex==0) oCol.red++;else
377 if(iColorIndex==1) oCol.green++;else
378 if(iColorIndex==2) oCol.blue++;
379 }
380 DrawCursor(true);
381 }
382
383
384
385 BF_GUI_SetupDialog_ColorItem::BF_GUI_SetupDialog_ColorItem(
386 const char *pc_Title,
387 const char *pc_Code,
388 rgb_color *pu_Color
389 ):BF_GUI_ViewMenu_Item(pc_Title,pc_Code)
390 {
391 puColor = pu_Color;
392 }
393
394 bool
395 BF_GUI_SetupDialog_ColorItem::Invoke(BF_GUI_DlgView_Menu *po_Parent)
396 {
397
398 BF_GUI_Func_EnableDialog( po_Parent->Parent()->Name(),false );
399
400 BMessage oMessage(BF_MSG_DIALOG_FOCUS);
401 oMessage.AddPointer("bf_focus",po_Parent->Parent());
402
403 BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(BRect(0,0,400,0),
404 sTitle.String(),"color_dialog",oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);
405
406 BRect oRect;
407
408 poDialog->LocalBounds(oRect);
409 oRect.left = oRect.right - 40;
410 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight*6+5*2;
411 BF_GUI_ColorsView *poUnit = new BF_GUI_ColorsView(oRect,B_FOLLOW_RIGHT|B_FOLLOW_TOP,puColor);
412 poDialog->AddChild(poUnit);
413
414 poDialog->LocalBounds(oRect);
415 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight*2;
416 oRect.right-=50;
417 poDialog->AddChild(new BF_GUI_ColorView(oRect,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,&puColor->red,0,poUnit));
418 oRect.top = oRect.bottom+5;
419 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight*2;
420 poDialog->AddChild(new BF_GUI_ColorView(oRect,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,&puColor->green,1,poUnit));
421 oRect.top = oRect.bottom+5;
422 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight*2;
423 poDialog->AddChild(new BF_GUI_ColorView(oRect,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,&puColor->blue,2,poUnit));
424
425
426 BRect oRect1;
427 poDialog->LocalBounds(oRect1);
428 oRect.right = oRect1.right;
429 poDialog->AddOkCancelMenu(oRect);
430
431 poDialog->SetHeightFromLastChild();
432 poDialog->MoveToCenter( poWinView );
433 BF_GUI_Func_AddChildToMainView ( poDialog );
434
435 return true;
436 }
437
438 void
439 BF_GUI_SetupDialog_ColorItem::Draw(BF_GUI_DlgView_Menu *po_Parent,BView *po_Render,float f_PosY)
440 {
441 BF_GUI_ViewMenu_Item::Draw(po_Parent,po_Render,f_PosY);
442 ASSERT(po_Render,"BF_GUI_SetupDialog_ColorItem::Draw");
443
444
445 BRect oRect(po_Render->Bounds());
446 oRect.top += f_PosY+3;
447 oRect.bottom = oRect.top + po_Parent->Height()-6;
448
449 oRect.left = oRect.right-50;
450 po_Render->SetHighColor(*puColor);
451 po_Render->FillRect(oRect);
452
453
454 if(!poSIcon){
455 rgb_color oCol;
456 BRect oRect(po_Render->Bounds());
457 oRect.left+=10;
458 oRect.top += f_PosY+3;
459 oRect.bottom = oRect.top + po_Parent->Height()-6;
460
461 RGB_SET(oCol,255,0,0);
462 oRect.left+=2;
463 oRect.right = oRect.left+3;
464 po_Render->SetHighColor(oCol);
465 po_Render->FillRect(oRect);
466
467 RGB_SET(oCol,0,255,0);
468 oRect.left+=2;
469 oRect.right = oRect.left+3;
470 po_Render->SetHighColor(oCol);
471 po_Render->FillRect(oRect);
472
473 RGB_SET(oCol,0,0,255);
474 oRect.left+=2;
475 oRect.right = oRect.left+3;
476 po_Render->SetHighColor(oCol);
477 po_Render->FillRect(oRect);
478
479 }
480 }
481
482
483 BF_GUI_SetupDialog::BF_GUI_SetupDialog(BRect & o_Rect,BView *po_View)
484 :BF_GUI_Dialog(o_Rect,BF_DictAt(BF_DICT_MAINSETUP),"",BMessage(),BG_GUI_DIALOG_WINRESIZE_RESIZE_ALL)
485 {
486 poSysSetup->CopyTo(oSetup);
487
488 oMessage.what = BF_MSG_MAINVIEW_MAINSETUP_CLOSE;
489 oMessage.AddPointer("bf_focus",po_View);
490
491 BL_List *ploLeftList = new BL_List();
492 ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP_COLSFONTS),"colors_fonts"));
493 ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP),"flags_main"));
494 ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP_FILES),"filetasks_copy"));
495 ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP_DEBUG),"flags_debug"));
496
497 BRect oRect;
498 LocalBounds(oRect);
499 oRect.bottom -= oSetup.oFontToolView.fHeight*2;
500 poMenu = new BF_GUI_DlgView_VMenu(oRect,"main_menu",
501 B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM,ploLeftList,0);
502 AddChild(poMenu);
503
504
505 LocalBounds(oRect);
506 oRect.top = oRect.bottom - oSetup.oFontToolView.fHeight;
507 BL_List *ploMenu = new BL_List();
508 ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
509 AddMenu(oRect,ploMenu,true);
510
511
512 poFontSIcon = BL_Load_SIconFromMIME(BL_MIME_FONT);
513 }
514
515 BF_GUI_SetupDialog::~BF_GUI_SetupDialog()
516 {
517 if(poFontSIcon) DELETE(poFontSIcon);
518 }
519
520 void
521 BF_GUI_SetupDialog::MessageReceived(BMessage* po_Message)
522 {
523 switch(po_Message->what){
524 case BF_MSG_MAINVIEW_MAINSETUP_STYLES_UPDATED:{
525 EnableDialog(true);
526 poMenu->MakeFocus();
527
528 int32 iMenuRes=-1;
529 if(B_OK==po_Message->FindInt32("menu",&iMenuRes)) oSetup.SetMainStyle(iSetupMainStyle);
530
531 break;}
532 case BF_MSG_MAINVIEW_MAINSETUP_0:{
533 EnableDialog(true);
534 poMenu->MakeFocus();
535 break;}
536 case BF_MSG_DIALOG_PRESSED_OK:{
537 BView *po;
538 const char *pc;
539 ASSERT(B_OK==po_Message->FindPointer("bf_DlgView_Focus",(void**)&po),"BF_GUI_SetupDialog::MessageReceived");
540 pc = po->Name();
541 if(strcmp(pc,"main_menu")==0){
542 InvokeMenu(-1,poMenu->iNavCursorIndex);
543 }else{
544
545 poSysSetup->UpdateFrom(oSetup);
546 if(poSysSetup->MainStyle() & BF_SETUP_AUTOSAVE) poSysSetup->Save();
547
548 BF_GUI_Dialog::MessageReceived(po_Message);
549
550 BMessenger oMessenger(poWin);
551 BMessage oMessage(BF_MSG_SETUP_UPDATED);
552 oMessenger.SendMessage(&oMessage);
553 }
554 break;}
555 default:
556 BF_GUI_Dialog::MessageReceived(po_Message);
557 };
558 }
559
560 void
561 BF_GUI_SetupDialog::Insert_MainStyle_Check(const char *pc_Title,int i_Style,BRect & o_Rect,BView *po_Dialog,bool b_FirstView)
562 {
563 if(!b_FirstView){
564 o_Rect.top = o_Rect.bottom+5;
565 o_Rect.bottom = o_Rect.top+poSysSetup->oFontToolView.fHeight;
566 }else{
567 o_Rect.bottom = o_Rect.top+poSysSetup->oFontToolView.fHeight;
568 }
569 BF_GUI_ViewCheck_Style *poCheck = new BF_GUI_ViewCheck_Style(o_Rect,pc_Title,pc_Title,
570 &iSetupMainStyle,i_Style,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_NAVIGABLE);
571 po_Dialog->AddChild(poCheck);
572 }
573
574
575 void
576 BF_GUI_SetupDialog::InvokeMenu(int32 i_OldCursor,int32 i_NewCursor)
577 {
578 switch(i_NewCursor){
579 case 0:{
580 Invoke_ColorsSetup();
581 break;}
582 case 1:{
583 Invoke_FlagsSetup(BF_GUI_SETUPDIALOG_FLAGS_MAIN);
584 break;}
585 case 2:{
586 Invoke_FlagsSetup(BF_GUI_SETUPDIALOG_FLAGS_FILETASKS);
587 break;}
588 case 3:{
589 Invoke_FlagsSetup(BF_GUI_SETUPDIALOG_FLAGS_DEBUG);
590 break;}
591 }
592
593
594
595
596
597
598
599
600 }
601
602 void
603 BF_GUI_SetupDialog::Invoke_ColorsSetup()
604 {
605 EnableDialog(false);
606
607 BMessage oMessage(BF_MSG_MAINVIEW_MAINSETUP_0);
608 oMessage.AddPointer("bf_focus",this);
609
610 BRect oRect(poWinView->Bounds());
611 oRect.left=0;
612 oRect.right=400;
613 oRect.top+=70;
614 oRect.bottom-=70;
615
616 BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(oRect,BF_DictAt(BF_DICT_MAINSETUP_COLSFONTS),"colors_dialog"
617 ,oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);
618
619
620 BL_List *ploItem = new BL_List();
621 for(int iColor=0;iColor<BF_COLOR_END;iColor++){
622 ploItem->AddItem(new BF_GUI_SetupDialog_ColorItem(
623 BF_DictAt(poSysSetup->aoColor[iColor].iDictCode),"",&oSetup.aoColor[iColor].rgb));
624 }
625
626 ploItem->AddItem(new BF_GUI_ViewMenu_Item("",""));
627
628 ploItem->AddItem(new BF_GUI_SetupDialog_FontItem(BF_DictAt(BF_DICT_FONTSETUP_FONTPANEL),"back",&oSetup.oFontNode,poFontSIcon?new BBitmap(poFontSIcon):NULL));
629 ploItem->AddItem(new BF_GUI_SetupDialog_FontItem(BF_DictAt(BF_DICT_FONTSETUP_FONTDIALOG),"frame",&oSetup.oFontToolView,poFontSIcon?new BBitmap(poFontSIcon):NULL));
630 ploItem->AddItem(new BF_GUI_SetupDialog_FontItem(BF_DictAt(BF_DICT_FONTSETUP_FONTMONO),"dir",&oSetup.oFontMono,poFontSIcon?new BBitmap(poFontSIcon):NULL));
631 ploItem->AddItem(new BF_GUI_SetupDialog_FontItem(BF_DictAt(BF_DICT_FONTSETUP_FONTCOMMAND),"dir",&oSetup.oFontCMDLine,poFontSIcon?new BBitmap(poFontSIcon):NULL));
632
633 poDialog->LocalBounds(oRect);
634 oRect.bottom -= +oSetup.oFontToolView.fHeight*2;
635
636
637 BF_GUI_DlgView_VMenu* poColorsMenu = new BF_GUI_DlgView_VMenu(oRect,"colors_menu",
638 B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP_BOTTOM,ploItem,BF_GUI_DLGVIEW_VMENU_SICON|BF_GUI_DLGVIEW_VMENU_SET_VSCROLLBAR);
639 poDialog->AddChild(poColorsMenu);
640
641
642 BL_List *ploMenu = new BL_List();
643 ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
644 poDialog->AddMenu(oRect,ploMenu);
645
646
647
648
649
650
651
652
653
654
655
656 poDialog->MoveToCenter( poWinView );
657 BF_GUI_Func_AddChildToMainView ( poDialog );
658 }
659
660 void
661 BF_GUI_SetupDialog::Invoke_FlagsSetup(int i_Type)
662 {
663 iSetupMainStyle = oSetup.MainStyle();
664
665 EnableDialog(false);
666
667 BMessage oMessage(BF_MSG_MAINVIEW_MAINSETUP_STYLES_UPDATED);
668 oMessage.AddPointer("bf_focus",this);
669
670 BRect oRect(poWinView->Bounds());
671 oRect.left=0;
672 oRect.right=350;
673 oRect.top+=30;
674 oRect.bottom-=30;
675
676 BF_GUI_Dialog *poDialog = new BF_GUI_Dialog(oRect,BF_DictAt(BF_DICT_FONTSETUP_FLAGS),"flags_dialog",
677 oMessage,BG_GUI_DIALOG_WINRESIZE_MOVE_CENTER);
678
679
680 poDialog->LocalBounds(oRect);
681 oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
682
683 switch(i_Type){
684 case BF_GUI_SETUPDIALOG_FLAGS_MAIN:{
685 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_ASKEXIT),BF_SETUP_MAIN_ASK_EXIT,oRect,poDialog,true);
686 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_VOLSHOWHOME),BF_SETUP_MAIN_SELECTVOL_SHOWSPEC,oRect,poDialog,false);
687 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_VOLSTACK),BF_SETUP_MAIN_SELECTVOL_SHOWSTACK,oRect,poDialog,false);
688 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_VOLICONS),BF_SETUP_MAIN_SELECTVOL_SHOWSICON,oRect,poDialog,false);
689 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_PATHICON),BF_SETUP_MAIN_FP_HEADERICON,oRect,poDialog,false);
690 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_PANBACK),BF_SETUP_NODEPANEL_USE_BACKSPACE,oRect,poDialog,false);
691 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_PANRET),BF_SETUP_MAIN_RETURN_REMEMBER,oRect,poDialog,false);
692 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_CMDPATH),BF_SETUP_CMDLINE_SHOWPATH,oRect,poDialog,false);
693 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_TRACKADDICONS),BF_SETUP_FILESPANEL_TRACKERADDONS_SHOWICONS,oRect,poDialog,false);
694 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_SEARCHVOLICONS),BF_SETUP_SEARCH_SETUP_VOLICONS,oRect,poDialog,false);
695 Insert_MainStyle_Check(BF_DictAt(BF_DICT_MAINSETUP_AUTOSAVE),BF_SETUP_AUTOSAVE,oRect,poDialog,false);
696 break;}
697 case BF_GUI_SETUPDIALOG_FLAGS_FILETASKS:{
698 Insert_MainStyle_Check(BF_DictAt(BF_DICT_SETUPFILES_SHOWDLG),BF_SETUP_OPERROSTER_DEFDIALOG,oRect,poDialog,true);
699 Insert_MainStyle_Check(BF_DictAt(BF_DICT_SETUPFILES_COPYDES),BF_SETUP_NODEPANEL_DESELECT_AFTER_COPY,oRect,poDialog,false);
700 Insert_MainStyle_Check(BF_DictAt(BF_DICT_SETUPFILES_MOVEDES),BF_SETUP_NODEPANEL_DESELECT_AFTER_MOVE,oRect,poDialog,false);
701 Insert_MainStyle_Check(BF_DictAt(BF_DICT_SETUPFILES_ASKDEL),BF_SETUP_MAIN_ASK_DELETE,oRect,poDialog,false);
702 Insert_MainStyle_Check(BF_DictAt(BF_DICT_SETUPFILES_ASKCOPY),BF_SETUP_MAIN_ASK_COPY,oRect,poDialog,false);
703 break;}
704 case BF_GUI_SETUPDIALOG_FLAGS_DEBUG:{
705 Insert_MainStyle_Check("Debug : disable node_monitoring",BF_SETUP_DEB_NOMONITORING,oRect,poDialog,true);
706 Insert_MainStyle_Check("Debug : disable filelist_sorting",BF_SETUP_DEB_NOSORTING,oRect,poDialog,false);
707 break;}
708 }
709
710 BL_List *ploMenu = new BL_List();
711 ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
712 poDialog->AddMenu(oRect,ploMenu);
713
714
715
716 poDialog->MoveToCenter( poWinView );
717 BF_GUI_Func_AddChildToMainView ( poDialog );
718 }
719
720 void
721 BF_GUI_SetupDialog_Run(BView *po_View)
722 {
723
724 BF_GUI_Func_PanelsEnable(false);
725
726 BRect oRect(poWinView->Bounds());
727 oRect.left=0;
728 oRect.right=200;
729 oRect.top+=40;
730 oRect.bottom-=40;
731
732 BF_GUI_SetupDialog *poDialog = new BF_GUI_SetupDialog(oRect,po_View);
733
734
735 poDialog->MoveToCenter( poWinView );
736 BF_GUI_Func_AddChildToMainView ( poDialog );