Example #1
0
void CStylePage::OnStyleClicked(UINT /*nCmdID*/)
{
	// The CStylePage property page is used for both the
	// CModalShapePropSheet and the CModelessShapePropSheet.
	// Both these versions of the property sheet share a common
	// feature that they immediately update a shape.  In the
	// case of CModalShapePropSheet, the shape is in the preview
	// window.  In the case of CModelessShapePropSheet, the shape
	// is the currently selected shape in the view.

	CPropertySheet* pSheet = STATIC_DOWNCAST(CPropertySheet, GetParent());

	CModalShapePropSheet* pModalSheet =
		DYNAMIC_DOWNCAST(CModalShapePropSheet, pSheet);
	if (pModalSheet != NULL)
	{
		UpdateData();
		pModalSheet->UpdateShapePreview();
		SetModified(); // enable Apply Now button
	}

	CModelessShapePropSheet* pModelessSheet =
		DYNAMIC_DOWNCAST(CModelessShapePropSheet, pSheet);
	if (pModelessSheet != NULL)
	{
		UpdateData();
		CFrameWnd* pFrameWnd = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
		CView* pView = pFrameWnd->GetActiveFrame()->GetActiveView();
		pView->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0);
	}
}
Example #2
0
// OnEndPrintPreview is here for swap tuning reasons
//  (see viewprev.cpp for complete preview mode implementation)
void CView::OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo,
			POINT, CPreviewView* pView)
{
	ASSERT_VALID(pDC);
	ASSERT_VALID(pView);

	if (pView->m_pPrintView != NULL)
		pView->m_pPrintView->OnEndPrinting(pDC, pInfo);

	CFrameWnd* pParent = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
	ASSERT_VALID(pParent);

	// restore the old main window
	pParent->OnSetPreviewMode(FALSE, pView->m_pPreviewState);

	// Force active view back to old one
	pParent->SetActiveView(pView->m_pPreviewState->pViewActiveOld);
	if (pParent != GetParentFrame())
		OnActivateView(TRUE, this, this);   // re-activate view in real frame
	pView->DestroyWindow();     // destroy preview view
			// C++ object will be deleted in PostNcDestroy

	// restore main frame layout and idle message
	pParent->RecalcLayout();
	pParent->SendMessage(WM_SETMESSAGESTRING, (WPARAM)AFX_IDS_IDLEMESSAGE, 0L);
	pParent->UpdateWindow();
}
CXTPChartRectF CXTPChartStackedBarSeriesPointView::GetScreenRect() const
{
	CXTPChartStackedBarSeriesView* pSeriesView = (CXTPChartStackedBarSeriesView*)GetSeriesView();
	CXTPChartStackedBarSeriesStyle* pSeriesStyle = STATIC_DOWNCAST(CXTPChartStackedBarSeriesStyle, GetSeriesView()->GetStyle());

	CXTPChartAxisView* pAxisXView = pSeriesView->GetAxisViewX();

	if (pSeriesView->m_nBarIndex != -1)
	{
		int nCount = pSeriesView->m_nBarCount;
		int nIndex = pSeriesView->m_nBarIndex;

		double dOffset = 3 / pAxisXView->GetScale();

		double dBarWidth = (pSeriesStyle->GetBarWidth() - dOffset * (nCount - 1)) / nCount;

		CXTPChartPointF ptTopLeft(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() -
			pSeriesStyle->GetBarWidth() / 2 + dBarWidth * nIndex + dOffset * nIndex, m_dValueTo));

		CXTPChartPointF ptBottomRight(pSeriesView->GetScreenPoint(m_pPoint->GetInternalArgumentValue() -
			pSeriesStyle->GetBarWidth() / 2 + dBarWidth * nIndex + dOffset * nIndex + dBarWidth, m_dValueFrom));

		CXTPChartRectF rc(ptTopLeft, ptBottomRight);
		rc.Width++;
		rc.Height++;

		return rc;
	}

	return CXTPChartRectF(0, 0, 0, 0);
}
Example #4
0
void CCalcUnary::OnInverse() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	xpMatrix  mtx;
	CWaitCursor wait; 
	//invert the matrix
	try
	{
        CAllPages * pParent = STATIC_DOWNCAST(CAllPages, GetParent());
 		if (getMatrix(mtx) == TRUE)
		{
	        wait.Restore( );
			m_mtxResult = mtx.getInverse();
		}

	    pParent->m_pMtx->pDoc->m_mtx = &m_mtxResult;
   	    pParent->SetActivePage(0);
	    pParent->m_calcResults.pGridCtrl->Refresh();	
	}
	catch (xpException * e)
	{
		CString errMess;
		e->getErrorMessage(errMess);
		MessageBox(errMess, "Matrix Calculation Error", MB_OK);
		e->Delete();
	}	
}
Example #5
0
int CPrintFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
	{
        return -1;
	}

    CCreateContext context;
    context.m_pNewViewClass = RUNTIME_CLASS(CPrintView);
    context.m_pCurrentFrame = this;
    context.m_pCurrentDoc = NULL;
    context.m_pLastView = NULL;
    m_pView = STATIC_DOWNCAST(CPrintView, CreateView(&context)); 
    if(m_pView != NULL)
    {
        m_pView->ShowWindow(SW_SHOW);
        SetActiveView(m_pView);
    }
    SetIcon(m_pOldWnd->GetIcon(FALSE),FALSE);
	SetIcon(m_pOldWnd->GetIcon(TRUE),TRUE);
	ShowWindow(SW_MAXIMIZE);
	CWinApp* pApp=AfxGetApp();
	m_pOldFram = pApp->m_pMainWnd;
	pApp->m_pMainWnd=this;
	m_pView->OnFilePrintPreview();
    //m_pView->SendMessage(WM_COMMAND, ID_FILE_PRINT);//直接打印
    m_pOldWnd->ShowWindow(SW_HIDE);
    return 0;
}
CObject* CListCtrlItemWalk::GetNextSelectableItem()
{
	ASSERT( m_pListCtrl != NULL );
	if (m_pListCtrl == NULL)
		return NULL;

	int iItemCount = m_pListCtrl->GetItemCount();
	if (iItemCount >= 2)
	{
		POSITION pos = m_pListCtrl->GetFirstSelectedItemPosition();
		if (pos)
		{
			int iItem = m_pListCtrl->GetNextSelectedItem(pos);
			if (iItem+1 < iItemCount)
			{
				m_pListCtrl->SetItemState(iItem, 0, LVIS_SELECTED | LVIS_FOCUSED);
				iItem++;
				m_pListCtrl->SetItemState(iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
				m_pListCtrl->SetSelectionMark(iItem);
				m_pListCtrl->EnsureVisible(iItem, FALSE);

				return STATIC_DOWNCAST(CObject, (CObject*)m_pListCtrl->GetItemData(iItem));
			}
		}
	}
	return NULL;
}
CXTPChartDeviceCommand* CXTPChartPyramidSeriesPointView::CreateDeviceCommand(CXTPChartDeviceContext* pDC)
{
	UNREFERENCED_PARAMETER(pDC);

	CXTPChartColor color1 = GetColor();
	CXTPChartColor color2 = GetColor2();
	CXTPChartColor clrBorder = GetBorderActualColor();

	CXTPChartDeviceCommand* pCommand = new CXTPChartHitTestElementCommand(m_pPoint);

	CXTPChartPyramidSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPyramidSeriesStyle, GetSeriesView()->GetStyle());

	CXTPChartPoints arrPoints;

	arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width - m_rc.Width * m_dFrom) / 2), m_rc.GetTop()));
	arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width + m_rc.Width * m_dFrom) / 2), m_rc.GetTop()));

	arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width + m_rc.Width * m_dTo) / 2), m_rc.GetBottom()));
	arrPoints.Add(CXTPChartPointF(m_rc.GetLeft() + int((m_rc.Width - m_rc.Width * m_dTo) / 2), m_rc.GetBottom()));

	pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, color1, color2));

	if (pStyle->GetBorder()->IsVisible())
		pCommand->AddChildCommand(new CXTPChartBoundedPolygonDeviceCommand(arrPoints, clrBorder, pStyle->GetBorder()->GetThickness()));


	return pCommand;
}
int CChannelRulerCtrl::GetRulerIndex() const
{
	CChannelBar	*Bar = STATIC_DOWNCAST(CChannelBar, GetParent());
	int	iChan = Bar->FindRuler(this);
	ASSERT(iChan >= 0);
	return(iChan);
}
void CFileDetailDialog::UpdateTitle()
{
	if (m_aItems.GetSize() == 1)
		SetWindowText(GetResString(IDS_DETAILS) + _T(": ") + STATIC_DOWNCAST(CAbstractFile, m_aItems[0])->GetFileName());
	else
		SetWindowText(GetResString(IDS_DETAILS));
}
Example #10
0
CExtGridCellHyperLinkEx* PropertiesBar::GetHyperLink(CExtPropertyItem* pItem)
{
	CExtGridCellHyperLinkEx* pLink = STATIC_DOWNCAST(CExtGridCellHyperLinkEx,
						 pItem->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellHyperLinkEx)));

	pLink->TextColorSet(CExtGridCellHyperLink::__ECS_NORMAL, RGB(0,0,255));
	pLink->TextColorSet(CExtGridCellHyperLink::__ECS_SELECTED, RGB(255,0,0));
	pLink->TextColorSet(CExtGridCellHyperLink::__ECS_HOVERED, RGB(128,128,255));
	pLink->SetAllowVisitedState(1);
	pLink->SetTextColorVisited(RGB(0,0,255));
	pLink->FontUnderlineSet();

	// I hate this workaround, but it is the only damn thing that works.
	HyperLinkClickInfo hci;
	hci.pGrid = m_pGrid;
	hci.pItem = pItem;
	hyperLinks.push_back(hci);
	pLink->LParamSet((LPARAM)&(hyperLinks.back()));

	pLink->SetCursor(LoadCursor(NULL, IDC_HAND));

	// Set the cell pointer
	m_pGrid->propValueMgrs[pItem]->pCell = pLink;
	return pLink;
}
Example #11
0
void CCalcUnary::OnTranspose() 
{
	// TODO: Add your control notification handler code here
	UpdateData();

	CString st1 = m_selValList1;
	xpMatrix  mtx;
    CWaitCursor wait; 

	try
	{
       if (getMatrix(mtx) == TRUE)
	   {
	      int r = mtx.getRowCount();
		  int c = mtx.getColumnCount();
		  wait.Restore( );
		  m_mtxResult = mtx.getTranspose();
	   }

       CAllPages * pParent = STATIC_DOWNCAST(CAllPages, GetParent());
	   pParent->m_pMtx->pDoc->m_mtx = &m_mtxResult;
	   pParent->updateMtxList();
   	   pParent->SetActivePage(0);
	}
	catch (xpException * e)
	{
		CString errMess;
		e->getErrorMessage(errMess);
		MessageBox(errMess, "Matrix Calculation Error", MB_OK);
		e->Delete();
	}		
}
Example #12
0
LRESULT CProfStudioPropertyGridCtrl::WindowProc( UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult =
		CExtPropertyGridCtrl::WindowProc( message, wParam, lParam );
	if( message == WM_CREATE )
	{
		PropertyStoreSet( &m_PS );
		CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
		OnPgcQueryGrids( arrGrids );
		INT nGridIdx = 0;
		for( ; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
		{
			CExtPropertyGridWnd * pGrid = arrGrids[ nGridIdx ];
			ASSERT_VALID( pGrid );
			g_PaintManager->LoadWinXpTreeBox(
				pGrid->m_iconTreeBoxExpanded,
				true
				);
			g_PaintManager->LoadWinXpTreeBox(
				pGrid->m_iconTreeBoxCollapsed,
				false
				);
		} // for( ; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
		CExtPropertyGridComboBoxBar * pCBB =
			STATIC_DOWNCAST(
				CExtPropertyGridComboBoxBar,
				GetChildByRTC(
					RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
					)
				);
		pCBB->PropertyStoreInsert( &m_PS );
	} // if( message == WM_CREATE )
	return lResult;
}
CSeriousSkaStudioView* CSeriousSkaStudioApp::GetActiveView(void)
{
  CSeriousSkaStudioView *res;
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  res = DYNAMIC_DOWNCAST(CSeriousSkaStudioView, pMainFrame->GetActiveFrame()->GetActiveView());
  return res;
}
CXTPChartDeviceCommand* CXTPChartAreaSeriesView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds)
{
	UNREFERENCED_PARAMETER(pDC);
	rcBounds.DeflateRect(1, 1);

	CXTPChartDeviceCommand* pCommand = new CXTPChartPolygonAntialiasingDeviceCommand();

	CXTPChartAreaSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartAreaSeriesStyle, m_pSeries->GetStyle());

	CXTPChartPointF ptCenter(rcBounds.CenterPoint().x, rcBounds.top + 4) ;
	int nSize = 8;


	CXTPChartPoints arrPoints;
	arrPoints.Add(CXTPChartPointF(rcBounds.left, rcBounds.bottom + 1));
	arrPoints.Add(CXTPChartPointF(ptCenter.X, float(rcBounds.top + 4)));
	arrPoints.Add(CXTPChartPointF(rcBounds.right, rcBounds.bottom + 1));

	pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, GetActualColor(), GetActualColor2()));


	CXTPChartColor clrBorder = GetBorderActualColor();
	pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand(arrPoints[0], arrPoints[1], clrBorder, 1));
	pCommand->AddChildCommand(new CXTPChartSolidLineDeviceCommand(arrPoints[1], arrPoints[2], clrBorder, 1));

	pCommand->AddChildCommand(pStyle->GetMarker()->CreateDeviceCommand(pDC, ptCenter, nSize, GetColor(), GetColor2(), GetColor().GetDarkColor()));

	return pCommand;
}
CXTPChartDeviceCommand* CXTPChartPyramidSeriesView::CreateLegendDeviceCommand(CXTPChartDeviceContext* pDC, CRect rcBounds,
	CXTPChartColor color1, CXTPChartColor color2, CXTPChartColor clrBorder)
{
	UNREFERENCED_PARAMETER(pDC);
	rcBounds.DeflateRect(1, 1);

	CXTPChartPyramidSeriesStyle* pStyle = STATIC_DOWNCAST(CXTPChartPyramidSeriesStyle, GetStyle());

	CXTPChartDeviceCommand* pCommand = new CXTPChartPolygonAntialiasingDeviceCommand();

	CXTPChartPoints arrPoints;

	arrPoints.Add(CXTPChartPointF((rcBounds.left + rcBounds.right) / 2, rcBounds.top));

	arrPoints.Add(CXTPChartPointF(rcBounds.right, rcBounds.bottom ));
	arrPoints.Add(CXTPChartPointF(rcBounds.left, rcBounds.bottom));

	pCommand->AddChildCommand(pStyle->GetFillStyle()->CreateDeviceCommand(arrPoints, color1, color2));

	if (pStyle->GetBorder()->IsVisible())
		pCommand->AddChildCommand(new CXTPChartBoundedPolygonDeviceCommand(arrPoints, clrBorder, 1));


	return pCommand;
}
Example #16
0
BOOL CModelerDoc::CreateModelFromScriptFile( CTFileName fnScrFileName, char *strError)
{
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  try
  {
    CWaitCursor StartWaitCursor;
   	
    CRect rectMainFrameSize;
    CRect rectProgress, rectProgressNew;
    
    pMainFrame->GetWindowRect( &rectMainFrameSize);
    pMainFrame->m_NewProgress.Create( IDD_NEW_PROGRESS, pMainFrame);
    pMainFrame->m_NewProgress.GetWindowRect( &rectProgress);
    
    rectProgressNew.left = rectMainFrameSize.Width()/2 - rectProgress.Width()/2;
    rectProgressNew.top = rectMainFrameSize.Height()/2 - rectProgress.Height()/2;
    rectProgressNew.right = rectProgressNew.left + rectProgress.Width();
    rectProgressNew.bottom = rectProgressNew.top + rectProgress.Height();

    pMainFrame->m_NewProgress.MoveWindow( rectProgressNew);
    pMainFrame->m_NewProgress.ShowWindow(SW_SHOW);

    m_emEditModel.LoadFromScript_t( fnScrFileName);
  }
  catch( char *err_str)
  {
    strcpy( strError, err_str);
    pMainFrame->m_NewProgress.DestroyWindow();
    return FALSE;
  }
  pMainFrame->m_NewProgress.DestroyWindow();
	m_bDocLoadedOk = TRUE;
	return TRUE;
}
Example #17
0
void CScriptView::OnScriptUpdateMipmodels() 
{
	// find document with same name
  CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
  CTFileName fnScriptName = CTString(pDoc->GetPathName());
  CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";

	POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
    {
      POSITION pos = pmdCurrent->GetFirstViewPosition();
      CView *pView = pmdCurrent->GetNextView( pos);
      if( DYNAMIC_DOWNCAST(CModelerView, pView) != NULL)
      {
        CModelerView* pModelerView = (CModelerView *) pView;
        if(pModelerView != NULL)
        {
          pModelerView->OnScriptUpdateMipmodels();
          pModelerView->SetActiveWindow();
          pModelerView->SetFocus();
          CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
          pMainFrame->MDIActivate(pModelerView->GetParentFrame());
        }
      }
      break;
    }
  }
}
Example #18
0
bool CUrlClient::SendHttpBlockRequests()
{
	USES_CONVERSION;
	m_dwLastBlockReceived = ::GetTickCount();
	if (reqfile == NULL)
		throw CString(_T("Failed to send block requests - No 'reqfile' attached"));

	CreateBlockRequests(PARTSIZE / EMBLOCKSIZE);
	if (m_PendingBlocks_list.IsEmpty()){
//==> Extended Failed/Success Statistic by NetF [shadow2004]
#ifdef FSSTATS
		SetDownloadState(DS_NONEEDEDPARTS, REASON_NoNeededParts);
#else
		SetDownloadState(DS_NONEEDEDPARTS);
#endif
//<== Extended Failed/Success Statistic by NetF [shadow2004]
        SwapToAnotherFile(_T("A4AF for NNP file. UrlClient::SendHttpBlockRequests()"), true, false, false, NULL, true, true);
		return false;
	}
	
	POSITION pos = m_PendingBlocks_list.GetHeadPosition();
	Pending_Block_Struct* pending = m_PendingBlocks_list.GetNext(pos);
	m_uReqStart = pending->block->StartOffset;
	m_uReqEnd = pending->block->EndOffset;
	bool bMergeBlocks = true;
	while (pos)
	{
		POSITION posLast = pos;
		pending = m_PendingBlocks_list.GetNext(pos);
		if (bMergeBlocks && pending->block->StartOffset == m_uReqEnd + 1)
			m_uReqEnd = pending->block->EndOffset;
		else
		{
			bMergeBlocks = false;
			reqfile->RemoveBlockFromList(pending->block->StartOffset, pending->block->EndOffset);
			delete pending->block;
			delete pending;
			m_PendingBlocks_list.RemoveAt(posLast);
		}
	}

	m_nUrlStartPos = m_uReqStart;

	CStringA strHttpRequest;
	strHttpRequest.AppendFormat("GET %s HTTP/1.0\r\n", m_strUrlPath);
	strHttpRequest.AppendFormat("Accept: */*\r\n");
	strHttpRequest.AppendFormat("Range: bytes=%u-%u\r\n", m_uReqStart, m_uReqEnd);
	strHttpRequest.AppendFormat("Connection: Keep-Alive\r\n");
	strHttpRequest.AppendFormat("Host: %s\r\n", T2CA(m_strHost));
	strHttpRequest.AppendFormat("\r\n");

	if (thePrefs.GetDebugClientTCPLevel() > 0)
		Debug(_T("Sending HTTP request:\n%hs"), strHttpRequest);
	CRawPacket* pHttpPacket = new CRawPacket(strHttpRequest);
	theStats.AddUpDataOverheadFileRequest(pHttpPacket->size);
	socket->SendPacket(pHttpPacket);
	STATIC_DOWNCAST(CHttpClientDownSocket, socket)->SetHttpState(HttpStateRecvExpected);
	return true;
}
Example #19
0
CExtGridCellColor* PropertiesBar::GetColor(CExtPropertyItem* pItem)
{
	CExtGridCellColor* pColor = STATIC_DOWNCAST(CExtGridCellColor,
				pItem->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellColor)));

	m_pGrid->propValueMgrs[pItem]->pCell = pColor;
	return pColor;
}
Example #20
0
CExtGridCellSlider* PropertiesBar::GetSlider(CExtPropertyItem* pItem)
{
	CExtGridCellSlider* pSlider = STATIC_DOWNCAST(CExtGridCellSlider,
						 pItem->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellSlider)));
	// Set the cell pointer
	m_pGrid->propValueMgrs[pItem]->pCell = pSlider;
	return pSlider;
}
Example #21
0
CExtGridCellString* PropertiesBar::GetEdit(CExtPropertyItem* pItem)
{
	CExtGridCellString* pString = STATIC_DOWNCAST(CExtGridCellString,
						 pItem->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellString)));
	// Set the cell pointer
	m_pGrid->propValueMgrs[pItem]->pCell = pString;
	return pString;
}
BOOL CExtChildResizablePropertySheet::PreTranslateMessage(MSG* pMsg)
{
CMainFrame * pMainFrame =
		STATIC_DOWNCAST( CMainFrame, AfxGetMainWnd() );
	if( pMainFrame->m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
		return TRUE;
	return CExtResizablePropertySheet::PreTranslateMessage(pMsg);
}
BOOL C3DGORangeWire::OnApply() 
{
	UpdateData();
	CDialog* pDlg = STATIC_DOWNCAST(CDialog, AfxGetMainWnd());
	pDlg->SendMessage(WM_3DOPTIONS_CHANGE, 0, 0);
	
	return CPropertyPage::OnApply();
}
Example #24
0
void CUrlClient::SendCancelTransfer(Packet* packet)
{
	if (socket)
	{
		STATIC_DOWNCAST(CHttpClientDownSocket, socket)->SetHttpState(HttpStateUnknown);
		socket->Safe_Delete();
	}
}
Example #25
0
void CSimpViewApp::OnFileNew()
{
    CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);

    // create a new MDI child window
    pFrame->CreateNewChild(
        RUNTIME_CLASS(CChildFrame), IDR_STEP1_VIEW, m_hMDIMenu, m_hMDIAccel);
}
Example #26
0
BOOL CModelerDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	m_bDocLoadedOk = FALSE;
  CTFileName fnModelFile = CTString(lpszPathName);

  try
  {
    fnModelFile.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return FALSE;
  }

  try
  {
    m_emEditModel.Load_t( fnModelFile);
  }
  catch( char *err_str)
  {
    CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
    MessageBoxA(pMainFrame->m_hWnd, err_str, "Warning! Model load failed.", MB_OK|MB_ICONHAND|MB_SYSTEMMODAL);
    return FALSE;
  }

  INDEX ctLoadedModels=m_emEditModel.edm_aamAttachedModels.Count();
  INDEX ctAttachmentPositions=m_emEditModel.edm_md.md_aampAttachedPosition.Count();
  
  if(ctLoadedModels<ctAttachmentPositions)
  {
    for( INDEX iPos=ctLoadedModels; iPos<ctAttachmentPositions; iPos++)
    {
      m_emEditModel.edm_aamAttachedModels.New();
      m_emEditModel.edm_aamAttachedModels.Lock();
      CAttachedModel &am=m_emEditModel.edm_aamAttachedModels[iPos];
      DECLARE_CTFILENAME( fnAxis, "Data\\Models\\Editor\\Axis.mdl");
      am.am_bVisible=TRUE;
      am.am_strName="Not loaded";
      am.am_iAnimation=0;
      try
      {
        am.SetModel_t(fnAxis);
      }
      catch( char *strError)
      {
        WarningMessage( strError);
      }
      m_emEditModel.edm_aamAttachedModels.Unlock();
    }
  }

	m_bDocLoadedOk = TRUE;
  // flush stale caches
  _pShell->Execute("FreeUnusedStock();");
  SelectSurface( 0, TRUE);
  return TRUE;
}
void CMidiTargetDlg::CTargetGridCtrl::OnItemChange(LPCTSTR Text)
{
	CMidiTarget&	targ = m_pParent->GetTarget(m_EditRow);
	switch (m_EditCol) {
	case COL_PORT:
		{
			int	iPort = _ttoi(Text);
			targ.m_Inst.Port = max(iPort, 0);
		}
		break;
	case COL_CHAN:
		{
			int	iChan = _ttoi(Text) - 1;
			iChan = CLAMP(iChan, 0, MIDI_CHANNELS - 1);
			if (iChan == targ.m_Inst.Chan)	// if value unchanged
				return;	// don't update target
			targ.m_Inst.Chan = CLAMP(iChan, 0, MIDI_CHANNELS - 1);
		}	
		break;
	case COL_EVENT:
		{
			CPopupCombo	*pCombo = STATIC_DOWNCAST(CPopupCombo, m_EditCtrl);
			int	iType = pCombo->GetCurSel();
			if (iType >= 0) {	// if valid selection
				if (iType == targ.m_Event)	// if value unchanged
					return;	// don't update target
				ASSERT(iType < CMidiTarget::EVENT_TYPES);
				targ.m_Event = iType;
			}
		}
		break;
	case COL_CONTROL:
		{
			int	ctrl = _ttoi(Text);
			targ.m_Control = CLAMP(ctrl, 0, MIDI_NOTE_MAX);
		}
		break;
	case COL_RANGE_START:
		targ.m_RangeStart = static_cast<float>(_tstof(Text));
		break;
	case COL_RANGE_END:
		targ.m_RangeEnd = static_cast<float>(_tstof(Text));
		break;
	default:
		NODEFAULTCASE;
	}
	// must copy modified target before calling CheckSharers, because in 
	// replace case, CheckSharers updates derived object's target array
	CMidiTarget	NewTarg(targ);	// copy modified target
	int	ShareCode;
	if (m_EditCol <= COL_CONTROL)	// if controller changed
		ShareCode = m_pParent->CheckSharers(targ);	// check for controller sharing
	else	// controller didn't change
		ShareCode = CSR_NONE;	// previous assignments don't matter
	if (ShareCode != CSR_CANCEL)	// if user didn't cancel
		m_pParent->OnTargetChange(NewTarg, m_EditRow, m_EditCol, ShareCode);	// call derived handler
}
Example #28
0
void CWndTerrainTilePalette::OnKillFocus(CWnd* pNewWnd) 
{
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  if(pNewWnd!=pMainFrame->m_pwndToolTip && pNewWnd!=this)
  {
    DestroyWindow();
    DeleteTempMap();
  }
}
void CToolTipWnd::ManualOff(void)
{
  CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  if( pMainFrame->m_pwndToolTip != NULL)
  {
    delete pMainFrame->m_pwndToolTip;
    pMainFrame->m_pwndToolTip = NULL;
  }
}
Example #30
0
CExtGridCellCheckBox* PropertiesBar::GetCheckBox(CExtPropertyItem* pItem)
{
	CExtGridCellCheckBox* pCheck = STATIC_DOWNCAST(CExtGridCellCheckBox,
						 pItem->ValueDefaultGetByRTC(RUNTIME_CLASS(CExtGridCellCheckBox)));
	// Set the cell pointer
	m_pGrid->propValueMgrs[pItem]->pCell = pCheck;
	pCheck->ModifyStyle(__EGCS_NO_INPLACE_CONTROL);
	return pCheck;
}