Esempio n. 1
0
LOCAL BOOL FullScreenView_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
{
	CPPMDIChildWnd *pMDIChild;
	HWND hMDIWnd;
	RECT ClientRect;
	int npix, nlin, cx, cy, dx, dy;
	HWND hControl, hMDIChild, hView;
	LPOBJECT lpBase;
	LPFRAME lpFrame;

	// Make the window as big as the screen
	dx = GetSystemMetrics( SM_CXSCREEN );
	dy = GetSystemMetrics( SM_CYSCREEN );
	MoveWindow( hDlg, 0, 0, dx, dy, NO );

	// Compute the center of the window
	GetClientRect( hDlg, &ClientRect );
	cx = ( ClientRect.right + ClientRect.left ) / 2;
	cy = ( ClientRect.bottom + ClientRect.top ) / 2;

	// Link all of the images to image controls
	hControl = GetDlgItem( hDlg, IDC_VIEWFULL );

	CServerView *pView = PictPubApp.GetActiveView();
	BOOL bInplaceActive = (pView && pView->GetDocument()->IsInPlaceActive());
	if (bInplaceActive)
	{
		hMDIChild = pView->GetParentFrame()->GetSafeHwnd();
		hView = pView->GetSafeHwnd();
	}
	else
	{
		pMDIChild = (CPPMDIChildWnd*)((CMDIFrame*)PictPubApp.m_pMainWnd)->MDIGetActive();
		hMDIWnd = pMDIChild->GetSafeHwnd();
		if (hMDIWnd)
			hView = pMDIChild->GetActiveView()->GetSafeHwnd();
		else
			hView = NULL;
	}

	while ( hView )
 	{
		lpBase = ImgGetBase((LPIMAGE)GetImagePtr(hView));
		if ( !lpBase || !hControl )
			break;
		lpFrame = ObjGetEditFrame(lpBase);

		// Link the frame to the image control
		SetWindowLong( hControl, GWL_IMAGE, (long)lpBase );
			
		// The destination size can be no bigger the the screen
		npix = FrameXSize(lpFrame);
		nlin = FrameYSize(lpFrame);
		if ( npix > dx || nlin > dy )
 		{
			npix = dx;
			nlin = dy;
			ScaleToFit( &npix, &nlin,
				FrameXSize(lpFrame), FrameYSize(lpFrame));
 		}

		// Position the control in the center of the window
		ClientRect.left = cx - npix/2;
		ClientRect.right = ClientRect.left + npix;
		ClientRect.top = cy - nlin/2;
		ClientRect.bottom = ClientRect.top + nlin;
		MoveWindow( hControl,
			ClientRect.left, ClientRect.top, // New position
			RectWidth( &ClientRect ),
			RectHeight( &ClientRect ), // New size
			NO /* No repaint*/ );

		if (bInplaceActive)
			break;

		// Check to see if these get destroyed when the window does
		do	
		{
			hView = NULL;
			if (hMDIWnd = GetWindow( hMDIWnd, GW_HWNDNEXT ))
			{
				if ((CWnd::FromHandle(hMDIWnd))->
					IsKindOf(RUNTIME_CLASS(CPPMDIChildWnd)))
					hView = ((CPPMDIChildWnd*)CWnd::FromHandle(hMDIWnd))->
						GetActiveView()->GetSafeHwnd();
			}

		} while (hMDIWnd && !hView);

		if (!hView)
			break;

		// Get another image control				 
		hControl = CopyWindow( hControl );
	}

	return TRUE;
}
Esempio n. 2
0
/*----------------------------------------------------------------------*
 |                                InvokeCommand                      |
 *----------------------------------------------------------------------*/
void 
InvokeCommand (
     Widget         w,
     Atom           target,
     MessageData    data,
     unsigned long  len,
     int            fmt)
{	
  CARD32      	commandID;
  Window  	windowID;
  WorkWindow *w_window;
  CommandSpace *cs;
  commandID = UnpackCARD32(&data);
  windowID = UnpackCARD32(&data);


  PRINT("commandID = %d\n",commandID);
  PRINT("windowID = %d\n", windowID);

  if (commandID == show_id)
  {
      if (wsm_shown)
      {
	  PRINT("hide workspace manager\n");
	  HideWsm();
      }
      else
      {
	  PRINT("show workspace manager\n");
	  ShowWsm();
      }
    }
  else if (commandID == occupy_id)
    {
      PRINT("copy window\n");
      w_window = GetWorkWindow(windowID);
      if (w_window != NULL)
	CreateOccupy(w_window);
    }
  else if (commandID == copy_all_id)
    {
      PRINT("copy window\n");
      w_window = GetWorkWindow(windowID);
      if (w_window != NULL)
	CopyWindow(w_window,current_space,all_space);
    }
  else if (commandID == link_all_id)
    {
      PRINT("copy window\n");
      w_window = GetWorkWindow(windowID);
      if (w_window != NULL)
	LinkWindow(w_window,current_space,all_space);
    }
  else if (commandID == remove_id)
    {
      PRINT("remove id\n");
      w_window = GetWorkWindow(windowID);
      if (w_window != 0)	
	{
	  if (w_window->s_list->next != NULL && w_window->window != None &&
	      _WSMGetConfigFormatType(w_window->window) != WSM_ICON_FMT)	      
	    DeleteWindow(w_window,current_space);
      }
    }
  else if ((cs = GetCSFromSwitchID(commandID)) != NULL)
    {
      PRINT("SendLeaveRoom(%s)\n",cs->space->name);	
      XmToggleButtonSetState(wsm_ui->space_button[GetSpaceID(cs->space)],True,True);
    }
  else if ((cs = GetCSFromCopyID(commandID)) != NULL)
    {
      PRINT("copy space");
      w_window = GetWorkWindow(windowID);
      if (w_window != NULL)
	{
	  PRINT(" %s\n",cs->space->name);
	  CopyWindow(w_window,current_space, cs->space);
	}
    }
  else if ((cs = GetCSFromLinkID(commandID)) != NULL)
    {
      PRINT("link space");
      w_window = GetWorkWindow(windowID);
      if (w_window != NULL)
	{
	  PRINT(" %s\n",cs->space->name);
	  LinkWindow(w_window,current_space, cs->space);
	}
    }	
  
  
}