#include <scrcamvw.h>
Inheritance diagram for ScreenCamView:
Public Member Functions | |
virtual BOOL | IsScreenCamView () |
Protected Member Functions | |
virtual CCamCanvas * | CreateCanvas (wxView *v, wxMDIChildFrame *frame, const wxPoint &pos, const wxSize &size, long style) |
bool | OnCreate (wxDocument *doc, long flags) |
Called upon receipt of a WM_CREATE message for the view window. Constructs MFC/C++ surrogates on the heap, then tries to link up with Windows by calling the base class function OnCreate() and the Create function for each of the child windows of ScreenView, any or all of which can fail. Calculates the size of a pixel and sets the appropriate fields in the ViewState. If this is a new view upon a new document the rest of the fields of the ViewState are filled by the default characteristics of the ScreenView. If the document is not new then the ScreenView assumes that the kernel has already set up the ViewState, and changes its size, position etc to fit. | |
void | OnSize (wxSizeEvent &event) |
Resizes and repositions all child windows to fit the new size of the ScreenView. Updates the ViewState object with the size and position of the view, in an OS-independent manner. Resets the scroller's page and line size, and forces an immediate redraw of all affected windows. | |
Classes | |
class | ScreenCamCanvas |
Definition at line 133 of file scrcamvw.h.
|
Reimplemented from ScreenView. Definition at line 157 of file scrcamvw.h. 00158 : Correct */ long style ) 00159 { 00160 return new ScreenCamCanvas( v, frame, pos, size, style ); 00161 }
|
|
Definition at line 166 of file scrcamvw.h. 00166 { return TRUE; }
|
|
Called upon receipt of a WM_CREATE message for the view window. Constructs MFC/C++ surrogates on the heap, then tries to link up with Windows by calling the base class function OnCreate() and the Create function for each of the child windows of ScreenView, any or all of which can fail. Calculates the size of a pixel and sets the appropriate fields in the ViewState. If this is a new view upon a new document the rest of the fields of the ViewState are filled by the default characteristics of the ScreenView. If the document is not new then the ScreenView assumes that the kernel has already set up the ViewState, and changes its size, position etc to fit.
Reimplemented from CCamView. Definition at line 218 of file scrcamvw.cpp. 00218 : Correct */ long flags ) 00219 { 00220 // Construct the (C++) child windows. 00221 PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller / ruler usage") 00222 #ifndef EXCLUDE_FROM_XARALX 00223 RenderWindow = new CRenderWnd; 00224 00225 HScrollBar = new CWinScroller(TRUE); 00226 VScrollBar = new CWinScroller(FALSE); 00227 Corner = new CScrollerCorner; 00228 // WEBSTER - markn 15/1/97 00229 // No rulers in Webster 00230 #ifndef WEBSTER 00231 HRuler = new OILHorizontalRuler; 00232 VRuler = new OILVerticalRuler; 00233 OGadget = new OriginGadget; 00234 #endif //webster 00235 if (!RenderWindow || !HScrollBar || !VScrollBar || !Corner 00236 #ifndef WEBSTER 00237 ||!HRuler ||!VRuler ||!OGadget 00238 #endif //webster 00239 ) 00240 { 00241 Error::SetError(_R(IDE_CREATE_VIEW_FAILED), 0); 00242 InformError(); 00243 return -1; 00244 } 00245 #endif 00246 // Get base class to call CView functions, and get a document for this view. 00247 if( !CCamView::OnCreate( doc, flags ) ) 00248 // Something went wrong - pass error back. 00249 return false; 00250 00251 PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller usage") 00252 // Now get Windows to do its side of the construction. The stated sizes and 00253 // positions of the windows here will be changed very soon. 00254 #ifndef EXCLUDE_FROM_XARALX 00255 const CRect rcARect(-100,-100,-90,-90); 00256 if (!RenderWindow->Create("", "", 0, rcARect, this, 1) || 00257 !HScrollBar->Create(0, rcARect, this, 2) || 00258 !VScrollBar->Create(0, rcARect, this, 3) || 00259 !Corner->Create("", "", 0, rcARect, this, 4) 00260 // WEBSTER - markn 15/1/97 00261 // No rulers in Webster 00262 #ifndef WEBSTER 00263 || !OGadget->Create(this) 00264 || !HRuler->Create(this) 00265 || !VRuler->Create(this) 00266 #endif //webster 00267 ) 00268 { 00269 Error::SetError(_R(IDE_CREATE_VIEW_FAILED), 0); 00270 InformError(); 00271 return -1; 00272 } 00273 #endif 00274 CreateNewDocView(); 00275 00276 // WEBSTER - markn 15/1/97 00277 // No rulers in Webster 00278 #ifndef WEBSTER 00279 00280 // init the kernel rulers and establish pointer links to them 00281 PORTNOTE("other","ScreenCamView::OnCreate - Removed ruler usage") 00282 #ifndef EXCLUDE_FROM_XARALX 00283 RulerPair* pRulers=pDocView->GetpRulerPair(); 00284 pRulers->Init(pDocView,HRuler,VRuler,OGadget); 00285 HRuler->LinkToKernel(pRulers->GetpHorizontalRuler()); 00286 VRuler->LinkToKernel(pRulers->GetpVerticalRuler()); 00287 #endif 00288 #endif //webster 00289 ENSURE(pDocView != 0, "ScreenView::ScreenView can't get a new DocView!"); 00290 pDocView->ConnectToOilView(this); 00291 00292 // find the last view so we can use some of it's settings to create the new 00293 // DocView * LastView = DocView::GetSelected(); 00294 00295 // Link this and the DocView to the ViewState object. 00296 pDocView->SetViewState(Status); 00297 00299 00300 wxScreenDC dc; 00301 wxSize pixsize=OSRenderRegion::GetFixedDCPPI(dc); 00302 00303 PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller usage") 00304 #ifndef EXCLUDE_FROM_XARALX 00305 // Set the logical pixel size accordingly (measured in millipoints). Take the 00306 // opportunity to pass the values into the scrollers and the OIL -> Windows coordinate 00307 // transform system. 00308 HScrollBar->SetGranularity(72000L / pixwidth); 00309 VScrollBar->SetGranularity(72000L / pixheight); 00310 #endif 00311 00312 // Tell DocView how big the pixel size is. 00313 FIXED16 PixelWidth = FIXED16(72000.0/pixsize.x); 00314 FIXED16 PixelHeight = FIXED16(72000.0/pixsize.y); 00315 ERROR3IF(PixelWidth != PixelHeight, "Luke says non-square pixels are not supported"); 00316 pDocView->SetPixelSize(PixelWidth, PixelHeight); 00317 00318 // Make our DocView the current DocView 00319 pDocView->SetCurrent(); 00320 00321 GetCanvas()->SetScrollRate(1,1); 00322 00323 if (GetFrame()) 00324 GetFrame()->GetClientSize(&CurrentSize.width,&CurrentSize.height); 00325 // Now the scrollers have all their information, we can set their appearance. 00326 // Make sure that they are invisible until the rest of the frame is ready 00327 /* XLONG x1 = CurrentSize.GetWidth () * PixelWidth; 00328 XLONG x2 = CurrentSize.GetHeight() * PixelHeight; 00329 GetFrame()->SetScrollbar(wxHORIZONTAL,0,x1,Status->WorkAreaExtent.hi.x-Status->WorkAreaExtent.lo.x,false); 00330 GetFrame()->SetScrollbar( wxVERTICAL,0,x2,Status->WorkAreaExtent.hi.y-Status->WorkAreaExtent.lo.y,false); 00331 */ 00332 SetScrollerStyle(ScrollerStyle = PropScrollersOn); 00333 00334 ShowScrollers(DefaultScrollersState); 00335 ShowRulers(DefaultRulersState); 00336 00338 00339 // Register for WM_DROPFILES messages 00340 // DragAcceptFiles(TRUE); 00341 00342 // WEBSTER - markn 12/2/97 00343 #if (_OLE_VER >= 0x200) 00344 // Register with OLE as a drop target. 00345 m_DropTarget.Register(this); 00346 #endif 00347 00349 00350 // now that the ScreenView (and hence DocView) is stable, broadcast a message to let everyone know 00351 BROADCAST_TO_ALL(DocViewMsg(pDocView,DocViewMsg::NEWANDSTABLE)); 00352 00353 // ****************** BODGE ************************** 00354 // This code will tell windows to send us messages when 00355 // the joystick gets waggled about. 00356 // We should really release the joystick at some point later, 00357 // but it gets released automatically when this ScreenView is 00358 // destroyed, so it will do for now. 00359 00360 // The messages get passed to 'OnJoystickMove' member of this 00361 // class. 00362 00363 #ifdef WIN32 00364 00365 PORTNOTE("other","ScreenCamView::OnCreate - Removed joystick usage") 00366 #ifndef EXCLUDE_FROM_XARALX 00367 JOYINFO joyinfo; 00368 UINT32 wNumDevs, wDeviceID; 00369 BOOL bDev1Attached, bDev2Attached; 00370 00371 // Are there any Joysticks available ? 00372 if((wNumDevs = joyGetNumDevs()) == 0) 00373 return 0; // Nope. 00374 00375 // Are there One or Two of them ? 00376 bDev1Attached = joyGetPos(JOYSTICKID1,&joyinfo) != JOYERR_UNPLUGGED; 00377 bDev2Attached = wNumDevs == 2 && 00378 joyGetPos(JOYSTICKID2,&joyinfo) != JOYERR_UNPLUGGED; 00379 00380 if(bDev1Attached || bDev2Attached) // Decide which joystick to use 00381 wDeviceID = bDev1Attached ? JOYSTICKID1 : JOYSTICKID2; 00382 else 00383 return 0; 00384 00385 // Grab those Messages !! 00386 MMRESULT JoyResult = joySetCapture(m_hWnd, wDeviceID, NULL, TRUE); 00387 #endif 00388 00389 #endif 00390 00391 // ****************** BODGE ************************** 00392 00393 // Return success! 00394 return true; 00395 }
|
|
Resizes and repositions all child windows to fit the new size of the ScreenView. Updates the ViewState object with the size and position of the view, in an OS-independent manner. Resets the scroller's page and line size, and forces an immediate redraw of all affected windows.
Reimplemented from ScreenView. Definition at line 420 of file scrcamvw.cpp. 00421 { 00422 // This is called early, so if pDocView is null do nothing 00423 if( NULL == pDocView ) 00424 return; 00425 00426 SetCurrentStates(); 00427 00428 Document* pCurDoc = Document::GetCurrent(); 00429 DocView* pCurView = DocView::GetCurrent(); 00430 00431 // these lines are here to stop very strange things happening on exit under Win32s 00432 // when this fn gets called when it really shouldn't. I would like to really know 00433 // just what on earth os going on under Win32s but it iss something strange in message 00434 // handling as far as I can tell. 00435 00436 wxSize size( event.GetSize() ); 00437 00438 // Check for irrelevant or potty messages. 00439 if (size.x <= 0 || size.y <= 0) 00440 { 00441 // TRACEUSER( "JustinF", _T("Strange size msg in ScreenView::OnSize(0x%X, %d, %d)\n"), 00442 // nType, cx, cy); 00443 return; 00444 } 00445 00446 // Handle OLE 2.0 in-place activation stuff. 00447 #if (_OLE_VER >= 0x200) 00448 if(GetDocument()) 00449 { 00450 COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this); 00451 if (pActiveItem) pActiveItem->SetItemRects(); 00452 } 00453 #endif 00454 00455 if (Status->ScrollersVisible) 00456 { 00457 PORTNOTETRACE( "other", "ScreenCamView::OnSize - Removed scroller usage" ); 00458 #if !defined(EXCLUDE_FROM_XARALX) 00459 // Resize and reposition the proportional scrollers. 00460 wxRect hrect, vrect; 00461 HScrollBar->CalcPosFromParentClient(&hrect); 00462 00463 UINT32 RulerWidth = OILRuler::GetWidth(); 00464 //if rulers are switched on the scroll bars are made 00465 // smaller to accomodate them 00466 if (Status->RulersVisible) 00467 hrect.left += RulerWidth; 00468 if (RULER_BORDERS) 00469 hrect.left-=2; 00470 00471 HScrollBar->MoveWindow(&hrect, TRUE); 00472 VScrollBar->CalcPosFromParentClient(&vrect); 00473 00474 if (Status->RulersVisible) 00475 vrect.top += RulerWidth; 00476 if (RULER_BORDERS) 00477 vrect.top-=2; 00478 00479 VScrollBar->MoveWindow(&vrect, TRUE); 00480 00481 // Reposition the corner window at the bottom-right. 00482 Corner->MoveWindow(vrect.left, hrect.top, vrect.Width(), hrect.Height()); 00483 00484 // Resize/reposition the rendering window. 00485 CurrentSize.left = CurrentSize.top = 0; 00486 CurrentSize.right = cx - vrect.Width() + 1; 00487 CurrentSize.bottom = cy - hrect.Height() + 1; 00488 #endif 00489 } 00490 else 00491 { 00492 CurrentSize.x = CurrentSize.y = 0; 00493 CurrentSize.width = size.x; 00494 CurrentSize.height = size.y; 00495 } 00496 00497 if (Status->RulersVisible) 00498 { 00499 PORTNOTETRACE( "other", "ScreenCamView::OnSize - Removed scroller / ruler usage" ); 00500 #if !defined(EXCLUDE_FROM_XARALX) 00501 wxRect hRect, vRect, oRect; 00502 00503 HRuler->CalcPosFromParentClient(&hRect); 00504 HRuler->MoveWindow(&hRect, TRUE); 00505 HRuler->PositionLegend(); 00506 00507 CurrentSize.top = 0 + hRect.Height() ; 00508 00509 VRuler->CalcPosFromParentClient(&vRect); 00510 VRuler->MoveWindow(&vRect, TRUE); 00511 CurrentSize.left = 0 + vRect.Width(); 00512 00513 OGadget->CalcPosFromParentClient(&oRect); 00514 OGadget->MoveWindow(&oRect, TRUE); 00515 if (RULER_BORDERS) 00516 { 00517 CurrentSize.top --; 00518 CurrentSize.left--; 00519 } 00520 #endif 00521 } 00522 00523 PORTNOTE( "other", "ScreenCamView::OnSize - Removed RenderWindow usage -not sure if needed" ) 00524 #ifndef EXCLUDE_FROM_XARALX 00525 RenderWindow->MoveWindow(&CurrentSize, TRUE); 00526 #endif 00527 // Update the rest of the window placement information. 00528 UpdateViewPosition(); 00529 00530 // Calculate the work area, page & line sizes etc etc. 00531 FIXED16 PixelWidth, PixelHeight; 00532 pDocView->GetPixelSize(&PixelWidth, &PixelHeight); 00533 00534 PORTNOTE( "other", "ScreenCamView::OnSize - Removed scroller usage" ) 00535 #if !defined(EXCLUDE_FROM_XARALX) 00536 XLONG x1 = CurrentSize.GetWidth() * PixelWidth; 00537 XLONG x2 = CurrentSize.GetHeight() * PixelHeight; 00538 HScrollBar->SetPageSize(x1); 00539 VScrollBar->SetPageSize(x2); 00540 HScrollBar->SetLineSize(x1 / xlong(10) + xlong(1)); 00541 VScrollBar->SetLineSize(x2 / xlong(10) + xlong(1)); 00542 #endif 00543 SetWorkAreaExtent(Status->WorkAreaExtent, FALSE); 00544 00545 // Make sure the scroll offsets are valid - if we resize the bottom of the window 00546 // when at the extreme bottom of the view, then the scroll offsets should be 00547 // changed - we use the scrollers' own integrity checks to do this automatically. 00548 // Don't do this until the setup flag is TRUE, so we don't overwrite scroll offsets 00549 // that have been reloaded. 00550 if (fSetupDone) 00551 { 00552 WorkCoord CurrScrollPos; 00553 GetScrollOffset(&CurrScrollPos); 00554 SetScrollOffset(CurrScrollPos, TRUE); 00555 } 00556 00557 // Inform the associated DocView object that something has happened. 00558 pDocView->ViewStateChanged(); 00559 pCurDoc->SetCurrent(); 00560 pCurView->SetCurrent(); 00561 }
|