00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #include "camtypes.h"
00100
00101
00102
00103 #include "camframe.h"
00104
00105
00106 #include "basebar.h"
00107
00108 #define IS_CHICAGO ((LOBYTE(LOWORD(GetVersion()))) > 3)
00109
00110 #define MIN_GALLERY_SLOT_WIDTH 100
00111
00112 BOOL OILFixedDockingBar::allowTidyBars = TRUE;
00113
00114 #if 0
00115
00117
00119
00120 IMPLEMENT_DYNAMIC(OILDockingBar ,CControlBar)
00121
00122 #ifdef _DEBUG
00123 #undef THIS_FILE
00124 static char BASED_CODE THIS_FILE[] = __FILE__;
00125 #endif
00126
00127
00128
00129
00130
00131 OILDockingBar * OILDockingBar::ChangedDock=NULL;
00132
00133
00134 BOOL OILDockingBar::DoRecalc = FALSE;
00135
00137
00139
00140 BEGIN_MESSAGE_MAP( OILDockingBar,CControlBar)
00141
00142
00143 END_MESSAGE_MAP( )
00144
00145
00147
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 OILDockingBar::OILDockingBar()
00166 {
00167 ControlSize=SMALL_CONTROLS;
00168 HasBigControls = FALSE;
00169 }
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186 OILDockingBar::~OILDockingBar()
00187 {
00188 ChildBars.DeleteAll();
00189 }
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 void OILDockingBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
00207 {
00208
00209 }
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 BOOL OILDockingBar::RemoveBar(OILChildBar* ThisBar)
00228 {
00229 ERROR2IF(ThisBar ==NULL,FALSE,"Trying to remove a NULL Child Bar");
00230
00231 if (ChildBars.RemoveItem((ListItem*)ThisBar)!=NULL)
00232 {
00233
00234 delete ThisBar;
00235 return TRUE;
00236
00237 }
00238 else
00239 {
00240 ERROR2IF(TRUE,FALSE,"Failed to Remove Child Bar from list");
00241 }
00242 }
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259 BOOL OILDockingBar::SetNewHwnd(HWND OldHwnd,HWND NewHwnd)
00260 {
00261 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
00262 while (ThisChild != NULL)
00263 {
00264
00265 if (ThisChild->GetHwnd()==OldHwnd)
00266 {
00267 ThisChild->SetHwnd(NewHwnd);
00268 return TRUE;
00269 }
00270 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
00271
00272 }
00273 ENSURE(ThisChild!=NULL,"Couldn't find HWND in BarList");
00274 return FALSE;
00275 }
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 OILChildBar * OILDockingBar::IsBarInList(HWND hwnd)
00294 {
00295 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
00296 while (ThisChild != NULL)
00297 {
00298
00299 if (ThisChild->GetHwnd()==hwnd)
00300 return ThisChild;
00301
00302 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
00303
00304 }
00305
00306 return NULL;
00307 }
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324 OILChildBar * OILDockingBar::IsBarInList(StringBase *Name)
00325 {
00326 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
00327 while (ThisChild != NULL)
00328 {
00329 char buff[64];
00330 ::GetWindowText(ThisChild->GetHwnd(),buff,63);
00331 if (String_32(buff)== *Name)
00332 return ThisChild;
00333
00334 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
00335
00336 }
00337
00338 return NULL;
00339 }
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355 HWND OILDockingBar::IsScreenPointInBar(CPoint pnt)
00356 {
00357
00358 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
00359 HWND hwnd;
00360 while (ThisChild != NULL)
00361 {
00362 if (hwnd = ThisChild->GetHwnd())
00363 {
00364 CRect sRect;
00365 ::GetWindowRect(hwnd,&sRect);
00366 if(sRect.PtInRect(pnt))
00367 {
00368 return hwnd;
00369 }
00370 }
00371 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
00372 }
00373
00374 return NULL;
00375 }
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391 KernelBarPos * OILDockingBar::GetBarPos(HWND hwnd)
00392 {
00393 OILChildBar * ThisChild;
00394 if ((ThisChild=IsBarInList(hwnd))!=NULL)
00395
00396 return ThisChild->GetBarPos();
00397 else
00398
00399 return NULL;
00400 }
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418 CRect OILDockingBar::GetBarRect(StringBase * Name)
00419 {
00420 OILChildBar * ThisChild;
00421 if ((ThisChild=IsBarInList(Name))!=NULL)
00422 return ThisChild->GetRectFromBar();
00423 else
00424 return CRect(0, 0, 0, 0);
00425 }
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442 CRect OILDockingBar::GetBarRect(HWND hwnd)
00443 {
00444 OILChildBar * ThisChild;
00445 if ((ThisChild=IsBarInList(hwnd))!=NULL)
00446 return ThisChild->GetRectFromBar();
00447 else
00448 return CRect(0, 0, 0, 0);
00449 }
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467 KernelBarPos * OILDockingBar::GetBarPos(StringBase * Name)
00468 {
00469 OILChildBar * ThisChild;
00470 if ((ThisChild=IsBarInList(Name))!=NULL)
00471
00472 return ThisChild->GetBarPos();
00473 else
00474
00475 return NULL;
00476 }
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493 void OILDockingBar::SetBigControlState(BOOL Big )
00494 {
00495 HasBigControls = Big;
00496 if (Big)
00497 ControlSize=LARGE_CONTROLS;
00498 else
00499 ControlSize=SMALL_CONTROLS;
00500
00501
00502 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
00503 while (ThisChild != NULL)
00504 {
00505 ThisChild->Resize(ControlSize);
00506 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
00507 }
00508
00509 }
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526 BOOL OILDockingBar::IsBigControls()
00527 {
00528
00529 return HasBigControls;
00530 }
00531
00532
00533
00535
00537
00538
00539 IMPLEMENT_DYNAMIC(OILFixedDockingBar ,OILDockingBar)
00540
00541
00542
00543
00544
00546
00547 BEGIN_MESSAGE_MAP( OILFixedDockingBar, OILDockingBar )
00548
00549 ON_MESSAGE(WM_SIZEPARENT, OnSizeParent)
00550
00551 END_MESSAGE_MAP( )
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568 BOOL OILFixedDockingBar::Create(CWnd* pParentWnd,DockBarType ReqType, UINT32 id)
00569 {
00570
00571 BOOL CreatedWindow;
00572 ENSURE(pParentWnd,"DockingBar must have a Parent");
00573
00574 ENSURE((ReqType == DOCKBAR_LEFT) ||
00575 (ReqType == DOCKBAR_RIGHT) ||
00576 (ReqType == DOCKBAR_TOP) ||
00577 (ReqType == DOCKBAR_BOTTOM),
00578 "OILFIxedDockingBar constructor: Invalid DockingBar type");
00579
00580 DockType=ReqType;
00581 Parent=pParentWnd;
00582 CRect rect;
00583 rect.SetRectEmpty();
00584
00585 #if _MSC_VER < 1200
00586 #ifndef WIN32
00587 DWORD
00588 #endif
00589 m_dwStyle = WS_CHILD|WS_VISIBLE |WS_CLIPCHILDREN;
00590 #else
00591
00592
00593 m_dwStyle = 0;
00594 #endif // _MSC_VER
00595
00596
00597 CreatedWindow = CWnd::Create(NULL,
00598 0,
00599 m_dwStyle,
00600 rect,Parent,
00601 id, NULL);
00602
00603
00604 #if _MSC_VER >= 1200
00605
00606 ShowWindow(SW_SHOW);
00607 #endif // _MSC_VER
00608
00609 return CreatedWindow;
00610 }
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629 OILFixedDockingBar::OILFixedDockingBar()
00630 {
00631 NoOfSlots = 0;
00632 ControlSize = SMALL_CONTROLS;
00633 HasBigControls = FALSE;
00634 DockSize.cy = DockSize.cx = 0;
00635 Position.x = Position.y = -1;
00636 allowTidyBars = TRUE;
00637 for (INT32 i = 0; i < MAX_SLOTS; i++)
00638 SlotSize[i] = SMALL_CONTROLS;
00639 }
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656 BOOL OILFixedDockingBar::DeleteBars()
00657 {
00658 NoOfSlots = 0;
00659 for (INT32 i = 0; i < MAX_SLOTS; i++)
00660 SlotSize[i] = ControlSize;
00661 DockSize.cy = DockSize.cx = 0;
00662 Position.x = Position.y = -1;
00663 ChildBars.DeleteAll();
00664 return TRUE;
00665 }
00666
00668
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686 void OILFixedDockingBar::DoPaint(CDC* pDC)
00687 {
00688
00689 ASSERT_VALID(pDC);
00690
00691 CRect rect;
00692 GetClientRect(rect);
00693 CBrush hbrFrame (GetSysColor(COLOR_BTNFACE));
00694
00695
00696 COLORREF Outline;
00697 if(IS_CHICAGO)
00698 Outline = GetSysColor(COLOR_BTNSHADOW);
00699 else
00700 Outline = GetSysColor(COLOR_WINDOWFRAME);
00701
00702 CPen hpen(PS_SOLID,1,Outline);
00703
00704
00705
00706 CBrush * hOldBrush = pDC->SelectObject(&hbrFrame);
00707 CPen * hOldPen = pDC->SelectObject(&hpen);
00708
00709
00710
00711
00712 switch (DockType)
00713 {
00714
00715 case DOCKBAR_LEFT:
00716 pDC->Rectangle(rect.left-1,rect.top-1,rect.right,rect.bottom+1);
00717 break;
00718 case DOCKBAR_TOP:
00719 pDC->Rectangle(rect.left-1,rect.top-1,rect.right+1,rect.bottom);
00720 break;
00721 case DOCKBAR_RIGHT:
00722 pDC->Rectangle(rect.left,rect.top-1,rect.right+1,rect.bottom+1);
00723 break;
00724 case DOCKBAR_BOTTOM:
00725 pDC->Rectangle(rect.left-1,rect.top,rect.right+1,rect.bottom+1);
00726 break;
00727
00728 }
00729
00730 pDC->SelectObject(hOldBrush);
00731 pDC->SelectObject(hOldPen);
00732 }
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752 void OILFixedDockingBar::RepositionWindow(AFX_SIZEPARENTPARAMS FAR* lpLayout,
00753 HWND hWnd, LPCRECT lpRect)
00754 {
00755
00756 if(hWnd == NULL)
00757 {
00758 ENSURE(FALSE,"Reposition NULL Window ");
00759 return ;
00760 }
00761 if(lpRect == NULL)
00762 {
00763 ENSURE(FALSE,"NULL Reposition Rectangle");
00764 return;
00765 }
00766
00767 CRect InvalRect(0,0,0,0);
00768
00769 CRect Check(lpRect);
00770
00771 BOOL Empty = Check.Width() == 0 || Check.Height() == 0;
00772
00773
00774
00775
00776
00777 if (!Empty)
00778 {
00779 CRect rectOld;
00780 GetWindowRect(rectOld);
00781 GetParent()->ClientToScreen(&Check);
00782
00783
00784 if(Check==rectOld)
00785 return ;
00786
00787 switch (DockType)
00788 {
00789 case DOCKBAR_TOP:
00790 if(Check.left == rectOld.left)
00791 {
00792 if (Check.right > rectOld.right )
00793 InvalRect.SetRect(rectOld.right,Check.top,Check.right,Check.bottom);
00794 else if(Check.right < rectOld.right )
00795 InvalRect.SetRect(Check.right,Check.top,rectOld.right,Check.bottom);
00796 else
00797 InvalRect.SetRect(Check.left,Check.top,rectOld.right,Check.bottom);
00798 }
00799 else
00800 {
00801 InvalRect.SetRect(min(rectOld.left,Check.left),
00802 min(rectOld.top,Check.top),
00803 max(rectOld.right,Check.right),
00804 max(rectOld.bottom,Check.bottom));
00805 }
00806 break;
00807 case DOCKBAR_BOTTOM:
00808 if( Check.left != rectOld.left || Check.top != rectOld.top)
00809 InvalRect.SetRect(Check.left,Check.top,Check.right,Check.bottom);
00810 else
00811 InvalRect.SetRect(rectOld.right,Check.top,Check.right,Check.bottom);
00812
00813 break;
00814 case DOCKBAR_LEFT:
00815 if(Check.top == rectOld.top)
00816 {
00817 if (Check.bottom > rectOld.bottom )
00818 InvalRect.SetRect(Check.left,rectOld.bottom,Check.right,Check.bottom);
00819 else
00820 InvalRect.SetRect(Check.left,Check.bottom,Check.right,rectOld.bottom);
00821 }
00822 else
00823 {
00824 InvalRect.SetRect(min(rectOld.left,Check.left),
00825 min(rectOld.top,Check.top),
00826 max(rectOld.right,Check.right),
00827 max(rectOld.bottom,Check.bottom));
00828 }
00829 break;
00830 case DOCKBAR_RIGHT:
00831 if( Check.left != rectOld.left || Check.top != rectOld.top)
00832 InvalRect.SetRect(Check.left,Check.top,Check.right,Check.bottom);
00833 else
00834 InvalRect.SetRect(Check.left,rectOld.bottom,Check.right,Check.bottom);
00835 break;
00836 case DOCKBAR_FLOAT:
00837 InvalRect.SetRect(rectOld.left,rectOld.bottom,rectOld.right,rectOld.bottom);
00838 break;
00839 }
00840 }
00841
00842 SetWindowPos(NULL, lpRect->left,
00843 lpRect->top, lpRect->right - lpRect->left, lpRect->bottom - lpRect->top,
00844 SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW);
00845
00846
00847 if(!Empty)
00848 {
00849
00850
00851 INT32 OldStyle = ::GetWindowLong(hWnd,GWL_STYLE);
00852 ::SetWindowLong(hWnd,GWL_STYLE,OldStyle & ~WS_CLIPCHILDREN);
00853
00854
00855 GetParent()->ScreenToClient(&InvalRect);
00856
00857
00858 GetParent()->InvalidateRect(&InvalRect,FALSE);
00859 GetParent()->UpdateWindow();
00860
00861
00862 ::SetWindowLong(hWnd,GWL_STYLE,OldStyle);
00863 }
00864 }
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882 LRESULT OILFixedDockingBar::OnSizeParent(WPARAM, LPARAM lParam)
00883 {
00884 AFX_SIZEPARENTPARAMS FAR* lpLayout = (AFX_SIZEPARENTPARAMS FAR*)lParam;
00885 CRect rect(0,0,0,0);
00886 CRect LayoutRect(lpLayout->rect);
00887
00888 SetSize(LayoutRect,&rect);
00889
00890 switch (DockType)
00891 {
00892
00893 case DOCKBAR_LEFT:
00894 lpLayout->rect.left += TotalSlotSizes();
00895
00896
00897 break;
00898 case DOCKBAR_RIGHT:
00899 lpLayout->rect.right -= TotalSlotSizes();
00900 break;
00901 case DOCKBAR_TOP:
00902 lpLayout->rect.top += TotalSlotSizes();
00903
00904
00905 break;
00906 case DOCKBAR_BOTTOM:
00907 lpLayout->rect.bottom -= TotalSlotSizes();
00908
00909
00910 break;
00911 default:
00912 ENSURE(0, "Unknown Dockingbar type!");
00913 break;
00914 }
00915
00916
00917
00918 RepositionWindow(lpLayout, m_hWnd, &rect);
00919 return 0;
00920 }
00921
00922
00923
00925
00927
00928
00929 INT32 OILFixedDockingBar::TotalSlotSizes(INT32 Slot )
00930 {
00931 if (Slot == -1)
00932 Slot = NoOfSlots;
00933
00934
00935 INT32 TotalSize = 0;
00936 for (INT32 i = 0; i < Slot; i++)
00937 TotalSize += SlotSize[i];
00938
00939 return(TotalSize);
00940 }
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957 void OILFixedDockingBar::SetBigControlState(BOOL Big )
00958 {
00959
00960 if (Big != HasBigControls )
00961 {
00962 ::LockWindowUpdate(GetMainFrame()->GetSafeHwnd());
00963 HasBigControls = Big;
00964 ControlSizes NewSize;
00965 if (Big)
00966 NewSize = LARGE_CONTROLS;
00967 else
00968 NewSize = SMALL_CONTROLS;
00969
00970
00971
00972 for (INT32 i = 0; i < MAX_SLOTS; i++)
00973 {
00974 if (SlotSize[i] == ControlSize)
00975 SlotSize[i] = NewSize;
00976 }
00977
00978
00979
00980
00981
00982
00983
00984 OILDockingBar::SetBigControlState(Big);
00985
00986
00987
00988 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
00989 OILChildBar * Next;
00990 OILChildBar * EndList =(OILChildBar *) ChildBars.GetTail();
00991
00992 while (ThisChild != NULL)
00993 {
00994 Next =(OILChildBar *) ChildBars.GetNext(ThisChild);
00995 ::SendMessage(ThisChild->GetHwnd(), WM_RESIZECONTROLS, 0,0);
00996 ThisChild = Next;
00997 if (ThisChild == NULL)
00998 break;
00999 if (ThisChild == EndList)
01000 {
01001 ::SendMessage(ThisChild->GetHwnd(), WM_RESIZECONTROLS, 0,0);
01002 break;
01003 }
01004 }
01005
01006
01007 ThisChild =(OILChildBar *) ChildBars.GetHead();
01008 while (ThisChild != NULL)
01009 {
01010 ThisChild->UpdatePos();
01011 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
01012 }
01013
01014
01015 if (Big)
01016 CheckAndCorrectOverlap();
01017
01018 ::LockWindowUpdate(NULL);
01019 ((CFrameWnd*)Parent)->RecalcLayout();
01020 }
01021 }
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038 BOOL OILFixedDockingBar::IsScreenPointInDock(CPoint here)
01039 {
01040 CRect rect(0,0,DockSize.cx,DockSize.cy);
01041
01042
01043 if (NoOfSlots==0)
01044 {
01045 switch (DockType)
01046 {
01047 case DOCKBAR_LEFT:
01048 rect.right = ControlSize;
01049 break;
01050 case DOCKBAR_RIGHT:
01051 rect.left = - (INT32)ControlSize;
01052 break;
01053 case DOCKBAR_TOP:
01054 rect.bottom = ControlSize;
01055 break;
01056 case DOCKBAR_BOTTOM:
01057 rect.top = - (INT32)ControlSize;
01058 break;
01059 }
01060 }
01061 ClientToScreen(&rect);
01062 return rect.PtInRect(here);
01063
01064 }
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082 void OILFixedDockingBar::GetDockScreenRect(CRect * BarRect)
01083 {
01084 CRect rect ;
01085 GetClientRect(&rect);
01086 ClientToScreen(&rect);
01087 BarRect->CopyRect(rect);
01088 }
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109 BOOL OILFixedDockingBar::IsScreenRectInDock(CRect BarRect)
01110 {
01111
01112 CRect rect(0,0,DockSize.cx,DockSize.cy);
01113 if (NoOfSlots==0)
01114 {
01115
01116 switch (DockType)
01117 {
01118 case DOCKBAR_LEFT:
01119 case DOCKBAR_RIGHT:
01120 rect.right = 1;
01121 break;
01122 case DOCKBAR_TOP:
01123 case DOCKBAR_BOTTOM:
01124 rect.bottom = 1;
01125 break;
01126 }
01127
01128 }
01129 ClientToScreen(&rect);
01130 rect&=BarRect;
01131 return !(rect.IsRectEmpty());
01132 }
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151 void OILFixedDockingBar::SetSize(CRect ClientRect,CRect * rect)
01152 {
01153
01154 rect->CopyRect(&ClientRect);
01155 switch (DockType)
01156 {
01157
01158 case DOCKBAR_LEFT:
01159 rect->right =ClientRect.left + TotalSlotSizes();
01160 break;
01161 case DOCKBAR_RIGHT:
01162 rect->left = ClientRect.right - TotalSlotSizes();
01163 break;
01164 case DOCKBAR_TOP:
01165 rect->bottom = ClientRect.top + TotalSlotSizes();
01166 break;
01167 case DOCKBAR_BOTTOM:
01168 rect->top = ClientRect.bottom - TotalSlotSizes();
01169 break;
01170
01171 }
01172
01173 DockSize.cx=rect->right-rect->left;
01174 DockSize.cy=rect->bottom-rect->top;
01175 }
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192 INT32 OILFixedDockingBar::PointToSlot(CPoint* ThisPoint)
01193 {
01194 if (ControlSize == 0)
01195 return(0);
01196
01197 INT32 Value = 0;
01198
01199 switch (DockType)
01200 {
01201 case DOCKBAR_TOP:
01202 case DOCKBAR_BOTTOM:
01203 Value = ThisPoint->y;
01204 break;
01205
01206 case DOCKBAR_LEFT:
01207 case DOCKBAR_RIGHT:
01208 Value = ThisPoint->x;
01209 break;
01210 }
01211
01212 INT32 Total = 0;
01213
01214 for (INT32 i = 0; i < MAX_SLOTS; i++)
01215 {
01216 Total += SlotSize[i];
01217 if (Total > Value)
01218 return(i);
01219 }
01220
01221 return(0);
01222 }
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240 void OILFixedDockingBar::BarPosToClient(KernelBarPos Pos,CPoint * Point)
01241 {
01242
01243 switch (DockType)
01244 {
01245 case DOCKBAR_TOP:
01246 case DOCKBAR_BOTTOM:
01247 Point->x = Pos.Position;
01248 Point->y = TotalSlotSizes(Pos.Slot);
01249 break;
01250
01251 case DOCKBAR_LEFT:
01252 case DOCKBAR_RIGHT:
01253 Point->y = Pos.Position;
01254 Point->x = TotalSlotSizes(Pos.Slot);
01255 break;
01256 }
01257 }
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274 void OILFixedDockingBar::BarPosToScreen(KernelBarPos Pos,CPoint * Point)
01275 {
01276 BarPosToClient(Pos, Point);
01277 ClientToScreen(Point);
01278 }
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295 INT32 OILFixedDockingBar::PointToPosition(CPoint* ThisPoint)
01296 {
01297
01298 switch (DockType)
01299 {
01300 case DOCKBAR_TOP:
01301 case DOCKBAR_BOTTOM:
01302 return ThisPoint->x;
01303 break;
01304
01305 case DOCKBAR_LEFT:
01306 case DOCKBAR_RIGHT:
01307 return ThisPoint->y;
01308 break;
01309 }
01310 return 0;
01311 }
01312
01313
01314
01316
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334 INT32 OILFixedDockingBar::GetIntersectPercent(OILChildBar * ThisBar)
01335 {
01336
01337 CRect CheckRect;
01338 CRect TempNew;
01339 CRect ThisRect = ThisBar->GetRectClient();
01340 CPoint ThisPoint = ThisBar->GetPos();
01341
01342 INT32 ThisArea = ThisRect.right*ThisRect.bottom;
01343 INT32 FoundArea = 0;
01344 CSize FoundSize;
01345
01346 OILChildBar* ThisChild = (OILChildBar *) ChildBars.GetHead();
01347 while (ThisChild != NULL)
01348 {
01349 if (ThisBar != ThisChild)
01350 {
01351 TempNew = ThisRect+ThisPoint;
01352
01353 CheckRect = ThisChild->GetRectClient()+ThisChild->GetPos();
01354 TempNew &= CheckRect;
01355 if (!TempNew.IsRectEmpty())
01356 {
01357 FoundSize = TempNew.Size();
01358 FoundArea += FoundSize.cx*FoundSize.cy;
01359 }
01360 }
01361
01362 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
01363 }
01364
01365 if (ThisArea==0)
01366 return 0;
01367
01368 return (INT32) ceill(((float)(FoundArea*100))/(float)ThisArea);
01369 }
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387 void OILFixedDockingBar::PutInSlot(CPoint* position, INT32 Size)
01388 {
01389
01390
01391 INT32 PointSlot = PointToSlot(position);
01392
01393 INT32 SlotStart = TotalSlotSizes(PointSlot);
01394
01395 INT32 MidPoint = SlotStart + (SlotSize[PointSlot] / 2);
01396
01397 INT32 BarMidPoint = 0;
01398
01399 INT32 SlotEnd = SlotStart + SlotSize[PointSlot];
01400
01401
01402 switch (DockType)
01403 {
01404 case DOCKBAR_BOTTOM:
01405 case DOCKBAR_TOP:
01406 BarMidPoint = position->y + (Size / 2);
01407 if (position->x < 0)
01408 position->x = 0;
01409
01410 if (position->y < MidPoint)
01411 {
01412 position->y = SlotStart;
01413 }
01414 else
01415 {
01416 position->y = SlotStart + SlotSize[PointSlot];
01417 }
01418 break;
01419
01420 case DOCKBAR_LEFT:
01421 case DOCKBAR_RIGHT:
01422 BarMidPoint = position->x + (Size / 2);
01423
01424 if (position->y < 0)
01425 position->y = 0;
01426
01427 if (BarMidPoint < SlotEnd)
01428 {
01429 position->x = SlotStart;
01430 }
01431 else
01432 {
01433 position->x = SlotStart + SlotSize[PointSlot];
01434 }
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444 break;
01445 }
01446
01447 }
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465 BOOL OILFixedDockingBar::ShiftBarPos(CPoint * position, INT32 Amount)
01466 {
01467 INT32 NewPos;
01468
01469 switch (DockType)
01470 {
01471 case DOCKBAR_LEFT:
01472 case DOCKBAR_RIGHT:
01473 NewPos = position->y + Amount;
01474 if (NewPos < 0 || NewPos >= DockSize.cy)
01475 return FALSE;
01476 position->y = NewPos;
01477 break;
01478
01479 case DOCKBAR_TOP:
01480 case DOCKBAR_BOTTOM:
01481 NewPos = position->x + Amount;
01482 if (NewPos < 0 || NewPos >= DockSize.cx)
01483 return FALSE;
01484 position->x = NewPos;
01485 break;
01486 }
01487
01488 return TRUE;
01489 }
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506 BOOL OILFixedDockingBar::ShiftBarSlot(CPoint* position, INT32 NoSlots)
01507 {
01508 INT32 StartSlot = PointToSlot(position);
01509 INT32 NewPos = TotalSlotSizes(NoSlots + StartSlot);
01510
01511 switch (DockType)
01512 {
01513 case DOCKBAR_LEFT:
01514 case DOCKBAR_RIGHT:
01515 position->x = NewPos;
01516 break;
01517
01518 case DOCKBAR_TOP:
01519 case DOCKBAR_BOTTOM:
01520 position->y = NewPos;
01521 break;
01522 }
01523
01524 return TRUE;
01525 }
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543 void OILFixedDockingBar::CheckAndCorrectOverlap()
01544 {
01545 DoRecalc = FALSE ;
01546 INT32 RightOfLastBar = 0;
01547 INT32 ThisBarStart = 0;
01548 INT32 ThisSlot = 0;
01549 INT32 LastSlot = 0;
01550 INT32 AmountToMove = 0;
01551 BOOL TidyUpSlots = FALSE ;
01552 INT32 index=0;
01553
01554 OILChildBar * ThisChild = (OILChildBar *) ChildBars.GetHead();
01555 if (ThisChild == NULL)
01556 return ;
01557 CPoint ThisPos = ThisChild->GetPos();
01558 RightOfLastBar = PointToPosition( &ThisPos ) + ThisChild->GetExtent();
01559 LastSlot = PointToSlot( &ThisPos );
01560
01561 while (ThisChild != NULL)
01562 {
01563
01564 ThisChild = (OILChildBar *) ChildBars.GetNext( ThisChild );
01565
01566
01567 if (ThisChild == NULL)
01568 break;
01569
01570
01571 ThisPos = ThisChild->GetPos();
01572 ThisBarStart = PointToPosition( &ThisPos );
01573 ThisSlot = PointToSlot( &ThisPos );
01574
01575 if ( ThisSlot == LastSlot )
01576 {
01577
01578 AmountToMove = RightOfLastBar-ThisBarStart;
01579
01580
01581 if ( AmountToMove > 0 )
01582 {
01583
01584 if (ShiftBarPos( &ThisPos, AmountToMove ))
01585 {
01586 ThisChild->SetPos( ThisPos );
01587 }
01588 else
01589 {
01590
01591 InsertSlot( ThisSlot + 1 );
01592 ShiftBarSlot( &ThisPos,1 );
01593 ThisChild->SetPos( ThisPos );
01594 TidyUpSlots = TRUE;
01595 RightOfLastBar = ThisBarStart = 0;
01596 }
01597 }
01598 }
01599
01600 RightOfLastBar = PointToPosition( &ThisPos ) + ThisChild->GetExtent();
01601 LastSlot = ThisSlot;
01602
01603 }
01604
01605 if (TidyUpSlots)
01606 TidySlots();
01607 if (DoRecalc)
01608 ((CFrameWnd*)Parent)->RecalcLayout();
01609 DoRecalc = FALSE ;
01610 }
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631 BOOL OILFixedDockingBar::CanShuffleForward(OILChildBar * Start,OILChildBar * End, INT32 Amount)
01632 {
01633
01634 if (Start==NULL)
01635 return FALSE;
01636
01637 INT32 RightOfBar = 0;
01638 INT32 LeftOfBar = 0;
01639 CPoint FoundPos;
01640 INT32 AmountToMove = Amount;
01641
01642 OILChildBar * ThisChild = Start;
01643
01644 while (ThisChild != End)
01645 {
01646
01647 FoundPos = ThisChild->GetPos();
01648 if (!ShiftBarPos(&FoundPos,AmountToMove))
01649 return FALSE;
01650
01651 RightOfBar = PointToPosition(&FoundPos) + ThisChild->GetExtent();
01652
01653 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
01654
01655 if (ThisChild == End || ThisChild == NULL)
01656 LeftOfBar = RightOfBar;
01657 else
01658 LeftOfBar = PointToPosition(&(ThisChild->GetPos()));
01659
01660 AmountToMove = RightOfBar - LeftOfBar;
01661
01662 if (AmountToMove == 0)
01663 break;
01664
01665 }
01666 if (AmountToMove > 0)
01667 return FALSE;
01668 return TRUE;
01669 }
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687 BOOL OILFixedDockingBar::DoShuffleForward(OILChildBar * Start,OILChildBar * End, INT32 Amount)
01688 {
01689
01690 if (Start==NULL)
01691 return FALSE;
01692
01693 if (!CanShuffleForward(Start,End,Amount))
01694 return FALSE;
01695
01696 INT32 RightOfBar;
01697 INT32 LeftOfBar;
01698 CPoint FoundPos;
01699 INT32 AmountToMove = Amount;
01700 OILChildBar * ThisChild = Start;
01701
01702 while (ThisChild!=End)
01703 {
01704
01705 FoundPos=ThisChild->GetPos();
01706
01707 if (ShiftBarPos(&FoundPos,AmountToMove))
01708 ThisChild->SetPos(FoundPos);
01709
01710 RightOfBar = PointToPosition(&FoundPos) + ThisChild->GetExtent();
01711
01712 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
01713
01714 if (ThisChild == End || ThisChild == NULL)
01715 LeftOfBar = RightOfBar;
01716 else
01717 LeftOfBar = PointToPosition(&(ThisChild->GetPos()));
01718
01719 AmountToMove = RightOfBar - LeftOfBar;
01720
01721 if (AmountToMove == 0)
01722 break;
01723
01724 }
01725 if (AmountToMove>0)
01726 return FALSE;
01727 return TRUE;
01728 }
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748 BOOL OILFixedDockingBar::CanShuffleBackward(OILChildBar * Start,OILChildBar * End, INT32 Amount)
01749 {
01750
01751 if (Start==NULL)
01752 return FALSE;
01753
01754 INT32 RightOfBar;
01755 INT32 LeftOfBar;
01756 CPoint FoundPos;
01757 INT32 AmountToMove=Amount;
01758 OILChildBar * ThisChild= Start;
01759
01760 while (ThisChild!=End)
01761 {
01762
01763 FoundPos=ThisChild->GetPos();
01764 if (!ShiftBarPos(&FoundPos,-AmountToMove))
01765 return FALSE;
01766
01767 LeftOfBar=PointToPosition(&FoundPos);
01768 ThisChild =(OILChildBar *) ChildBars.GetPrev(ThisChild);
01769 if (ThisChild==NULL)
01770 break;
01771
01772 RightOfBar = PointToPosition(&(ThisChild->GetPos())) + ThisChild->GetExtent();
01773
01774 AmountToMove=RightOfBar-LeftOfBar;
01775 if (AmountToMove<=0)
01776 break;
01777
01778 }
01779 return TRUE;
01780 }
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797 BOOL OILFixedDockingBar::DoShuffleBackward(OILChildBar * Start,OILChildBar * End, INT32 Amount)
01798 {
01799
01800 if (Start==NULL)
01801 return FALSE;
01802
01803 if (!CanShuffleBackward(Start,End,Amount))
01804 return FALSE;
01805
01806 INT32 RightOfBar;
01807 INT32 LeftOfBar;
01808 CPoint FoundPos;
01809 INT32 AmountToMove=Amount;
01810 OILChildBar * ThisChild= Start;
01811
01812 while (ThisChild!=End)
01813 {
01814
01815 FoundPos=ThisChild->GetPos();
01816 if (ShiftBarPos(&FoundPos,-AmountToMove))
01817 ThisChild->SetPos(FoundPos);
01818
01819 LeftOfBar=PointToPosition(&(ThisChild->GetPos()));
01820 ThisChild =(OILChildBar *) ChildBars.GetPrev(ThisChild);
01821 if (ThisChild==NULL)
01822 break;
01823
01824 RightOfBar = PointToPosition(&(ThisChild->GetPos())) + ThisChild->GetExtent();
01825
01826 AmountToMove=RightOfBar-LeftOfBar;
01827 if (AmountToMove<=0)
01828 break;
01829
01830 }
01831 return TRUE;
01832 }
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850 OILChildBar * OILFixedDockingBar::GetOverLap(OILChildBar * ThisBar,INT32 SlotNo,
01851 INT32 * ForwardOverlap,INT32 * BackwardOverlap)
01852 {
01853 ENSURE(SlotNo >= 0 && SlotNo < NoOfSlots,"Slot Out Of Range");
01854
01855 CPoint FoundPos;
01856 OILChildBar * StartSlot = GetSlotHead(SlotNo);
01857 OILChildBar *StartNextSlot = GetSlotHead(SlotNo+1);
01858
01859
01860 if (StartSlot == NULL)
01861 return FALSE;
01862
01863 INT32 CheckPos = 0;
01864 INT32 ThisPos=PointToPosition(&(ThisBar->GetPos()));
01865 OILChildBar * ThisChild = StartSlot;
01866 OILChildBar * FoundNearest = NULL;
01867 *BackwardOverlap = 0;
01868 *ForwardOverlap = 0;
01869
01870
01871
01872 while (TRUE)
01873 {
01874
01875 if (ThisChild != NULL)
01876 {
01877 CheckPos = PointToPosition(&(ThisChild->GetPos()));
01878 }
01879 if (ThisPos<CheckPos||ThisChild == StartNextSlot||ThisChild == NULL)
01880 {
01881
01882 if (ThisChild == NULL)
01883 {
01884 ThisChild = (OILChildBar *) ChildBars.GetTail();
01885 }
01886 else
01887 {
01888 ThisChild =(OILChildBar *) ChildBars.GetPrev(ThisChild);
01889 }
01890 if (ThisChild==NULL)
01891 {
01892 *BackwardOverlap = 0;
01893 FoundNearest = NULL;
01894 ThisChild =(OILChildBar *) ChildBars.GetHead( );
01895 }
01896 else
01897 {
01898
01899 FoundPos = ThisChild->GetPos();
01900 CheckPos = PointToPosition(&FoundPos)+ ThisChild->GetExtent();
01901
01902 FoundNearest = ThisChild;
01903
01904
01905 *BackwardOverlap = CheckPos - ThisPos ;
01906 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
01907 }
01908
01909 if (ThisChild != NULL && ThisChild != StartNextSlot)
01910 {
01911
01912 FoundPos = ThisBar->GetPos() ;
01913 CheckPos = PointToPosition(&FoundPos)+ ThisBar->GetExtent();
01914 INT32 NextPos = PointToPosition(&(ThisChild->GetPos()));
01915 if (CheckPos>NextPos)
01916 *ForwardOverlap = CheckPos-NextPos ;
01917 }
01918 break;
01919 }
01920 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
01921 }
01922
01923 if (*BackwardOverlap < 0)
01924 *BackwardOverlap = 0;
01925
01926 if (*ForwardOverlap < 0)
01927 * ForwardOverlap = 0;
01928 return FoundNearest;
01929 }
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950 BOOL OILFixedDockingBar::GetGalleryOverLap(OILChildBar* ThisBar,INT32 SlotNo,
01951 INT32 * ForwardOverlap,INT32 * BackwardOverlap,
01952 OILChildBar** ppPrevious, OILChildBar** ppNext)
01953 {
01954
01955
01956 CPoint FoundPos;
01957
01958 *BackwardOverlap = 0;
01959 *ForwardOverlap = 0;
01960 if (ppPrevious)
01961 *ppPrevious = NULL;
01962 if (ppNext)
01963 *ppNext = NULL;
01964
01965 INT32 ThisMin = ThisBar->GetKPPos();
01966 INT32 ThisMax = ThisMin + ThisBar->GetExtent();
01967
01968
01969
01970 OILChildBar* StartSlot = GetSlotHead(SlotNo);
01971
01972 if (StartSlot == NULL)
01973 {
01974 *BackwardOverlap = -ThisMin;
01975 *ForwardOverlap = ThisMax - DockSize.cy;
01976 return TRUE;
01977 }
01978
01979 OILChildBar* CheckBar = StartSlot;
01980
01981
01982
01983 while (CheckBar && (CheckBar->GetKPSlot() == SlotNo) &&
01984 (CheckBar == ThisBar || CheckBar->GetKPPos() < ThisMin))
01985 {
01986 CheckBar = (OILChildBar*)ChildBars.GetNext(CheckBar);
01987 }
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999 OILChildBar* PreviousBar = CheckBar ? (OILChildBar*)ChildBars.GetPrev(CheckBar) : (OILChildBar*)ChildBars.GetTail();
02000 if (PreviousBar == ThisBar)
02001 PreviousBar = (OILChildBar*)ChildBars.GetPrev(PreviousBar);
02002 if (PreviousBar && PreviousBar->GetKPSlot() != SlotNo)
02003 PreviousBar = NULL;
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014 if (!CheckBar || CheckBar->GetKPSlot() != SlotNo)
02015 {
02016
02017
02018
02019
02020
02021 *ForwardOverlap = ThisMax - DockSize.cy;
02022 if (PreviousBar)
02023 {
02024 if (ppPrevious)
02025 *ppPrevious = PreviousBar;
02026 *BackwardOverlap = (PreviousBar->GetKPPos() + PreviousBar->GetExtent()) - ThisMin;
02027 }
02028 else
02029 {
02030 *BackwardOverlap = -ThisMin;
02031 }
02032 }
02033 else
02034 {
02035
02036
02037
02038 if (ppNext)
02039 *ppNext = CheckBar;
02040 *ForwardOverlap = ThisMax - CheckBar->GetKPPos();
02041
02042 if (PreviousBar)
02043 {
02044 if (ppPrevious)
02045 *ppPrevious = PreviousBar;
02046 *BackwardOverlap = (PreviousBar->GetKPPos() + PreviousBar->GetExtent()) - ThisMin;
02047 }
02048 else
02049 {
02050 *BackwardOverlap = -ThisMin;
02051 }
02052 }
02053
02054 return TRUE;
02055 }
02056
02057
02058
02059
02060
02061
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073 BOOL OILFixedDockingBar::PlaceBarInSlot(OILChildBar * ThisBar, INT32 SlotNo)
02074 {
02075 ENSURE(ThisBar != NULL,"Trying To Place A Null Bar");
02076 ENSURE(SlotNo >= 0 && SlotNo < NoOfSlots,"Slot Out of Range");
02077
02078 CPoint FoundPos;
02079 CPoint LastPos ;
02080
02081 OILChildBar * StartSlot=GetSlotHead(SlotNo);
02082 OILChildBar * StartNextSlot=GetSlotHead(SlotNo+1);
02083 BOOL DoneShuffleForward = FALSE;
02084 if (StartSlot==NULL)
02085 return FALSE;
02086
02087 INT32 ThisPos=PointToPosition(&(ThisBar->GetPos()));
02088 INT32 BackwardOverlap ;
02089 INT32 ForwardOverlap ;
02090 INT32 ForwardDone ;
02091
02092 OILChildBar * FoundNearest=GetOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap);
02093
02094 ForwardDone = ForwardOverlap;
02095
02096 if (FoundNearest==NULL)
02097 {
02098 FoundPos=ThisBar->GetPos();
02099
02100 if (ShiftBarPos(&FoundPos,-ForwardOverlap))
02101 ThisBar->SetPos(FoundPos);
02102
02103 else
02104 {
02105 if (!(DoneShuffleForward =DoShuffleForward(StartSlot,StartNextSlot, ForwardOverlap)))
02106 return FALSE;
02107 }
02108 }
02109 else
02110 {
02111
02112
02113
02114
02115
02116 if (ForwardOverlap > 0)
02117 {
02118
02119 if (!(DoneShuffleForward =DoShuffleForward((OILChildBar *) ChildBars.GetNext(FoundNearest),
02120 StartNextSlot, ForwardOverlap)))
02121 {
02122 LastPos = FoundPos=ThisBar->GetPos();
02123
02124 if (ShiftBarPos(&FoundPos,-ForwardOverlap))
02125 {
02126 ThisBar->SetPos(FoundPos);
02127 FoundNearest = GetOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap);
02128 if (BackwardOverlap > 0)
02129 {
02130 if (!DoShuffleBackward(FoundNearest,
02131 (OILChildBar *)ChildBars.GetPrev(StartSlot),
02132 BackwardOverlap))
02133 {
02134
02135 ThisBar->SetPos(LastPos);
02136 return FALSE;
02137 }
02138 }
02139 }
02140 else
02141 {
02142
02143 ThisBar->SetPos(LastPos);
02144 return FALSE;
02145 }
02146 return FALSE;
02147 }
02148 }
02149
02150
02151 if (BackwardOverlap > 0)
02152 {
02153
02154 if (!DoShuffleBackward(FoundNearest,(OILChildBar *) ChildBars.GetPrev(StartSlot),
02155 BackwardOverlap))
02156 {
02157 LastPos = FoundPos = ThisBar->GetPos();
02158
02159 if (ShiftBarPos(&FoundPos,BackwardOverlap))
02160 {
02161 ThisBar->SetPos(FoundPos);
02162 FoundNearest = GetOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap);
02163 if (ForwardOverlap > 0)
02164 {
02165 if (!DoShuffleForward((OILChildBar *) ChildBars.GetNext(FoundNearest),
02166 StartNextSlot, ForwardOverlap))
02167 {
02168
02169 ThisBar->SetPos(LastPos);
02170 if (DoneShuffleForward)
02171 DoShuffleBackward((OILChildBar *) ChildBars.GetNext(FoundNearest),
02172 StartNextSlot, ForwardDone);
02173 return FALSE;
02174 }
02175 }
02176 }
02177 else
02178 {
02179
02180 ThisBar->SetPos(LastPos);
02181 if (DoneShuffleForward)
02182 DoShuffleForward((OILChildBar *) ChildBars.GetNext(FoundNearest),
02183 StartNextSlot, ForwardDone);
02184 return FALSE;
02185 }
02186 }
02187 }
02188
02189 }
02190 return TRUE;
02191 }
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209 BOOL OILFixedDockingBar::PlaceGalleryInSlot(OILChildBar * ThisBar, INT32 SlotNo)
02210 {
02211 ENSURE(ThisBar != NULL,"Trying To Place A Null Bar");
02212
02213
02214 if (!allowTidyBars)
02215 return(TRUE);
02216
02217 CPoint FoundPos;
02218 CPoint LastPos ;
02219 BOOL DoneShuffleForward = FALSE;
02220
02221 INT32 ThisPos = ThisBar->GetKPPos();
02222
02223 INT32 BackwardOverlap ;
02224 INT32 ForwardOverlap ;
02225 OILChildBar* PreviousBar = NULL;
02226 OILChildBar* NextBar = NULL;
02227
02228 GetGalleryOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02229
02230
02231
02232 if (!PreviousBar && !NextBar)
02233 {
02234 ThisBar->GetBarPos()->Position = 0;
02235 ThisBar->UpdatePos();
02236 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), DockSize.cy);
02237 return(TRUE);
02238 }
02239
02240
02241
02242
02243 BOOL bMoved = FALSE;
02244 OILChildBar* FirstBar = GetSlotHead(SlotNo);
02245 OILChildBar* LastBar = NULL;
02246 OILChildBar* TempBar = FirstBar;
02247 while (TempBar && TempBar->GetKPSlot() == SlotNo)
02248 {
02249 LastBar = TempBar;
02250 TempBar = (OILChildBar*)ChildBars.GetNext(TempBar);
02251 }
02252
02253 if (PreviousBar)
02254 {
02255 OILChildBar* MoveBar = FirstBar;
02256 OILChildBar* EndBar = (OILChildBar*)ChildBars.GetNext(PreviousBar);
02257 INT32 CurPos = 0;
02258 while (MoveBar && MoveBar != EndBar)
02259 {
02260 if (MoveBar->GetBarPos()->Position != CurPos)
02261 {
02262 MoveBar->GetBarPos()->Position = CurPos;
02263 MoveBar->UpdatePos();
02264 bMoved = TRUE;
02265 }
02266 CurPos += MoveBar->GetExtent();
02267 MoveBar = (OILChildBar*)ChildBars.GetNext(MoveBar);
02268 }
02269 }
02270
02271 if (NextBar)
02272 {
02273 OILChildBar* MoveBar = LastBar;
02274 OILChildBar* EndBar = (OILChildBar*)ChildBars.GetPrev(NextBar);
02275 INT32 CurEnd = DockSize.cy;
02276 while (MoveBar && MoveBar != EndBar)
02277 {
02278 INT32 CurPos = CurEnd - MoveBar->GetExtent();
02279 if (MoveBar->GetBarPos()->Position != CurPos)
02280 {
02281 MoveBar->GetBarPos()->Position = CurPos;
02282 MoveBar->UpdatePos();
02283 bMoved = TRUE;
02284 }
02285 CurEnd = CurPos;
02286 MoveBar = (OILChildBar*)ChildBars.GetPrev(MoveBar);
02287 }
02288 }
02289
02290 if (bMoved)
02291 {
02292 GetGalleryOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02293
02294 }
02295
02296
02297 if (!PreviousBar && BackwardOverlap != 0)
02298 {
02299
02300 ThisBar->GetBarPos()->Position = 0;
02301 ThisBar->UpdatePos();
02302 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() - BackwardOverlap);
02303
02304 GetGalleryOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02305
02306 }
02307
02308
02309 if (!NextBar && ForwardOverlap != 0)
02310 {
02311
02312 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() - ForwardOverlap);
02313 INT32 TempBack = 0;
02314 INT32 TempFor = 0;
02315 GetGalleryOverLap(ThisBar,SlotNo,&TempFor,&TempBack, NULL, NULL);
02316 if (TempFor > 0)
02317 {
02318 ThisBar->GetBarPos()->Position -= TempFor;
02319 ThisBar->UpdatePos();
02320 }
02321 GetGalleryOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02322
02323 }
02324
02325
02326 if (BackwardOverlap != 0)
02327 {
02328 if (PreviousBar)
02329 {
02330 if (BackwardOverlap > 0)
02331 {
02332 INT32 AmountToShrink = BackwardOverlap;
02333 INT32 AmountToMove = 0;
02334 OILChildBar* ShrinkBar = PreviousBar;
02335 while (AmountToShrink > 0 && ShrinkBar && ShrinkBar->GetKPSlot() == SlotNo)
02336 {
02337 INT32 OldExt = ShrinkBar->GetExtent();
02338 ::SendMessage(ShrinkBar->GetHwnd(), WM_SETGALLERYSIZE, ShrinkBar->GetBarSize(), ShrinkBar->GetExtent() - AmountToShrink);
02339 INT32 AmountShrunk = OldExt - ShrinkBar->GetExtent();
02340 AmountToShrink -= AmountShrunk;
02341 if (AmountToShrink > 0)
02342 {
02343 if (ShrinkBar->GetBarPos()->Position > 0)
02344 {
02345 AmountToMove = (ShrinkBar->GetBarPos()->Position < AmountToShrink) ? ShrinkBar->GetBarPos()->Position : AmountToShrink;
02346 ShrinkBar->GetBarPos()->Position -= AmountToMove;
02347 ShrinkBar->UpdatePos();
02348 AmountToShrink = AmountToMove;
02349 }
02350 }
02351 ShrinkBar = (OILChildBar*)ChildBars.GetPrev(ShrinkBar);
02352 }
02353
02354 if (AmountToShrink > 0)
02355 {
02356
02357
02358 OILChildBar* MoveBar = GetSlotHead(SlotNo);
02359 OILChildBar* EndBar = (OILChildBar*)ChildBars.GetNext(PreviousBar);
02360 INT32 TempBack = 0;
02361 INT32 TempFor = 0;
02362 MoveBar->GetBarPos()->Position = 0;
02363 MoveBar->UpdatePos();
02364 MoveBar = (OILChildBar*)ChildBars.GetNext(MoveBar);
02365 while (MoveBar && MoveBar != EndBar)
02366 {
02367 GetGalleryOverLap(MoveBar,SlotNo,&TempFor,&TempBack, NULL, NULL);
02368 if (TempBack != 0)
02369 {
02370 MoveBar->GetBarPos()->Position += TempBack;
02371 MoveBar->UpdatePos();
02372 }
02373 MoveBar = (OILChildBar*)ChildBars.GetNext(MoveBar);
02374 }
02375
02376 GetGalleryOverLap(ThisBar,SlotNo,&TempFor,&TempBack, NULL, NULL);
02377 ThisBar->GetBarPos()->Position += TempBack;
02378 ThisBar->UpdatePos();
02379 GetGalleryOverLap(ThisBar,SlotNo,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02380
02381 }
02382 }
02383 else
02384 {
02385
02386 ::SendMessage(PreviousBar->GetHwnd(), WM_SETGALLERYSIZE, PreviousBar->GetBarSize(), PreviousBar->GetExtent() - BackwardOverlap);
02387 }
02388 }
02389 else
02390 {
02391
02392 ThisBar->GetBarPos()->Position = 0;
02393 ThisBar->UpdatePos();
02394 INT32 OldExt = ThisBar->GetExtent();
02395 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() - BackwardOverlap);
02396 INT32 NewExt = ThisBar->GetExtent();
02397 if (NewExt != (OldExt - BackwardOverlap))
02398 {
02399
02400 }
02401 }
02402 }
02403
02404
02405 if (ForwardOverlap != 0)
02406 {
02407 if (NextBar)
02408 {
02409 if (ForwardOverlap > 0)
02410 {
02411 INT32 AmountToShrink = ForwardOverlap;
02412 INT32 AmountToMove = 0;
02413 OILChildBar* ShrinkBar = NextBar;
02414 while (AmountToShrink > 0 && ShrinkBar && ShrinkBar->GetKPSlot() == SlotNo)
02415 {
02416 INT32 OldExt = ShrinkBar->GetExtent();
02417 ::SendMessage(ShrinkBar->GetHwnd(), WM_SETGALLERYSIZE, ShrinkBar->GetBarSize(), ShrinkBar->GetExtent() - AmountToShrink);
02418 INT32 AmountShrunk = OldExt - ShrinkBar->GetExtent();
02419
02420 ShrinkBar->GetBarPos()->Position += AmountToShrink;
02421 ShrinkBar->UpdatePos();
02422 AmountToShrink -= AmountShrunk;
02423
02424 ShrinkBar = (OILChildBar*)ChildBars.GetNext(ShrinkBar);
02425 }
02426
02427 if (AmountToShrink > 0)
02428 {
02429
02430
02431
02432
02433
02434
02435
02436 INT32 OldExt = ThisBar->GetExtent();
02437 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() - AmountToShrink);
02438 INT32 AmountShrunk = OldExt - ThisBar->GetExtent();
02439 AmountToShrink -= AmountShrunk;
02440
02441 if (AmountToShrink > 0)
02442 {
02443 ThisBar->GetBarPos()->Position -= AmountToShrink;
02444 ThisBar->UpdatePos();
02445
02446 OILChildBar* ShrinkBar = PreviousBar;
02447 while (ShrinkBar && ShrinkBar->GetKPSlot() == SlotNo && AmountToShrink > 0)
02448 {
02449 INT32 OldExt = ShrinkBar->GetExtent();
02450 ::SendMessage(ShrinkBar->GetHwnd(), WM_SETGALLERYSIZE, ShrinkBar->GetBarSize(), ShrinkBar->GetExtent() - AmountToShrink);
02451 INT32 AmountShrunk = OldExt - ShrinkBar->GetExtent();
02452 if (AmountShrunk > 0)
02453 {
02454 AmountToShrink -= AmountShrunk;
02455
02456 OILChildBar* MoveBar = (OILChildBar*)ChildBars.GetNext(ShrinkBar);
02457 while (MoveBar && MoveBar != NextBar)
02458 {
02459 MoveBar->GetBarPos()->Position -= AmountShrunk;
02460 MoveBar->UpdatePos();
02461 MoveBar = (OILChildBar*)ChildBars.GetNext(MoveBar);
02462 }
02463 }
02464 ShrinkBar = (OILChildBar*)ChildBars.GetPrev(ShrinkBar);
02465 }
02466 }
02467
02468 INT32 TempBack = 0;
02469 INT32 TempFor = 0;
02470 OILChildBar* LastBar = NULL;
02471 OILChildBar* MoveBar = NextBar;
02472 MoveBar->GetBarPos()->Position = ThisBar->GetBarPos()->Position + ThisBar->GetExtent();
02473 MoveBar->UpdatePos();
02474 MoveBar = (OILChildBar*)ChildBars.GetNext(MoveBar);
02475 while (MoveBar && MoveBar->GetKPSlot() == SlotNo)
02476 {
02477 GetGalleryOverLap(MoveBar,SlotNo,&TempFor,&TempBack, NULL, NULL);
02478 if (TempBack != 0)
02479 {
02480 MoveBar->GetBarPos()->Position += TempBack;
02481 MoveBar->UpdatePos();
02482 }
02483 LastBar = MoveBar;
02484 MoveBar = (OILChildBar*)ChildBars.GetNext(MoveBar);
02485 }
02486
02487 if (LastBar && TempFor + TempBack > 0)
02488 {
02489 ::SendMessage(LastBar->GetHwnd(), WM_SETGALLERYSIZE, LastBar->GetBarSize(), LastBar->GetExtent() - (TempFor + TempBack));
02490 }
02491 }
02492
02493 }
02494 else
02495 {
02496
02497
02498 NextBar->GetBarPos()->Position += ForwardOverlap;
02499 NextBar->UpdatePos();
02500 ::SendMessage(NextBar->GetHwnd(), WM_SETGALLERYSIZE, NextBar->GetBarSize(), NextBar->GetExtent() - ForwardOverlap);
02501 }
02502 }
02503 else
02504 {
02505
02506 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() - ForwardOverlap);
02507 }
02508 }
02509
02510 return TRUE;
02511 }
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531 void OILFixedDockingBar::TidySlots()
02532 {
02533 INT32 LastSlot = -1;
02534 INT32 FoundSlot = 0;
02535 INT32 NumSlots = NoOfSlots;
02536 CPoint FoundPos;
02537
02538 if (allowTidyBars)
02539 {
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573
02574
02575
02576
02577 NoOfSlots = CountSlots();
02578
02579 for (FoundSlot = 0; FoundSlot < NoOfSlots; FoundSlot++)
02580 {
02581 OILChildBar* CheckBar = GetSlotHead(FoundSlot);
02582 if (CheckBar)
02583 {
02584 if (SlotSize[FoundSlot] != ControlSize)
02585 {
02586 OILChildBar* ThisBar = CheckBar;
02587
02588
02589 OILChildBar* LastBar = NULL;
02590 while (ThisBar && ThisBar->GetKPSlot() == FoundSlot)
02591 {
02592 LastBar = ThisBar;
02593 ThisBar = (OILChildBar*)ChildBars.GetNext(ThisBar);
02594 }
02595
02596 ThisBar = LastBar;
02597
02598 while (ThisBar && (ThisBar->GetKPSlot() == FoundSlot))
02599 {
02600 INT32 BackwardOverlap = 0;
02601 INT32 ForwardOverlap = 0;
02602 OILChildBar* PreviousBar = NULL;
02603 OILChildBar* NextBar = NULL;
02604
02605 GetGalleryOverLap(ThisBar,FoundSlot,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02606
02607
02608 BOOL bCheck = FALSE;
02609
02610 if (BackwardOverlap != 0)
02611 {
02612 ThisBar->GetBarPos()->Position += BackwardOverlap;
02613 ThisBar->UpdatePos();
02614 bCheck = TRUE;
02615 }
02616
02617 INT32 SizeDiff = -(ForwardOverlap+BackwardOverlap);
02618 if (SizeDiff != 0)
02619 {
02620 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() + SizeDiff);
02621 bCheck = TRUE;
02622 }
02623
02624 if (bCheck)
02625 {
02626 GetGalleryOverLap(ThisBar,FoundSlot,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02627
02628 if (ForwardOverlap > 0)
02629 {
02630
02631 ThisBar->GetBarPos()->Position -= ForwardOverlap;
02632 ThisBar->UpdatePos();
02633 }
02634 }
02635
02636 ThisBar = (OILChildBar*)ChildBars.GetPrev(ThisBar);
02637 }
02638
02639
02640
02641
02642
02643 ThisBar = CheckBar;
02644 while (ThisBar && (ThisBar->GetKPSlot() == FoundSlot))
02645 {
02646 INT32 BackwardOverlap = 0;
02647 INT32 ForwardOverlap = 0;
02648 OILChildBar* PreviousBar = NULL;
02649 OILChildBar* NextBar = NULL;
02650
02651 GetGalleryOverLap(ThisBar,FoundSlot,&ForwardOverlap,&BackwardOverlap, &PreviousBar, &NextBar);
02652
02653
02654
02655 if (BackwardOverlap != 0)
02656 {
02657 ThisBar->GetBarPos()->Position += BackwardOverlap;
02658 ThisBar->UpdatePos();
02659 }
02660
02661 INT32 SizeDiff = -(ForwardOverlap+BackwardOverlap);
02662 if (SizeDiff != 0)
02663 {
02664 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, ThisBar->GetBarSize(), ThisBar->GetExtent() + SizeDiff);
02665 }
02666
02667 ThisBar = (OILChildBar*)ChildBars.GetNext(ThisBar);
02668 }
02669
02670
02671 }
02672 }
02673 else if (FoundSlot < NoOfSlots)
02674 {
02675 RemoveSlot(FoundSlot--);
02676 NoOfSlots--;
02677 }
02678 }
02679 }
02680
02681 INT32 SlotsNow = CountSlots();
02682
02683 if (SlotsNow != NumSlots)
02684 {
02685 NoOfSlots = SlotsNow;
02686 DoRecalc = TRUE;
02687 }
02688 else
02689 {
02690 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
02691
02692 while (ThisChild != NULL)
02693 {
02694 ThisChild->InvalidateIfMoved();
02695 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
02696
02697 }
02698 }
02699 }
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716
02717 INT32 OILFixedDockingBar::CountSlots()
02718 {
02719 if (ChildBars.IsEmpty())
02720 return(0);
02721
02722 OILChildBar* FoundBar = (OILChildBar*)ChildBars.GetTail();
02723 if (FoundBar == NULL)
02724 return(0);
02725
02726 return(FoundBar->GetKPSlot() + 1);
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741
02742
02743
02744
02745 }
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762 void OILFixedDockingBar::RemoveSlot(INT32 SlotNo)
02763 {
02764 ASSERT(SlotNo >= 0 && SlotNo < NoOfSlots);
02765
02766 CRect FoundRect;
02767 CPoint FoundPos;
02768 OILChildBar * FoundBar =(OILChildBar *) ChildBars.GetHead();
02769 INT32 MoveSize = SlotSize[SlotNo];
02770
02771
02772 SlotSize[MAX_SLOTS-1] = ControlSize;
02773
02774 for (INT32 i = SlotNo; i < (MAX_SLOTS - 1); i++)
02775 {
02776 SlotSize[i] = SlotSize[i+1];
02777 }
02778
02779
02780
02781 while (FoundBar != NULL)
02782 {
02783 KernelBarPos* pPos = FoundBar->GetBarPos();
02784
02785
02786
02787 ERROR3IF(pPos->Slot == SlotNo, "Deleting non-empty slot");
02788
02789 switch (DockType)
02790 {
02791 case DOCKBAR_TOP:
02792 case DOCKBAR_BOTTOM:
02793 if (pPos->Slot > SlotNo)
02794 {
02795
02796 pPos->Slot -= 1;
02797 FoundBar->UpdatePos();
02798 }
02799 break;
02800 case DOCKBAR_LEFT:
02801 case DOCKBAR_RIGHT:
02802 if (pPos->Slot > SlotNo)
02803 {
02804
02805 pPos->Slot -= 1;
02806 FoundBar->UpdatePos();
02807 }
02808 break;
02809 }
02810
02811 FoundBar =(OILChildBar *) ChildBars.GetNext(FoundBar);
02812
02813 }
02814 }
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826
02827
02828
02829
02830
02831 void OILFixedDockingBar::InsertSlot(INT32 SlotNo, INT32 NewSize)
02832 {
02833 ASSERT(SlotNo >= 0 && SlotNo < NoOfSlots);
02834 KernelBarPos* pPos = NULL;
02835
02836 if (NewSize == -1)
02837 NewSize = ControlSize;
02838
02839
02840 INT32 TotalSize = TotalSlotSizes();
02841 CRect MainRect;
02842 GetMainFrame()->GetClientRect(&MainRect);
02843 INT32 MaxSize = (MainRect.Width() * 48) / 100;
02844
02845 INT32 AmountToShrink = MaxSize - TotalSize - NewSize;
02846
02847 if (AmountToShrink > 0)
02848 {
02849
02850 if (NewSize != ControlSize)
02851 {
02852
02853 NewSize = (NewSize - AmountToShrink) < MIN_GALLERY_SLOT_WIDTH ? MIN_GALLERY_SLOT_WIDTH : NewSize - AmountToShrink;
02854
02855 AmountToShrink = MaxSize - TotalSize - NewSize;
02856 }
02857
02858
02859 if (AmountToShrink > 0)
02860 {
02861 for (INT32 i = 0; i < NoOfSlots; i++)
02862 {
02863 if (SlotSize[i] != ControlSize)
02864 {
02865 INT32 OldSize = SlotSize[i];
02866 if (OldSize > MIN_GALLERY_SLOT_WIDTH)
02867 {
02868
02869 INT32 SetSize = (OldSize - AmountToShrink) < MIN_GALLERY_SLOT_WIDTH ? MIN_GALLERY_SLOT_WIDTH : OldSize - AmountToShrink;
02870
02871
02872 SetSlotSize(i, SetSize);
02873
02874
02875 AmountToShrink -= (OldSize - SlotSize[i]);
02876 }
02877 }
02878
02879 if (AmountToShrink == 0)
02880 break;
02881 }
02882 }
02883 }
02884
02885
02886 for (INT32 i = (MAX_SLOTS - 1); i > SlotNo; i--)
02887 {
02888 SlotSize[i] = SlotSize[i-1];
02889 }
02890
02891 SlotSize[SlotNo] = NewSize;
02892
02893 OILChildBar* FoundBar = (OILChildBar*) ChildBars.GetHead();
02894
02895
02896 while (FoundBar != NULL)
02897 {
02898 pPos = FoundBar->GetBarPos();
02899 if (pPos->Slot >= SlotNo)
02900 {
02901 (pPos->Slot)++;
02902 FoundBar->UpdatePos();
02903 }
02904 FoundBar = (OILChildBar*) ChildBars.GetNext(FoundBar);
02905 }
02906 }
02907
02908
02909
02910
02911
02912
02913
02914
02915
02916
02917
02918
02919
02920
02921
02922
02923 OILChildBar * OILFixedDockingBar::GetSlotHead(INT32 SlotNo)
02924 {
02925 CPoint FoundPos;
02926 INT32 FoundSlot;
02927 OILChildBar * FoundBar =(OILChildBar *) ChildBars.GetHead();
02928
02929 while (FoundBar != NULL)
02930 {
02931
02932
02933 FoundSlot = FoundBar->GetKPSlot();
02934 if (FoundSlot == SlotNo)
02935 return FoundBar;
02936 else if (FoundSlot > SlotNo)
02937 return NULL;
02938
02939 FoundBar = (OILChildBar*) ChildBars.GetNext(FoundBar);
02940 }
02941
02942 return NULL;
02943 }
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958
02959
02960 OILChildBar * OILFixedDockingBar::IsPointInBar(CPoint ThisPoint)
02961 {
02962
02963 CPoint FoundPos;
02964 CRect FoundRect;
02965 OILChildBar * FoundBar =(OILChildBar *) ChildBars.GetHead();
02966
02967 while (FoundBar != NULL)
02968 {
02969
02970 FoundPos = FoundBar->GetPos();
02971 FoundRect = FoundBar->GetRectClient();
02972 FoundRect += FoundPos;
02973 if (FoundRect.PtInRect(ThisPoint))
02974 return FoundBar;
02975
02976 FoundBar =(OILChildBar *) ChildBars.GetNext(FoundBar);
02977
02978 }
02979 return NULL;
02980 }
02981
02982
02983
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994
02995
02996
02997
02998
02999 void OILFixedDockingBar::PositionBar(OILChildBar * ThisBar)
03000 {
03001 ASSERT(ThisBar != NULL);
03002
03003
03004 INT32 ThisSlot = ThisBar->GetBarPos()->Slot;
03005
03006
03007
03008 INT32 ThisSize = ThisBar->GetBarSize();
03009
03010
03011 INT32 SizeOfBarsInSlot = 0;
03012 INT32 NumBarsInSlot = 0;
03013 INT32 FoundSlot = 0;
03014 OILChildBar* FoundBar = GetSlotHead(ThisSlot);
03015 while (FoundBar != NULL)
03016 {
03017 FoundSlot = FoundBar->GetBarPos()->Slot;
03018 if (FoundSlot > ThisSlot)
03019 {
03020 break;
03021 }
03022 else if (FoundSlot == ThisSlot)
03023 {
03024 NumBarsInSlot++;
03025 INT32 FoundSize = FoundBar->GetBarSize();
03026 if (FoundSize > SizeOfBarsInSlot)
03027 SizeOfBarsInSlot = FoundSize;
03028 }
03029 FoundBar = (OILChildBar*)ChildBars.GetNext(FoundBar);
03030 }
03031
03032
03033 if (ThisSize != ControlSize)
03034 {
03035
03036 if (SizeOfBarsInSlot == 0)
03037 {
03038
03039 SetSlotSize(ThisSlot, ThisSize);
03040 }
03041 else
03042 {
03043
03044 if (SizeOfBarsInSlot == ControlSize)
03045 {
03046 InsertSlot(ThisSlot, ThisSize);
03047 }
03048 else
03049 {
03050
03051 SetSlotSize(ThisSlot, ThisSize);
03052 }
03053
03054 }
03055
03056 ThisBar->UpdatePos();
03057 ::SendMessage(ThisBar->GetHwnd(), WM_SETGALLERYSIZE, SlotSize[ThisSlot], ThisBar->GetExtent());
03058
03059 PlaceGalleryInSlot(ThisBar, ThisSlot);
03060
03061 return;
03062 }
03063
03064
03065
03066
03067 if (SizeOfBarsInSlot != 0 && SizeOfBarsInSlot != ControlSize)
03068 {
03069 InsertSlot(ThisSlot);
03070 return;
03071 }
03072
03073 INT32 AreaOverlapPercent = GetIntersectPercent(ThisBar);
03074
03075 if (AreaOverlapPercent > 30)
03076 {
03077
03078 InsertSlot(ThisSlot);
03079 }
03080 else if (AreaOverlapPercent > 0)
03081 {
03082
03083
03084 if (!PlaceBarInSlot(ThisBar,ThisSlot))
03085 {
03086
03087 InsertSlot(ThisSlot);
03088 }
03089
03090 }
03091
03092 }
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112 BOOL OILFixedDockingBar::PlaceBar(HWND hdialogbar,CPoint here, CSize size)
03113 {
03114
03115
03116 DoRecalc = FALSE;
03117 OILChildBar * NewChild;
03118
03119 if (IsBarInList(hdialogbar)!=NULL)
03120 {
03121
03122 TRACEALL( _T("ChildBar with this handle is already attached to this window\n"));
03123 return FALSE;
03124
03125 }
03126 if ((NewChild= new OILChildBar(hdialogbar,DockType,ControlSize))==NULL)
03127 {
03128
03129 TRACE( _T("Couldn't create new ChildBar"));
03130 return FALSE;
03131
03132 }
03133
03134 ScreenToClient(&here);
03135 PutInSlot(&here, NewChild->GetBarSize());
03136 NewChild->SetPos(here);
03137 PositionBar(NewChild);
03138 InsertBarInList(NewChild);
03139 TidySlots();
03140
03141 if (ChangedDock != NULL && ChangedDock != this)
03142 ((OILFixedDockingBar*)ChangedDock)->TidySlots();
03143
03144 if (DoRecalc && ! GetMainFrame()->IsChangingViewMode() )
03145 ((CFrameWnd*)Parent)->RecalcLayout();
03146 DoRecalc = FALSE ;
03147 ChangedDock = NULL;
03148
03149 #ifdef _DEBUG
03150 if (IsUserName("GerryX"))
03151 {
03152 Dump_List();
03153 }
03154 #endif
03155 return TRUE;
03156 }
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173 void OILFixedDockingBar::AppendToSlot(INT32 SlotNo,CPoint * here)
03174 {
03175 INT32 FoundSlot = 0;
03176 INT32 LastPos = 0;
03177 INT32 LastSlot = 0;
03178 INT32 size = 0 ;
03179 KernelBarPos* pFoundPos = NULL;
03180
03181 OILChildBar* FoundBar = (OILChildBar*)ChildBars.GetHead();
03182 while (FoundBar != NULL)
03183 {
03184 pFoundPos = FoundBar->GetBarPos();
03185 FoundSlot = pFoundPos->Slot;
03186 if (FoundSlot > SlotNo)
03187 {
03188 break;
03189 }
03190 else if (FoundSlot == SlotNo)
03191 {
03192 LastPos = pFoundPos->Position + FoundBar->GetExtent();
03193 }
03194 }
03195
03196
03197
03198
03199
03200
03201
03202
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222
03223
03224
03225
03226
03227
03228
03229
03230 switch (DockType)
03231 {
03232 case DOCKBAR_TOP:
03233 case DOCKBAR_BOTTOM:
03234 here->x = LastPos;
03235 break;
03236
03237 case DOCKBAR_LEFT:
03238 case DOCKBAR_RIGHT:
03239 here->y = LastPos;
03240 break;
03241 }
03242
03243 }
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260 BOOL OILFixedDockingBar::PlaceBar(HWND hdialogbar,KernelBarPos BarPos, CSize size)
03261 {
03262
03263
03264
03265
03266
03267 DoRecalc = FALSE ;
03268 CPoint here;
03269
03270 BarPosToClient(BarPos,&here);
03271
03272 OILChildBar * NewChild;
03273
03274 if (IsBarInList(hdialogbar)!=NULL)
03275 {
03276 ReleaseBar(hdialogbar,FALSE);
03277 }
03278 if ((NewChild= new OILChildBar(hdialogbar,DockType,ControlSize))==NULL)
03279 {
03280 TRACE( _T("Couldn't create new ChildBar"));
03281 return FALSE;
03282 }
03283
03284
03285 if (BarPos.Position == -1)
03286 {
03287 if (BarPos.Slot > NoOfSlots -1)
03288 {
03289 BarPos.Slot = NoOfSlots -1;
03290 BarPosToClient(BarPos,&here);
03291
03292 }
03293
03294 AppendToSlot(BarPos.Slot,&here);
03295 NewChild->SetPos(here);
03296 InsertBarInList(NewChild);
03297 INT32 SlotsNow = CountSlots();
03298 if (SlotsNow != NoOfSlots)
03299 {
03300 NoOfSlots = SlotsNow;
03301 DoRecalc = TRUE;
03302 }
03303 }
03304 else
03305 {
03306
03307 PutInSlot(&here, NewChild->GetBarSize());
03308 NewChild->SetPos(here);
03309 PositionBar(NewChild);
03310 InsertBarInList(NewChild);
03311 TidySlots();
03312 }
03313
03314
03315
03316 if (ChangedDock != NULL && ChangedDock != this)
03317 ((OILFixedDockingBar*)ChangedDock)->TidySlots();
03318
03319 if (DoRecalc && ! GetMainFrame()->IsChangingViewMode())
03320 ((CFrameWnd*)Parent)->RecalcLayout();
03321 DoRecalc = FALSE ;
03322
03323 ChangedDock = NULL;
03324
03325 #ifdef _DEBUG
03326 if (IsUserName("GerryX"))
03327 {
03328 Dump_List();
03329 }
03330 #endif
03331 return TRUE;
03332 }
03333
03334
03335
03336
03337
03338
03339
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350 BOOL OILFixedDockingBar::PlaceBarAt(HWND hdialogbar,KernelBarPos BarPos)
03351 {
03352
03353
03354 OILChildBar * ThisChild = (OILChildBar *) ChildBars.GetHead();
03355 while (ThisChild != NULL)
03356 {
03357 if (ThisChild->GetHwnd() == hdialogbar)
03358 {
03359 break;
03360 }
03361 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
03362 }
03363
03364 ENSURE(ThisChild!=NULL,"Can't find Bar in DockingBar List");
03365
03366 ThisChild->SetPos(BarPos);
03367
03368 return TRUE;
03369 }
03370
03371
03372
03373
03374
03375
03376
03377
03378
03379
03380
03381
03382
03383
03384
03385
03386
03387 BOOL OILFixedDockingBar::InsertBarInList(OILChildBar * ThisBar)
03388 {
03389
03390 ASSERT(ThisBar!=NULL);
03391 CPoint ThisPos=ThisBar->GetPos();
03392 CPoint FoundPos;
03393 OILChildBar * FoundBar =(OILChildBar *) ChildBars.GetHead();
03394
03395 INT32 FoundSlot;
03396 INT32 FoundPosition;
03397
03398 INT32 ThisSlot = PointToSlot(&ThisPos);
03399 INT32 ThisPosition = PointToPosition(&ThisPos);
03400
03401 while (FoundBar != NULL)
03402 {
03403 FoundPos = FoundBar->GetPos();
03404 FoundSlot = PointToSlot(&FoundPos);
03405 FoundPosition = PointToPosition(&FoundPos);
03406 if (FoundSlot > ThisSlot)
03407 {
03408 ChildBars.InsertBefore((ListItem *)FoundBar,(ListItem *)ThisBar);
03409 return TRUE;
03410 }
03411 else if (FoundSlot == ThisSlot)
03412 {
03413 if (FoundPosition > ThisPosition)
03414 {
03415 ChildBars.InsertBefore((ListItem *)FoundBar,(ListItem *)ThisBar);
03416 return TRUE;
03417 }
03418 }
03419 FoundBar =(OILChildBar *) ChildBars.GetNext(FoundBar);
03420 }
03421
03422
03423 ChildBars.AddTail((ListItem *)ThisBar);
03424 return TRUE;
03425 }
03426
03427
03428
03429
03430
03431
03432
03433
03434
03435
03436
03437
03438
03439
03440
03441
03442 BOOL OILFixedDockingBar::ReleaseBar(HWND hdialog,BOOL DoTidy)
03443 {
03444 DoRecalc = FALSE ;
03445
03446 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
03447 while (ThisChild != NULL)
03448 {
03449 if (ThisChild->GetHwnd() == hdialog)
03450 {
03451 if (!RemoveBar(ThisChild))
03452 return FALSE;
03453 ChangedDock = this;
03454 if (DoTidy)
03455 TidySlots();
03456 if (DoRecalc && ! GetMainFrame()->IsChangingViewMode())
03457 {
03458
03459
03460 if (!(GetApplication()->CamelotIsDying ()))
03461 {
03462 ((CFrameWnd*)Parent)->RecalcLayout();
03463 }
03464 }
03465 DoRecalc = FALSE ;
03466 return TRUE;
03467 }
03468 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
03469 }
03470
03471 return FALSE;
03472 }
03473
03474
03475
03476
03477
03478
03479
03480
03481
03482
03483
03484
03485
03486
03487
03488
03489
03490 BOOL OILFixedDockingBar::SetSlotSize(INT32 SlotNo, INT32 NewSize)
03491 {
03492 if (SlotNo < 0 ||
03493 SlotNo >= MAX_SLOTS ||
03494 NewSize < ControlSize)
03495 return(FALSE);
03496
03497
03498
03499
03500 if (NewSize < MIN_GALLERY_SLOT_WIDTH)
03501 NewSize = MIN_GALLERY_SLOT_WIDTH;
03502 INT32 OldSize = (SlotNo < NoOfSlots) ? SlotSize[SlotNo] : 0;
03503 INT32 TotalSize = TotalSlotSizes();
03504 CRect MainRect;
03505 GetMainFrame()->GetClientRect(&MainRect);
03506 INT32 MaxSize = (MainRect.Width() * 48) / 100;
03507 INT32 AmountToShrink = (NewSize > OldSize) ? (TotalSize - OldSize + NewSize) - MaxSize : 0;
03508 if (AmountToShrink < 0)
03509 AmountToShrink = 0;
03510
03511
03512 if (AmountToShrink > 0)
03513 {
03514 for (INT32 i = 0; i < NoOfSlots; i++)
03515 {
03516 if (i != SlotNo && SlotSize[i] != ControlSize)
03517 {
03518 INT32 OldSize = SlotSize[i];
03519 if (OldSize > MIN_GALLERY_SLOT_WIDTH)
03520 {
03521
03522 INT32 SetSize = (OldSize - AmountToShrink) < MIN_GALLERY_SLOT_WIDTH ? MIN_GALLERY_SLOT_WIDTH : OldSize - AmountToShrink;
03523
03524
03525 SetSlotSize(i, SetSize);
03526
03527
03528 AmountToShrink -= (OldSize - SlotSize[i]);
03529 }
03530 }
03531
03532 if (AmountToShrink == 0)
03533 break;
03534 }
03535 }
03536
03537 NewSize -= AmountToShrink;
03538 if (NewSize >= MIN_GALLERY_SLOT_WIDTH)
03539 {
03540 SlotSize[SlotNo] = NewSize;
03541 }
03542
03543 KernelBarPos* FoundPos;
03544 OILChildBar* FoundBar = (OILChildBar*) ChildBars.GetHead();
03545 DoRecalc = TRUE;
03546
03547
03548
03549
03550 while (FoundBar != NULL)
03551 {
03552 FoundPos = FoundBar->GetBarPos();
03553 if (FoundPos->Slot == SlotNo)
03554 {
03555 ::SendMessage(FoundBar->GetHwnd(), WM_SETGALLERYSIZE, NewSize, FoundBar->GetExtent());
03556 }
03557 else
03558 {
03559 FoundBar->UpdatePos();
03560 }
03561 FoundBar =(OILChildBar*) ChildBars.GetNext(FoundBar);
03562
03563 }
03564
03565
03566 return(TRUE);
03567 }
03568
03569
03570
03571
03573
03575
03576
03577 IMPLEMENT_DYNAMIC(OILFloaters ,OILDockingBar)
03578
03579
03580
03581
03583
03584 BEGIN_MESSAGE_MAP( OILFloaters, OILDockingBar )
03585
03586 ON_WM_LBUTTONDOWN()
03587 ON_WM_RBUTTONDOWN()
03588 ON_WM_LBUTTONDBLCLK()
03589 ON_MESSAGE(WM_SIZEPARENT, OnSizeParent)
03590
03591 END_MESSAGE_MAP( )
03592
03593
03594
03595
03596
03597
03598
03599
03600
03601
03602
03603
03604
03605
03606
03607
03608 BOOL OILFloaters::Create(CWnd* pParentWnd)
03609 {
03610
03611 ASSERT_VALID(pParentWnd);
03612
03613 Parent = pParentWnd;
03614
03615 DockType = DOCKBAR_FLOAT;
03616 return TRUE;
03617 }
03618
03619
03620
03621
03622
03623
03624
03625
03626
03627
03628
03629
03630
03631
03632
03633
03634 OILFloaters::OILFloaters()
03635 {
03636 ControlSize = SMALL_CONTROLS;
03637 HasBigControls = FALSE;
03638 }
03639
03640
03641
03642
03643
03644
03645
03646
03647
03648
03649
03650
03651
03652
03653
03654
03655
03656 BOOL OILFloaters::DeleteBars()
03657 {
03658 ControlSize = SMALL_CONTROLS;
03659 HasBigControls = FALSE;
03660 ChildBars.DeleteAll();
03661 return TRUE;
03662 }
03663
03664
03665
03666
03667
03668
03669
03670
03671
03672
03673
03674
03675
03676
03677
03678
03679
03680 BOOL OILFloaters::PlaceBar(HWND hdialogbar,CPoint here, CSize size)
03681 {
03682
03683 DoRecalc = FALSE ;
03684 OILChildBar * NewChild;
03685
03686 if ((NewChild = new OILChildBar(hdialogbar,DockType,ControlSize))==NULL)
03687 {
03688 TRACE( _T("Couldn't create new ChildBar/n"));
03689 return FALSE;
03690 }
03691
03692 NewChild->SetPos(here, size);
03693 InsertBarInList(NewChild);
03694
03695 if (ChangedDock != NULL && ChangedDock != this)
03696 ((OILFixedDockingBar*)ChangedDock)->TidySlots();
03697
03698 if (DoRecalc)
03699 ((CFrameWnd*)Parent)->RecalcLayout();
03700 DoRecalc = FALSE ;
03701 ChangedDock=NULL;
03702
03703 #ifdef _DEBUG
03704 if (IsUserName("GerryX"))
03705 {
03706 Dump_List();
03707 }
03708 #endif
03709
03710 return TRUE;
03711 }
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728
03729
03730
03731
03732 BOOL OILFloaters::PlaceBar(HWND hdialogbar,KernelBarPos BarPos, CSize size)
03733 {
03734
03735
03736 DoRecalc = FALSE ;
03737 OILChildBar * NewChild;
03738 if ((NewChild= new OILChildBar(hdialogbar,DockType,ControlSize))==NULL)
03739 {
03740 TRACEALL( _T("Couldn't create new ChildBar\n"));
03741 return FALSE;
03742 }
03743
03744 NewChild->SetPos(BarPos);
03745 InsertBarInList(NewChild);
03746
03747 if (ChangedDock != NULL && ChangedDock != this)
03748 ((OILFixedDockingBar*)ChangedDock)->TidySlots();
03749
03750 if (DoRecalc)
03751 ((CFrameWnd*)Parent)->RecalcLayout();
03752 DoRecalc = FALSE ;
03753
03754 ChangedDock=NULL;
03755
03756 #ifdef _DEBUG
03757 if (IsUserName("GerryX"))
03758 {
03759 Dump_List();
03760 }
03761 #endif
03762 return TRUE;
03763 }
03764
03765
03766
03767
03768
03769
03770
03771
03772
03773
03774
03775
03776
03777
03778
03779
03780 BOOL OILFloaters::InsertBarInList(OILChildBar * ThisBar)
03781 {
03782
03783 ASSERT(ThisBar!=NULL);
03784
03785 ChildBars.AddTail((ListItem *)ThisBar);
03786
03787 return TRUE;
03788 }
03789
03790
03791
03792
03793
03794
03795
03796
03797
03798
03799
03800
03801
03802
03803
03804
03805 BOOL OILFloaters::ReleaseBar(HWND hdialog,BOOL DoTidy)
03806 {
03807
03808 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
03809 while (ThisChild != NULL)
03810 {
03811
03812 if (ThisChild->GetHwnd() == hdialog)
03813 {
03814 RemoveBar(ThisChild);
03815 return TRUE;
03816 }
03817 ThisChild =(OILChildBar *) ChildBars.GetNext(ThisChild);
03818
03819 }
03820
03821 return FALSE;
03822 }
03823
03824
03825
03826
03827
03828
03829
03830
03831
03832
03833
03834
03835
03836
03837
03838
03839
03840 BOOL OILFloaters::RecreateBarsAfterSettingChange()
03841 {
03842
03843 if(!BaseBar::HaveNonClientMetricsChanged())
03844 return FALSE;
03845
03846 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
03847 OILChildBar * Next;
03848 OILChildBar * EndList =(OILChildBar *) ChildBars.GetTail();
03849
03850
03851 while (ThisChild != NULL)
03852 {
03853 Next =(OILChildBar *) ChildBars.GetNext(ThisChild);
03854 ::SendMessage(ThisChild->GetHwnd(), WM_RESIZECONTROLS, 0,0);
03855
03856 ThisChild = Next;
03857 if (ThisChild == NULL) break;
03858
03859 if (ThisChild == EndList)
03860 {
03861 ::SendMessage(ThisChild->GetHwnd(), WM_RESIZECONTROLS, 0,0);
03862 break;
03863 }
03864 }
03865
03866 return TRUE;
03867 }
03868
03869
03870
03871
03872
03873
03874
03875
03876
03877
03878
03879
03880
03881
03882
03883 void OILFloaters::SetBigControlState(BOOL Big )
03884 {
03885 if (Big != HasBigControls)
03886 {
03887 HasBigControls = Big;
03888 if (Big)
03889
03890 ControlSize = LARGE_CONTROLS;
03891 else
03892
03893 ControlSize = SMALL_CONTROLS;
03894
03895
03896
03897 OILChildBar * ThisChild =(OILChildBar *) ChildBars.GetHead();
03898 OILChildBar * Next;
03899 OILChildBar * EndList =(OILChildBar *) ChildBars.GetTail();
03900
03901
03902 while (ThisChild != NULL)
03903 {
03904 Next =(OILChildBar *) ChildBars.GetNext(ThisChild);
03905 ::SendMessage(ThisChild->GetHwnd(), WM_RESIZECONTROLS, 0,0);
03906
03907 ThisChild = Next;
03908 if (ThisChild == NULL) break;
03909
03910 if (ThisChild == EndList)
03911 {
03912 ::SendMessage(ThisChild->GetHwnd(), WM_RESIZECONTROLS, 0,0);
03913 break;
03914 }
03915 }
03916 }
03917 }
03918
03919
03920
03922
03924
03925 #ifdef _DEBUG
03926 void OILFixedDockingBar::AssertValid() const
03927 {
03928 CControlBar::AssertValid();
03929 }
03930
03931 void OILFixedDockingBar::Dump(CDumpContext& dc) const
03932 {
03933 CControlBar::Dump(dc);
03934 AFX_DUMP1(dc, "\nControlSize = ", (UINT32)ControlSize);
03935 AFX_DUMP1(dc, "\nNo Of Slots = ", (UINT32)NoOfSlots);
03936 AFX_DUMP1(dc, "\nWidth = ", (UINT32)DockSize.cx);
03937 AFX_DUMP1(dc, "\nHeight = ", DockSize.cy);
03938 }
03939
03940 void OILFixedDockingBar::Dump_List()
03941 {
03942
03943 CPoint ThisPos;
03944 KernelBarPos * KPos;
03945
03946 TRACE( _T("FIXED DOCK BAR ----------\n"));
03947 OILChildBar * FoundBar =(OILChildBar *) ChildBars.GetHead();
03948 while (FoundBar != NULL)
03949 {
03950 KPos=FoundBar->GetBarPos();
03951 TRACE( _T("Kernel Data slot - %d pos - %d DockType - %d\n"),KPos->Slot,KPos->Position,KPos->Dock);
03952 ThisPos=FoundBar->GetPos();
03953 TRACE( _T("Dump Bar slot - %d pos - %d\n"),PointToSlot(&ThisPos),PointToPosition(&ThisPos));
03954 FoundBar =(OILChildBar *) ChildBars.GetNext(FoundBar);
03955 }
03956 TRACE( _T("....................................................................................\n"));
03957
03958 }
03959
03960 #endif
03961
03963
03965
03966 #ifdef _DEBUG
03967 void OILDockingBar::AssertValid() const
03968 {
03969 CControlBar::AssertValid();
03970 }
03971
03972 void OILDockingBar::Dump(CDumpContext& dc) const
03973 {
03974 CControlBar::Dump(dc);
03975
03976 }
03977
03978 void OILDockingBar::Dump_List()
03979 {
03980
03981 }
03982
03983 #endif
03984
03986
03988
03989 #ifdef _DEBUG
03990 void OILFloaters::AssertValid() const
03991 {
03992 CControlBar::AssertValid();
03993 }
03994
03995 void OILFloaters::Dump(CDumpContext& dc) const
03996 {
03997 CControlBar::Dump(dc);
03998
03999 }
04000
04001 void OILFloaters::Dump_List()
04002 {
04003
04004 CPoint ThisPos;
04005 KernelBarPos * KPos;
04006
04007 TRACE( _T("..... FLOATING BARS .....\n "));
04008 OILChildBar * FoundBar =(OILChildBar *) ChildBars.GetHead();
04009 while (FoundBar != NULL)
04010 {
04011 KPos=FoundBar->GetBarPos();
04012 TRACE( _T("Kernel Data slot - %d pos - %d Type - %d\n"),KPos->x,KPos->y,KPos->Dock);
04013 ThisPos=FoundBar->GetPos();
04014 TRACE( _T("Dump Bar Hwnd %d\n"),FoundBar->GetHwnd());
04015 FoundBar =(OILChildBar *) ChildBars.GetNext(FoundBar);
04016 }
04017 TRACE( _T("..................................................................................\n"));
04018
04019 }
04020
04021 #endif
04022
04023 #endif