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
00100
00101
00102 #include "camtypes.h"
00103
00104 #include "dlgmgr.h"
00105
00106
00107
00108
00109
00110
00111
00112 #include "infobar.h"
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 #include "ccdc.h"
00124
00125
00126
00127
00128
00129 #include "camelot.h"
00130 #include "camframe.h"
00131
00132 #include "stack.h"
00133 #include "dropdown.h"
00134 #include "griddropdown.h"
00135 #include "unicdman.h"
00136 #include "appprefs.h"
00137 #include "helpuser.h"
00138
00139
00140
00141
00142
00143
00144 #include "dlgevt.h"
00145 #include "cartprov.h"
00146 #include "cartctl.h"
00147 #include "osrndrgn.h"
00148
00149 #include "statline.h"
00150 #include <wx/imaglist.h>
00151
00152 DECLARE_SOURCE("$Revision: 1770 $");
00153
00154 CC_IMPLEMENT_DYNAMIC(CGadgetImageList, CCObject);
00155
00156
00157 #define new CAM_DEBUG_NEW
00158
00159
00160
00161
00162
00163 List DialogManager::DiscardStrList;
00164 List DialogManager::ScrollPageIncList;
00165 List DialogManager::DialogPositionList;
00166
00167 IdToSerializedPaneInfo * DialogManager::s_pPaneInfoHash = NULL;
00168
00169 wxWindow *DialogManager::pDlgCurrent = NULL;
00170
00171
00172
00173 ActiveDlgStateStack DialogManager::ActiveDlgStack;
00174
00175
00176
00177 #define BN_RGT_CLICKED 6
00178
00179
00180 class Node;
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 DialogManager::DialogManager()
00193 {
00194
00195 }
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 class wxDynamicPropertySheetDialog : public wxPropertySheetDialog
00259 {
00260 public:
00261 wxDynamicPropertySheetDialog() {m_TabType=TABTYPE_TABS;}
00262 ~wxDynamicPropertySheetDialog() {}
00263 void SetTabType(TabType t) {m_TabType=t;}
00264 protected:
00265 TabType m_TabType;
00266 virtual wxBookCtrlBase* CreateBookCtrl()
00267 {
00268 INT32 style = wxCLIP_CHILDREN | wxBC_DEFAULT;
00269 wxBookCtrlBase* pBook = NULL;
00270
00271 switch (m_TabType)
00272 {
00273 #if wxUSE_LISTBOOK
00274 case TABTYPE_LIST:
00275 return new wxListbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
00276 break;
00277 #endif
00278 #if wxUSE_CHOICEBOOK
00279 case TABTYPE_CHOICE:
00280 return new wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
00281 break;
00282 #endif
00283 #if wxUSE_TREEBOOK || wxXTRA_TREEBOOK
00284 case TABTYPE_TREE:
00285 {
00286 wxTreebook * t = new wxTreebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
00287 if (t)
00288 t->GetTreeCtrl()->SetIndent(0);
00289 return t;
00290 }
00291 break;
00292 #else
00293
00294 case TABTYPE_TREE:
00295 return new wxListbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
00296 break;
00297 #endif
00298 #if wxUSE_TOOLBOOK
00299 case TABTYPE_TOOLBAR:
00300 return new wxToolbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
00301 break;
00302 #endif
00303 case TABTYPE_TABS:
00304 default:
00305 pBook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
00306
00307 PORTNOTE("dialog", "This should probably be applied to all controls eventually")
00308
00309 wxFont fontDefault = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
00310 fontDefault.SetPointSize( 8 );
00311 pBook->SetFont( fontDefault );
00312
00313 break;
00314 }
00315
00316 return pBook;
00317 }
00318 };
00319
00320 BOOL DialogManager::Create(DialogOp* DlgOp,
00321 CDlgResID MainDlgID,
00322 CDlgResID SubDlgID,
00323 CDlgMode Mode, INT32 OpeningPage, CWindowID ParentWnd)
00324 {
00325 ERROR2IF(!DlgOp, FALSE, _T("Create Passed Null DialogOp"));
00326 ERROR2IF(DlgOp->pEvtHandler, FALSE, _T("Window has already been created. Having two is greedy"));
00327
00328 DlgOp->pEvtHandler = new DialogEventHandler(DlgOp);
00329 ERRORIF(!DlgOp->pEvtHandler || !DlgOp->pEvtHandler->pDialogOp, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00330
00331 BOOL wxAUImanaged = FALSE;
00332 if ( DlgOp->IsABar() || DlgOp->IsAGallery() )
00333 {
00334 BOOL modal = DlgOp->IsModal();
00335 ERROR2IF(modal, FALSE, "Attempting to create a wxAUImanaged Dialog that is modal");
00336
00337 wxAUImanaged = TRUE;
00338 }
00339
00340
00341
00342 ERROR2IF( SubDlgID !=0, FALSE, _T("Merging of dialogs not yet supported"));
00343
00344
00345 if ((ParentWnd == NULL) || wxAUImanaged)
00346 ParentWnd = GetMainFrame();
00347
00348 const TCHAR* pDialogName = NULL;
00349 wxWindow* pDialogWnd = NULL;
00350
00351 if( DlgOp->IS_KIND_OF(DialogTabOp) && !(((DialogTabOp*)DlgOp)->LoadFrameFromResources()))
00352 {
00353
00354 wxDynamicPropertySheetDialog* pPropertySheet;
00355
00356
00357 pPropertySheet = new wxDynamicPropertySheetDialog();
00358 if (pPropertySheet)
00359 {
00360 pPropertySheet->SetTabType(((DialogTabOp*)DlgOp)->GetTabType());
00361 if (!pPropertySheet->Create((wxWindow *)ParentWnd, wxID_ANY, (TCHAR*) (*((DialogTabOp*)DlgOp)->GetName()) ))
00362 {
00363 delete pPropertySheet;
00364 pPropertySheet=NULL;
00365 }
00366 else
00367 {
00368 wxStdDialogButtonSizer *sizer = new wxStdDialogButtonSizer();
00369 wxButton * ok=new wxButton(pPropertySheet, wxID_OK);
00370 sizer->AddButton(ok);
00371 sizer->AddButton(new wxButton(pPropertySheet, wxID_CANCEL));
00372 sizer->AddButton(new wxButton(pPropertySheet, wxID_APPLY));
00373 sizer->AddButton(new wxButton(pPropertySheet, wxID_HELP));
00374 ok->SetDefault();
00375 ok->SetFocus();
00376 pPropertySheet->SetAffirmativeId(wxID_OK);
00377 sizer->Realize();
00378 pPropertySheet->GetInnerSizer()->Add( sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2);
00379 pPropertySheet->GetInnerSizer()->AddSpacer(2);
00380 }
00381 }
00382 pDialogWnd=pPropertySheet;
00383 }
00384 else
00385 {
00386 pDialogName=CamResource::GetObjectNameFail(MainDlgID);
00387 ERROR1IF(pDialogName == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00388
00389 PORTNOTE("dialog","A more general scheme is needed to allow creation of a panel for non-toolbar type dialog")
00390 if (wxAUImanaged || _R(IDD_BITMAPPREVIEWDIALOG) == MainDlgID )
00391 pDialogWnd = wxXmlResource::Get()->LoadPanel((wxWindow *)ParentWnd, pDialogName);
00392 else
00393 pDialogWnd = wxXmlResource::Get()->LoadDialog((wxWindow *)ParentWnd, pDialogName);
00394 }
00395
00396 ERROR1IF(pDialogWnd == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00397
00398 pDialogWnd->Hide();
00399 CamArtProvider::Get()->EnsureChildBitmapsLoaded(pDialogWnd);
00400
00401
00402 #ifdef __WXMAC__
00403 pDialogWnd->SetBackgroundStyle(wxBG_STYLE_COLOUR);
00404 pDialogWnd->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
00405 #endif
00406
00407
00408
00409
00410 DlgOp->pEvtHandler->pwxWindow = pDialogWnd;
00411 DlgOp->pEvtHandler->wxAUImanaged = wxAUImanaged;
00412 DlgOp->pEvtHandler->ID =MainDlgID;
00413
00414 DlgOp->WindowID = (CWindowID)pDialogWnd;
00415 pDialogWnd->PushEventHandler(DlgOp->pEvtHandler);
00416
00417 if (DlgOp->IS_KIND_OF(DialogTabOp))
00418 {
00419
00420
00421
00422 if (!CreateTabbedDialog( (DialogTabOp*)DlgOp, Mode, OpeningPage, MainDlgID ))
00423 {
00424
00425 Delete(pDialogWnd, DlgOp);
00426 ERROR1(FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00427 }
00428 }
00429
00430 CreateRecursor(pDialogWnd);
00431
00432
00433 ControlList::Get()->RegisterWindowAndChildren(pDialogWnd, DlgOp);
00434
00435 ControlList::Get()->ReflectAllStates();
00436
00437
00438 BOOL ok = PostCreate(DlgOp, OpeningPage);
00439
00440 if( ok &&
00441 Mode == MODAL &&
00442 pDialogWnd->IsKindOf( CLASSINFO(wxDialog) ) )
00443 {
00444 ((wxDialog *) pDialogWnd)->ShowModal();
00445 }
00446
00447 #ifdef USE_WXAUI
00448 if (wxAUImanaged)
00449 {
00450 wxString Title = wxEmptyString;
00451 if (pDialogWnd->IsKindOf(CLASSINFO(wxDialog)))
00452 Title=((wxDialog *)pDialogWnd)->GetTitle();
00453 if (Title.IsEmpty()) Title = pDialogWnd->GetLabel();
00454 if (Title.IsEmpty())
00455 {
00456 const TCHAR * ResString=CamResource::GetTextFail(pDialogWnd->GetId());
00457 if (ResString)
00458 Title=wxString(ResString);
00459 }
00460 if (Title.IsEmpty())
00461 {
00462
00463
00464 wxToolTip* pTip = pDialogWnd->GetToolTip();
00465 if (pTip) Title=pTip->GetTip();
00466 }
00467 if (Title.IsEmpty())
00468 Title = wxString(CamResource::GetText(_R(IDS_ANONYMOUSBARTITLE)));
00469
00470
00471
00472
00473
00474 wxAuiPaneInfo paneinfo;
00475 if (!DlgOp->IsABar())
00476 {
00477
00478 paneinfo.FloatingSize(100,300);
00479 }
00480 LoadPaneInfo(wxString(CamResource::GetObjectName(pDialogWnd->GetId())), paneinfo);
00481 paneinfo.DestroyOnClose(FALSE);
00482 if (DlgOp->IsABar())
00483 {
00484 if (DlgOp->IsKindOf(CC_RUNTIME_CLASS(StatusLine)))
00485 paneinfo.Bottom().Layer(1).Row(2).LeftDockable(FALSE).RightDockable(FALSE).Floatable(FALSE).Movable(FALSE).Gripper(FALSE).CaptionVisible(FALSE).PaneBorder(FALSE);
00486 else
00487 {
00488 paneinfo.ToolbarPane().Fixed();
00489 if (DlgOp->IsVertical())
00490 {
00491 paneinfo.Left().Layer(0).GripperTop().TopDockable(FALSE).BottomDockable(FALSE);
00492 }
00493 else
00494 {
00495 paneinfo.Top().Layer(1).Row(2).LeftDockable(FALSE).RightDockable(FALSE);
00496 }
00497 }
00498 }
00499 else
00500 {
00501
00502 paneinfo.Layer(3).GripperTop().TopDockable(FALSE).BottomDockable(FALSE).Float().Dockable(FALSE);
00503 }
00504
00505 if (DlgOp->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)))
00506 {
00507 paneinfo.Floatable(FALSE);
00508
00509
00510 }
00511
00512 paneinfo.Name(pDialogName).Caption(Title).PinButton(TRUE);
00513
00514 wxSizer * pSizer = pDialogWnd->GetSizer();
00515 if (pSizer)
00516 {
00517 pSizer->SetSizeHints(pDialogWnd);
00518 pDialogWnd->SetSizerAndFit(pSizer);
00519 }
00520
00521
00522
00523 if (paneinfo.IsFloating() && !CCamFrame::GetFrameManager()->GetManagedWindow()->IsShown())
00524 CCamFrame::GetFrameManager()->GetManagedWindow()->Show();
00525
00526 CCamFrame::GetFrameManager()->AddPane(pDialogWnd, paneinfo);
00527
00528 CCamFrame::GetMainFrame()->UpdateFrameManager();
00529
00530
00531
00532 wxWindow * pTLW = pDialogWnd;
00533 while (pTLW->GetParent())
00534 pTLW=pTLW->GetParent();
00535 if (pTLW->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
00536 pTLW->Raise();
00537
00538 }
00539 #endif
00540
00541 return ok;
00542 }
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560 void DialogManager::CreateRecursor(wxWindow * pwxWindow)
00561 {
00562
00563 wxPlatformDependent::Get()->InitWindow(pwxWindow);
00564
00565
00566 if (pwxWindow->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
00567 {
00568 ((wxOwnerDrawnComboBox*)pwxWindow)->SetPopupMaxHeight(600);
00569 ((wxOwnerDrawnComboBox*)pwxWindow)->SetPopupAnchor(wxLEFT);
00570 }
00571
00572
00573 wxWindowList::Node * pNode = pwxWindow->GetChildren().GetFirst();
00574 while (pNode)
00575 {
00576 CreateRecursor(pNode->GetData());
00577 pNode = pNode->GetNext();
00578 }
00579 return;
00580 }
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602 BOOL DialogManager::PostCreate(DialogOp * pDialogOp, INT32 OpeningPage)
00603 {
00604 ERROR2IF( !pDialogOp || !pDialogOp->pEvtHandler || !pDialogOp->pEvtHandler->pwxWindow,
00605 FALSE, _T("Bad DialogOp / EvtHandler in DialogManager::PostCreate()"));
00606
00607 wxWindow * pDialogWnd = pDialogOp->pEvtHandler->pwxWindow;
00608
00609
00610 INT32 DlgX=0;
00611 INT32 DlgY=0;
00612 CDlgResID ActivePage=0;
00613 UINT32 ActivePageIndex=0;
00614
00615 BOOL CreatedBefore = FALSE;
00616
00617 wxBookCtrlBase * pBook=NULL;
00618
00619 if (pDialogOp->IS_KIND_OF(DialogTabOp))
00620 pBook=GetBookControl(pDialogWnd);
00621
00622 ResourceID BookGadget=pBook?pBook->GetId():0;
00623
00624 if (pBook && (OpeningPage>=0))
00625 {
00626 ActivePage = pBook->GetPage(OpeningPage)->GetId();
00627 ActivePageIndex = OpeningPage;
00628 }
00629
00630
00631 DialogPosition* DlgPos = FindDialogPositionRecord(pDialogOp->pEvtHandler->ID);
00632 if (DlgPos != NULL)
00633 {
00634 DlgX = DlgPos->LastX;
00635 DlgY = DlgPos->LastY;
00636
00637
00638 if (OpeningPage<0)
00639 {
00640 ActivePage = DlgPos->ActivePage;
00641 ActivePageIndex = DlgPos->ActivePageIndex;
00642 }
00643 CreatedBefore = TRUE;
00644 }
00645
00646 if (pBook && ((ActivePageIndex<0) ||
00647 (ActivePageIndex >= pBook->GetPageCount()) ||
00648 ((UINT32)(pBook->GetPage(ActivePageIndex)->GetId()) != ActivePage)
00649 ))
00650 {
00651 ActivePageIndex=0;
00652 ActivePage = pBook->GetPage(0)->GetId();
00653 }
00654
00655
00656 wxRect DialogRect( pDialogWnd->GetRect() );
00657 INT32 DialogWidth = DialogRect.GetWidth();
00658 INT32 DialogHeight = DialogRect.GetHeight();
00659
00660
00661 CWindowIDItem *pWinID = new CWindowIDItem;
00662 if( NULL == pWinID )
00663 {
00664
00665 pDialogWnd->PopEventHandler(FALSE);
00666 pDialogOp->pEvtHandler->Destroy();
00667 pDialogWnd->Destroy();
00668 ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY));
00669 }
00670
00671
00672 if (!CreatedBefore)
00673
00674 {
00675
00676 INT32 ScreenWidth = wxSystemSettings::GetMetric( wxSYS_SCREEN_X );
00677 INT32 ScreenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
00678
00679
00680 DlgX = (ScreenWidth - DialogWidth) / 2;
00681 DlgY = (ScreenHeight - DialogHeight) / 2;
00682
00683
00684 DlgPos = new DialogPosition;
00685 if (DlgPos == NULL)
00686 {
00687
00688 pDialogWnd->PopEventHandler(FALSE);
00689 pDialogOp->pEvtHandler->Destroy();
00690 pDialogWnd->Destroy();
00691 return FALSE;
00692 }
00693 DlgPos->DlgResourceID = pDialogOp->pEvtHandler->ID;
00694
00695
00696
00697
00698 DlgPos->LastX = DlgX;
00699 DlgPos->LastY = DlgY;
00700
00701 DlgPos->ActivePage = 0;
00702 DlgPos->ActivePageIndex=0;
00703
00704 if (pBook)
00705 {
00706
00707 DlgPos->ActivePage = ActivePage;
00708 DlgPos->ActivePageIndex = ActivePageIndex;
00709 }
00710
00711 DialogPositionList.AddHead((ListItem*)DlgPos);
00712 }
00713
00714
00715 pWinID->DlgWin = pDialogWnd;
00716 DlgPos->DlgWinList.AddTail( pWinID );
00717
00718
00719 pDialogWnd->SetSize(DlgX, DlgY, DialogWidth, DialogHeight);
00720
00721
00722 PORTNOTE("dialog","Removed FontFactory usage")
00723 #ifndef EXCLUDE_FROM_XARALX
00724 if( UnicodeManager::IsDBCSOS() )
00725 FontFactory::ApplyFontToWindow( DialogWnd, STOCKFONT_DIALOG ); */
00726 #endif
00727
00728
00729
00730
00731
00732 BROADCAST_TO_CLASS( DialogMsg( pDialogOp->WindowID, DIM_CREATE, 0 ), DialogOp );
00733
00734 if (pBook)
00735 {
00736
00737 UINT32 i;
00738 for (i=0; i<pBook->GetPageCount(); i++)
00739 {
00740 BROADCAST_TO_CLASS(DialogMsg(pDialogOp->WindowID, DIM_CREATE, BookGadget, 0, pBook->GetPage(i)->GetId()) ,DialogOp);
00741 }
00742
00743
00744 BROADCAST_TO_CLASS( DialogMsg( pDialogOp->WindowID, DIM_SET_ACTIVE, BookGadget, 0, ActivePage ), DialogOp );
00745 pBook->SetSelection(ActivePageIndex);
00746 }
00747
00748
00749
00750
00751 if( !GetMainFrame()->IsEnabled() )
00752 {
00753 EnableAllDialogs(FALSE, pDialogWnd);
00754 }
00755
00756 return TRUE;
00757 }
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773 void DialogManager::InitPaneInfoHash()
00774 {
00775 if (s_pPaneInfoHash)
00776 return;
00777
00778 s_pPaneInfoHash = new IdToSerializedPaneInfo;
00779 }
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798 void DialogManager::FreePaneInfoHash()
00799 {
00800 if (s_pPaneInfoHash)
00801 {
00802 delete s_pPaneInfoHash;
00803 s_pPaneInfoHash = NULL;
00804 }
00805 }
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821 void DialogManager::EnsurePanePreferenceDeclared(wxString key)
00822 {
00823 if (!s_pPaneInfoHash)
00824 InitPaneInfoHash();
00825
00826 if (!s_pPaneInfoHash)
00827 return;
00828
00829 IdToSerializedPaneInfo::iterator i=s_pPaneInfoHash->find(key);
00830 if (i==s_pPaneInfoHash->end())
00831 {
00832
00833
00834 (*s_pPaneInfoHash)[key]=_T("");
00835 i=s_pPaneInfoHash->find(key);
00836 if (i==s_pPaneInfoHash->end())
00837 {
00838 ERROR3("This hash leaks like a seive");
00839 return;
00840 }
00841
00842
00843 if (Camelot.DeclareSection(_T("BarPositions"), 10))
00844 {
00845 Camelot.DeclarePref( NULL, (TCHAR *)(key.c_str()), &(i->second) );
00846 }
00847 }
00848 }
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866 void DialogManager::LoadPaneInfo(wxString key, wxAuiPaneInfo &paneinfo)
00867 {
00868 if (!s_pPaneInfoHash)
00869 InitPaneInfoHash();
00870
00871 if (!s_pPaneInfoHash)
00872 return;
00873
00874 EnsurePanePreferenceDeclared(key);
00875
00876 IdToSerializedPaneInfo::iterator i=s_pPaneInfoHash->find(key);
00877 if (i==s_pPaneInfoHash->end())
00878 return;
00879
00880
00881 if (i->second.IsEmpty())
00882 return;
00883
00884 TRACEUSER("amb", _T("key=%s"), (const TCHAR *)key);
00885 TRACEUSER("amb", _T("val=%s"), (const TCHAR *)(i->second));
00886
00887 wxString name = (wxString)((const TCHAR *)(i->second));
00888 CCamFrame::GetFrameManager()->LoadPaneInfo(name, paneinfo);
00889 }
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905 void DialogManager::SavePaneInfo(wxString key, wxAuiPaneInfo &paneinfo)
00906 {
00907
00908 if ((paneinfo.IsOk()) && (paneinfo.IsFloating()))
00909 {
00910 paneinfo.FloatingSize(paneinfo.window->GetParent()->GetSize());
00911 }
00912
00913 if (!s_pPaneInfoHash)
00914 InitPaneInfoHash();
00915
00916 if (!s_pPaneInfoHash)
00917 return;
00918
00919 EnsurePanePreferenceDeclared(key);
00920
00921 (*s_pPaneInfoHash)[key]=CCamFrame::GetFrameManager()->SavePaneInfo(paneinfo);
00922 }
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940 DialogPosition* DialogManager::FindDialogPositionRecord(CDlgResID DialogID)
00941 {
00942
00943 DialogPosition* DlgPos = (DialogPosition*)(DialogPositionList.GetHead());
00944 while (DlgPos != NULL)
00945 {
00946 if (DlgPos->DlgResourceID == DialogID)
00947 {
00948 return DlgPos;
00949 break;
00950 }
00951
00952 DlgPos = (DialogPosition*)(DialogPositionList.GetNext((ListItem*)DlgPos));
00953 }
00954 return NULL;
00955 }
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973 void DialogManager::Open(CWindowID WindowID, DialogOp* pDlgOp)
00974 {
00975
00976 PORTNOTE("dialog","Removed DialogBarOp usage")
00977 #ifndef EXCLUDE_FROM_XARALX
00978 if (pDlgOp->IsKindOf(CC_RUNTIME_CLASS(DialogBarOp)))
00979 {
00980
00981 BaseBar *pCWnd = (wxWindow *)WindowID;
00982 ENSURE( pCWnd != NULL, "Could not find bar object" );
00983
00984 if( pCWnd != NULL )
00985 {
00986 pCWnd->Show( (DialogBarOp *)pDlgOp );
00987 }
00988 }
00989 else
00990 #endif
00991 if( !pDlgOp->IsModal() )
00992 {
00993 ( (wxWindow *)WindowID )->Show( true );
00994 }
00995
00996 if (pDlgOp->pEvtHandler->wxAUImanaged)
00997 CCamFrame::GetMainFrame()->UpdateFrameManager();
00998
00999 }
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017 void DialogManager::Close(CWindowID WindowID, DialogOp* pDlgOp)
01018 {
01019
01020
01021
01022 PORTNOTE("dialog","Removed DialogBarOp usage")
01023 #ifndef EXCLUDE_FROM_XARALX
01024 if (pDlgOp->IsKindOf(CC_RUNTIME_CLASS(DialogBarOp)))
01025 {
01026
01027 wxWindow* pCWnd = CWnd::FromHandlePermanent(WindowID);
01028 ENSURE(pCWnd != NULL, "Could not find bar object");
01029
01030 if (pCWnd != NULL)
01031 {
01032 ((BaseBar*)pCWnd)->Hide((DialogBarOp*)pDlgOp);
01033 }
01034 }
01035 else
01036 #endif
01037 if (!(pDlgOp->IsModal()))
01038 {
01039 ENSURE(WindowID != NULL,"NULL WindowID");
01040 ( (wxWindow *)WindowID )->Show( false );
01041 }
01042
01043 if (pDlgOp->pEvtHandler->wxAUImanaged)
01044 CCamFrame::GetMainFrame()->UpdateFrameManager();
01045 }
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060 BOOL DialogManager::MergeDialogs( CWindowID Dialog, CWindowID Mergee, bool fAbove )
01061 {
01062 wxSizer* pMainSizer = Dialog->GetSizer();
01063 wxSizer* pVertSizer( new wxBoxSizer( wxVERTICAL ) );
01064 if( fAbove )
01065 pVertSizer->Add( Mergee, wxALL );
01066 pVertSizer->Add( pMainSizer );
01067 if( !fAbove )
01068 pVertSizer->Add( Mergee, wxALL );
01069
01070 Dialog->SetSizerAndFit( pVertSizer, false );
01071 return TRUE;
01072 }
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087 BOOL DialogManager::BringToTop(CWindowID WindowID, DialogOp* pDlgOp)
01088 {
01089 ERROR2IF(!WindowID, FALSE, "BringToTop called on a dialog without a window");
01090 ( (wxWindow *)WindowID )->Raise();
01091 if (pDlgOp->pEvtHandler->wxAUImanaged)
01092 CCamFrame::GetMainFrame()->UpdateFrameManager();
01093 return TRUE;
01094 }
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110 void DialogManager::Event (DialogEventHandler *pEvtHandler, wxEvent &event)
01111 {
01112 WXTYPE EventType = event.GetEventType();
01113
01114 ResourceID id = event.GetId();
01115 UINT_PTR DlgMsgParam = 0;
01116 INT32 PageID = 0;
01117 BOOL HandleMessage=FALSE;
01118 BOOL Defer=TRUE;
01119
01120 if (!pEvtHandler->pwxWindow || !pEvtHandler->pDialogOp)
01121 {
01122
01123 event.Skip();
01124 return;
01125 }
01126
01127
01128 if (event.IsKindOf(CLASSINFO(wxCamDialogEvent)) && (EventType == wxEVT_CAMDIALOG_DEFERREDMSG))
01129 {
01130
01131 wxCamDialogEvent * pDialogEvent = (wxCamDialogEvent *)(&event);
01132 pDialogEvent->msg.DlgWndID = pEvtHandler->pwxWindow;
01133
01134 BROADCAST_TO_CLASS( DialogMsg(pDialogEvent->msg), DialogOp );
01135 return;
01136 }
01137
01138 wxWindow * pGadget = NULL;
01139 if (id) pGadget = GetGadget(pEvtHandler->pwxWindow, id);
01140
01141
01142 if( !pGadget && (event.GetEventObject() != pEvtHandler->pwxWindow))
01143 {
01144 pGadget = (wxWindow *)event.GetEventObject();
01145 id = pGadget->GetId();
01146 }
01147
01148
01149 if( NULL != pGadget )
01150 {
01151
01152
01153 wxWindow* pDialog = pGadget->GetParent();
01154 while( NULL != pDialog && !pDialog->IsKindOf( CLASSINFO(wxDialog) ) &&
01155 !pDialog->IsKindOf( CLASSINFO(wxPanel) ) )
01156 {
01157 pDialog = pDialog->GetParent();
01158 }
01159
01160
01161 if( NULL != pDialog && pDialog->IsKindOf( CLASSINFO(wxPanel) ) )
01162 {
01163
01164 wxWindow *pDialogParent = pDialog->GetParent();
01165 if( NULL != pDialogParent && pDialogParent->IsKindOf( CLASSINFO(wxBookCtrlBase) ) )
01166 PageID = pDialog->GetId();
01167 }
01168 }
01169
01170
01171 DialogMsg msg(pEvtHandler->pwxWindow, DIM_NONE, id, DlgMsgParam, PageID);
01172
01173 if (!event.IsKindOf(CLASSINFO(wxMouseEvent)))
01174 {
01175 TRACEUSER("amb",_T("event %d(%s) received, ID=%d(%s), wxw=%llx"), EventType, DialogEventHandler::GetEventName(EventType), id,
01176 CamResource::GetObjectName((ResourceID)id), pEvtHandler->pwxWindow);
01177 }
01178
01179 if (
01180 (EventType == wxEVT_LEFT_DCLICK) ||
01181 (EventType == wxEVT_MIDDLE_DCLICK) ||
01182 (EventType == wxEVT_RIGHT_DCLICK) ||
01183 FALSE)
01184 {
01185
01186
01187
01188
01189 wxMouseEvent *MouseDown = (wxMouseEvent *)(event.Clone());
01190 wxMouseEvent *MouseUp = (wxMouseEvent *)(event.Clone());
01191 if (MouseDown && MouseUp)
01192 {
01193 if (EventType == wxEVT_LEFT_DCLICK)
01194 {
01195 MouseDown->SetEventType(wxEVT_LEFT_DOWN);
01196 MouseUp->SetEventType(wxEVT_LEFT_UP);
01197 }
01198 else if (EventType == wxEVT_MIDDLE_DCLICK)
01199 {
01200 MouseDown->SetEventType(wxEVT_MIDDLE_DOWN);
01201 MouseUp->SetEventType(wxEVT_MIDDLE_UP);
01202 }
01203 else
01204 {
01205 MouseDown->SetEventType(wxEVT_RIGHT_DOWN);
01206 MouseUp->SetEventType(wxEVT_RIGHT_UP);
01207 }
01208
01209
01210
01211
01212 pEvtHandler->pwxWindow->GetEventHandler()->ProcessEvent(*MouseDown);
01213 pEvtHandler->pwxWindow->GetEventHandler()->ProcessEvent(*MouseUp);
01214 }
01215 if (MouseDown) delete MouseDown;
01216 if (MouseUp) delete MouseUp;
01217 }
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
<