Exemple #1
0
void CPrefView::OnSize(UINT nType, int cx, int cy) 
{
	CFormView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	if (fSize) ReSize();
}
void CRadarMapCtrl::InitSizes(int width
					,int height
					,CRect	zoomInBtnRect
					,CRect  zoomOutBtnRect
					,CRect  stateRect)
{
	m_width=width;
	m_height=height;

	m_zoomInLeftPadding=zoomInBtnRect.left;
	m_zoomInTopPadding=zoomInBtnRect.top;
	m_zoomInBtnWidth=zoomInBtnRect.Width();
	m_zoomInBtnHeight=zoomInBtnRect.Height();

	m_zoomOutLeftPadding=zoomOutBtnRect.left;
	m_zoomOutTopPadding=zoomOutBtnRect.top;
	m_zoomOutBtnWidth=zoomOutBtnRect.Width();
	m_zoomOutBtnHeight=zoomOutBtnRect.Height();

	m_stateLeftPadding=stateRect.left;
	m_stateTopPadding=stateRect.top;
	m_stateWidth=stateRect.Width();
	m_stateHeight=stateRect.Height();

	ReSize();

	// 初始化和双缓冲相关的要素
	InitialDBB();

}
void CNewConfigGraChiDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);

    // TODO:  在此处添加消息处理程序代码
    if (nType == SIZE_RESTORED || nType == SIZE_MAXIMIZED)
        if (m_bHaveInit&&m_bHaveRemenberOldSize)
        {
            ReSize(m_vectOldSize, m_OldSize);
            CRect rectList1;
            m_list1.GetWindowRect(&rectList1);
            m_list1.SetColumnWidth(0, rectList1.Width() / 24.0);
            m_list1.SetColumnWidth(1, rectList1.Width() / 24.0*2.0);
            m_list1.SetColumnWidth(2, rectList1.Width() / 24.0 * 10.4);
            m_list1.SetColumnWidth(3, rectList1.Width() / 24.0 * 5.22);
            m_list1.SetColumnWidth(4, rectList1.Width() / 24.0 * 5.3);
            CRect rectList2;
            m_list2.GetWindowRect(&rectList2);
            m_list2.SetColumnWidth(0, rectList2.Width() / 24.0);
            m_list2.SetColumnWidth(1, rectList2.Width() / 24.0*2.0);
            m_list2.SetColumnWidth(2, rectList2.Width() / 24.0 * 10.4);
            m_list2.SetColumnWidth(3, rectList2.Width() / 24.0 * 5.22);
            m_list2.SetColumnWidth(4, rectList2.Width() / 24.0 * 5.3);
            Invalidate();
        }
}
//窗体大小变化时,使控件自适应//
void CVedioChiDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO:  在此处添加消息处理程序代码
	if (nType == SIZE_RESTORED || nType == SIZE_MAXIMIZED)
		ReSize();
}
Exemple #5
0
 /// Add element at end of array. reallocation if necessary.
 int Append (const T & el)
 {
   if (this->size == allocsize) 
     ReSize (this->size+1);
   this->data[this->size] = el;
   this->size++;
   return this->size;
 }
Exemple #6
0
 void Append (FlatArray<T2, B2> a2)
 {
   if (this->size+a2.Size() > allocsize)
     ReSize (this->size+a2.Size());
   for (int i = 0; i < a2.Size(); i++)
     this->data[this->size+i] = a2[i+B2];
   this->size += a2.Size();
 }
Exemple #7
0
String& String::operator += (const String &S)
{
    if(S._Length > 0)
    {
        const UINT StartLength = _Length;
        ReSize(StartLength + S._Length + 1);
        memcpy(_Data + StartLength, S._Data, S._Length + 1);
        _Length = StartLength + S._Length;
    }
    return *this;
}
Exemple #8
0
void UnicodeString::ResizeToCStringLength()
{
    for(UINT i = 0; i < _Capacity; i++)
    {
        if(_Data[i] == UnicodeNullTerminator)
        {
            _Length = i;
            ReSize(_Length + 1);
            return;
        }
    }
    SignalError(_T("No null terminator found in UnicodeString::ResizeToCStringLength"));
}
Exemple #9
0
void String::ResizeToCStringLength()
{
    for(UINT i = 0; i < _Capacity; i++)
    {
        if(_Data[i] == '\0')
        {
            _Length = i;
            ReSize(_Length + 1);
            return;
        }
    }
    SignalError("No null terminator found in String::ResizeToCStringLength");
}
bool BaseCellContainer::UnSerialize( GI::ByteBuffer &buf )
{
    DestroyAll();
    long s;
    if( !buf.Pop( &s ) ) return false;
    ReSize( s );
    for( long i = 0; i < s; ++ i )
    {
        buf.Pop( &m_cells[i].status );
        if( m_cells[i].status == Cell::USED ) m_cells[i].status = Cell::EMPTY;
    }
    return Super::UnSerialize( buf );
}
void CConfigChiDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialogEx::OnSize(nType, cx, cy);

    // TODO:  在此处添加消息处理程序代码
    if (nType == SIZE_RESTORED || nType == SIZE_MAXIMIZED)
        if (m_bHaveInit&&m_bHaveRemenberOldSize)
        {
            ReSize(m_vectOldSize, m_OldSize);
            CRect tabRect;
            m_tabConfig.GetClientRect(&tabRect);
            tabRect.left += 1;
            tabRect.right -= 1;
            tabRect.top += 25;
            tabRect.bottom -= 1;
            m_OldConfigGraChiDlg.MoveWindow(tabRect);
            m_NewConfigGraChiDlg.MoveWindow(tabRect);
        }
}
void ModelSelectionPane::AddItems(QList<ItemBase*> btnList)
{
    const int elew = m_elementSize.width();
    const int eleh = m_elementSize.height();

    int x = 0;
    int y = 0;

    m_elementList.append(btnList);
    m_elementCount = m_elementList.count();

	ReSize();
    PaneIndexDraw();
	
	// others
    for (int i = 0; i < m_elementList.count(); i++) {
        if(m_elementList[i] == NULL) return;

        switch(i%4) {
        case 0:
            x = ITEM_HORIZONTAL_SPACE + i/4*width();
            y = 0;
            break;
        case 1:
            x = ITEM_HORIZONTAL_SPACE*2 + elew + i/4*width();
            y = 0;
            break;
        case 2:
            x = ITEM_HORIZONTAL_SPACE + i/4*width();
            y = eleh + ITEM_VERTICAL_SPACE;
            break;
        case 3:
            x = ITEM_HORIZONTAL_SPACE*2 + elew + i/4*width();
            y = eleh + ITEM_VERTICAL_SPACE;
            break;
        default:
            break;
        }

        m_elementList[i]->setParent(ui->itemsetpane);
        m_elementList[i]->setGeometry(x, y, elew, eleh);
	}
}
//窗体大小变化时,使控件自适应//
void CVedioChiDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO:  在此处添加消息处理程序代码
	if (nType == SIZE_RESTORED || nType == SIZE_MAXIMIZED)
		if (m_bHaveInit&&m_bHaveRemenberOldSize)
		{
			ReSize(m_vectOldSize, m_OldSize);
			switch (m_nPicStyle)
			{
			case 1:
				getVideoRect(1);
				for (int n = 0; n < m_vectVedio.size();n++)
					m_vectVedio[n]->MoveWindow(m_vectVideoRect[0]);
				break;
			case 4:
				getVideoRect(4);
				for (int n = 0; n < 4;n++)
					for (int m = 0; m < m_vectVideoRect.size();m++)
						m_vectVedio[m + 4 * n]->MoveWindow(m_vectVideoRect[m]);
				break;
			case 9:
				getVideoRect(9);
				for (int n = 0; n < 2; n++)
					for (int m = 0; m < m_vectVideoRect.size(); m++)
						m_vectVedio[m + 9 * n]->MoveWindow(m_vectVideoRect[m]);
				break;
			case 16:
				getVideoRect(16);
				for (int n = 0; n < m_vectVideoRect.size();n++)
					m_vectVedio[n]->MoveWindow(m_vectVideoRect[n]);
				break;
			default:
				break;
			}
			Invalidate();
		}
}
void CDlgAppConfig::OnSize(UINT nType, int cx, int cy)
{
	if (m_Sizechange_flag)//如果确定OninitDlg已经调用完毕.
	{
		//随着窗体大小变化调整控件的大小及位置
		ReSize(BTN_MIN);
		ReSize(BTN_MAX);
		ReSize(BTN_CLOSE);
		ReSize(IDOK);
		ReSize(IDCANCEL);


		ReSize(EDIT_SECOND,true);
		ReSize(EDIT_RECORD,true);
		ReSize(EDIT_REST,true);
		ReSize(EDIT_LINGER,true);
		ReSize(EDIT_RUN,true);

		ReSize(STATIC_SECOND1,true);
		ReSize(STATIC_SECOND2,true);
		ReSize(STATIC_RECORD1,true);
		ReSize(STATIC_RECORD2,true);
		ReSize(STATIC_REST1,true);
		ReSize(STATIC_REST2,true);
		ReSize(STATIC_LINGER1,true);
		ReSize(STATIC_LINGER2,true);
		ReSize(STATIC_RUN1,true);
		ReSize(STATIC_RUN2,true);
		ReSize(STATIC_TITLE);

		ReSize(GROUP_CONFIG,true);
		m_Multiple_width = float(1)/ m_Multiple_width ; 
		m_Multiple_height = float(1)/m_Multiple_height ; 
	}
	CDialogSK::OnSize(nType, cx, cy);
}
Exemple #15
0
BOOL CBoxView::VPlaying()
{
	if (m_pGraph == NULL)
	{
		return FALSE;
	}

	CComPtr<IBaseFilter> pVideoInputFilter;
	HRESULT hr = FindInputFilters((void**)&pVideoInputFilter, CLSID_VideoInputDeviceCategory);
	if (pVideoInputFilter != NULL)
	{
		hr = m_pGraph->AddFilter(pVideoInputFilter, L"VCapture");
		//设置
		SetVideoProcAmp(pVideoInputFilter);

		CComPtr<IPin>			pAudio			= NULL;

		CComPtr<IPin>			pPinTemp		= NULL;
		CComPtr<IEnumPins>		pienumpins		= NULL;
		pVideoInputFilter->EnumPins(&pienumpins);
		while (pienumpins != NULL && pienumpins->Next(1, &pPinTemp, NULL) == S_OK)
		{
			PIN_DIRECTION ThisPinDir;
			pPinTemp->QueryDirection(&ThisPinDir);
			if (ThisPinDir == PINDIR_OUTPUT)
			{
				PIN_INFO pininfo;
				pPinTemp[0].QueryPinInfo(&pininfo);
				if (StrStr(pininfo.achName,_T("Audio")))
				{   //播放音频
					hr = m_pGraph->Render(pPinTemp);
					pAudio = pPinTemp;
					break;
				}
				else if (StrStr(pininfo.achName, _T("捕获"))     ||
						StrStr(pininfo.achName, _T("Capture"))
					)
				{	////设置捕获Filter的格式为输出PIN支持的某种宽高的格式
					CComPtr<IEnumMediaTypes> 	ptypes			= NULL;
					AM_MEDIA_TYPE				*ptype			= NULL;
					VIDEOINFOHEADER				*pvideoInfo		= NULL;

					pPinTemp->EnumMediaTypes(&ptypes);
					while (ptypes != NULL && ptypes->Next(1, &ptype, NULL) == 0)
					{
						if (ptype->majortype== MEDIATYPE_Video)
						{
							pvideoInfo = (VIDEOINFOHEADER *)ptype->pbFormat;
							if (m_DesiredHeight != 0									&&
								m_DesiredWidth  != 0									&&
								abs(pvideoInfo->rcSource.right)  == m_DesiredWidth		&&
								abs(pvideoInfo->rcSource.bottom) == m_DesiredHeight
								)
							{   //如果格式与所要求的格式一致的话,优先使用输出Pin的这种格式

								CComPtr<IAMStreamConfig>		pVSC = NULL;;      // for video cap
								hr = m_pCGB->FindInterface(&PIN_CATEGORY_CAPTURE,
									&MEDIATYPE_Video, pVideoInputFilter,
									IID_IAMStreamConfig, (void **)&pVSC);

								if (pVSC)
								{
									int nFrame = pvideoInfo->AvgTimePerFrame; // 得到采集的帧率
									CString str;
									str.Format(_T("FRAME: %d\n"), nFrame);
									OutputDebugString(str);

									//pvideoInfo->AvgTimePerFrame = (LONGLONG)(10000000/50);

									pVSC->SetFormat(ptype);
								}
								// Delete the media type when you are done.
								DeleteMediaType(ptype);
							}
						}
					}
				}
			}
			pPinTemp.Release();
		}


		if (pAudio)
		{	//是采集卡
			hr = m_pCGB->RenderStream(&PIN_CATEGORY_PREVIEW,
				&MEDIATYPE_Video,
				pVideoInputFilter,
				NULL,
				NULL);
			if (FAILED(hr))
				return FALSE;
		}
		else
		{	////目前PCI采集卡上有视频接口,而盒子的Filter上没有
			CComPtr<IPin>			pInPin			= NULL;
			CComPtr<IPin>			pOutPin			= NULL;
			CComPtr<IBaseFilter>	smarttee		= NULL;
			CComPtr<IBaseFilter>	decompression	= NULL;
			CComPtr<IBaseFilter>	pPreview		= NULL;

			hr = CoCreateInstance(CLSID_VideoRenderer, 0, CLSCTX_ALL, IID_IBaseFilter, (void**)&pPreview);
			//hr = CoCreateInstance(CLSID_FFDSHOW, 0, CLSCTX_ALL, IID_IBaseFilter, (void**)&decompression);
			if (decompression == NULL)
			{
				hr = CoCreateInstance(CLSID_SmartTee, 0, CLSCTX_ALL, IID_IBaseFilter, (void**)&smarttee);
				hr = CoCreateInstance(CLSID_MjpegDec, 0, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&decompression);
				if (hr != S_OK)
					return FALSE;

				{
					CComPtr<IEnumPins>		pEnum = 0;
					CComPtr<IPin>			pPin = 0;
					HRESULT hr = smarttee->EnumPins(&pEnum);
					if (FAILED(hr))
					{
						return hr;
					}
					while (pEnum->Next(1, &pPin, NULL) == S_OK)
					{
						PIN_DIRECTION ThisPinDir;
						pPin->QueryDirection(&ThisPinDir);
						if (ThisPinDir == PINDIR_OUTPUT)
						{
							CComPtr<IPin> pTmp = 0;
							hr = pPin->ConnectedTo(&pTmp);
							if (SUCCEEDED(hr)) // Already connected--not the pin we want
							{
								pTmp.Release();
							}
							else // Unconnected--this is the pin we want
							{
								PIN_INFO info;
								pPin->QueryPinInfo(&info);
								if (_tcsstr(info.achName, _T("Preview")))
								{
									//pEnum->Release();
									pOutPin = pPin;
									break;
								}
							}
						}
						pPin.Release();
					}
					pEnum.Release();
				}

				hr = m_pGraph->AddFilter(smarttee, L"CLSID_SmartTee");
				hr = m_pGraph->AddFilter(decompression, L"CLSID_MJPEG");
				hr = m_pGraph->AddFilter(pPreview, L"CLSID_VideoRenderer");

				ConnectFilters(m_pGraph, pVideoInputFilter, smarttee);
				ConnectFilters(m_pGraph, pOutPin, decompression);
				ConnectFilters(m_pGraph, decompression, pPreview);
			}
			else
			{	//创建FFDShow解码器
				hr = m_pGraph->AddFilter(decompression, L"CLSID_FFDSHOW");
				hr = m_pGraph->AddFilter(pPreview, L"CLSID_VideoRenderer");

				ConnectFilters(m_pGraph, pVideoInputFilter, decompression);
				ConnectFilters(m_pGraph, decompression, pPreview);
			}
		}

		//设置设备丢失时要处理消息的窗口
		hr = m_pGraph->QueryInterface(IID_IMediaEventEx, (void **)&m_pME);
		if (hr == NOERROR)
		{
			m_pME->SetNotifyWindow((OAHWND)m_pCtrlWnd->GetSafeHwnd(), WM_FGNOTIFY, 0);
		}

		hr = m_pGraph->QueryInterface(IID_IVideoWindow, (void **)&m_pVW);
		hr = m_pVW->put_AutoShow(OAFALSE);

		if (FAILED(hr))
			return FALSE;

		RECT rc;
		GetClientRect(m_pShowWnd->GetSafeHwnd(), &rc);
		m_pVW->put_Visible(OAFALSE);
		m_pVW->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
		m_pVW->put_WindowStyleEx(WS_EX_ACCEPTFILES);
		m_pVW->put_Owner((OAHWND)m_pShowWnd->GetSafeHwnd());
		//m_pVW->put_MessageDrain((OAHWND)m_pShowWnd->GetSafeHwnd());
		m_pVW->put_Visible(OATRUE);
		//m_pVW->put_Width(rc.right);
		//m_pVW->put_Height(rc.bottom);
		//m_pVW->SetWindowForeground(1);

		//m_pVW->SetWindowPosition(0, 0, rc.right, rc.bottom); // be this big
		ReSize(m_vedioRect);

		hr = m_pControl->Run();

		return SUCCEEDED(hr);
	}

	return FALSE;
}
void XToolBar::DoSize(XSize * s)
{
   cx = s->GetWidth();
   ReSize();
}
Exemple #17
0
void CIconEditEx::OnSize( UINT nType, int cx, int cy ) 
{
	CEdit::OnSize( nType, cx, cy );
	if (cx > 0 && cy >0)
		ReSize(cx, cy);
}
Exemple #18
0
LRESULT CIconEditEx::OnSetFont( WPARAM wParam, LPARAM lParam )
{
	LRESULT res = DefWindowProc( WM_SETFONT, wParam, lParam );
	ReSize();
	return res;
}
Exemple #19
0
void CIconEditEx::SetClearIcon(HICON icon)
{
	m_hClearIcon = icon;
	ReSize();
}
Exemple #20
0
void CIconEditEx::SetIcon(HICON icon) 
{
	m_hIcon = icon;
	ReSize();
}
Exemple #21
0
void CIconEditEx::SetIconDimentions(INT cx, INT cy)
{
	m_cx = cx;
	m_cy = cy;
	ReSize();
}
/*@ XToolBar::AddWindow(const XWindow * w, const BOOL newGroup, const BOOL adjustSize, const XWindow * insertBehind, const LONG x, LONG y)
@group adding/removing windows
@remarks Attach a window to the toolbar.
@parameters  <t 'ø' c=2>
            øXWindow * theWindow          øwindow to add
            øBOOL newGroup                øwith this window a new group starts
            øBOOL adjustSize              ørecalculate the hight of the toolbar depending on the dimensions of theWindow
            øXWindow * insertBehind       øinsert theWindow behind this window
            øLONG xOffset                 øx-offset of the window
            øLONG yOffset                 øy-offset of the window (usefull for XComboBox)
            </t>
@returns     BOOL                         success
*/
void XToolBar::AddWindow(const XWindow * w, const BOOL newGroup, const BOOL adjustSize, const XWindow * insertBehind, const LONG x, LONG y)
{
   XRect r;
   LONG xo = borderSize;
   LONG y0 = 0, xMax = 0;
   SHORT ins = clients;

   EnableWindowUpdate(FALSE);

   clients += 1;
   clientArray = (clientWin **) realloc(clientArray, clients * sizeof(clientWin *));

   if (clients > 1)
   {
      if (insertBehind)
      {
         SHORT i, j;

         for (i = 0; i < clients - 1; i++)
         {
            if (clientArray[i]->clientWin == insertBehind)
            {
               clientArray[i]->clientWin->GetSize(&r);
               SHORT xDiff = r.GetX() + r.GetWidth() + x;

               if (newGroup)
               {
                  if (style & TB_LEFT || style & TB_RIGHT)
                     goto newG;
                  xDiff += spacing;
               }
               ins = i + 1;
               xo = xDiff;
               XRect r2;

               w->GetSize(&r2);
               if (style & TB_LEFT || style & TB_RIGHT)
                  y += clientArray[i]->yOffset;
               xDiff = r2.GetWidth();

               for (j = clients - 1; j > i + 1; j--)
               {
                  clientArray[j] = clientArray[j - 1];
                  clientArray[j]->clientWin->GetSize(&r2);
                  r2.SetX(r2.GetX() + xDiff);
                  if (r2.GetX() + r2.GetWidth() > xMax)
                     xMax = r2.GetX() + r2.GetWidth();
                  r2.SetY(y);
                  clientArray[j]->clientWin->SetSize(&r2);
               }

               goto mark1;
            }
         }
      }
      else
      {
   newG:
         if (style & TB_LEFT || style & TB_RIGHT)
         {
            y0 = 0;
            for (SHORT i = 0; i < clients - 1; i++)
            {
               clientArray[i]->clientWin->GetSize(&r);
               if (r.GetY() < y0)
                  y0 = r.GetY();
               xo = r.GetX() + r.GetWidth();
            }
            y0 += borderSize;
            if (newGroup)
            {
               xo = borderSize;
               y0 += r.GetHeight() + spacing;
            }
            else if (clients > 1)
               y0 += r.GetHeight();
         }
         else
         {
            if (clients > 1)
               clientArray[clients - 2]->clientWin->GetSize(&r);
            xo = r.GetX() + r.GetWidth();
         }
         if (newGroup)
         {
            if (style & TB_TOP || style & TB_BOTTOM)
               xo += spacing;
            else
               y0 -= spacing;
         }
         y += y0;
      }
   }
mark1:

   clientArray[ins] = (clientWin *) calloc(sizeof(clientWin), 1);

   clientArray[ins]->clientWin = (XWindow *) w;
   clientArray[ins]->yOffset = y;
   clientArray[ins]->xOffset = x;
   clientArray[ins]->group = newGroup;

   if (adjustSize)
   {
      XRect rec;

      w->GetSize(&rec);
      if (style & TB_TOP || style & TB_BOTTOM)
      {
         if (rec.GetHeight() > cy - 1 * borderSize)
         {
            cy = rec.GetHeight() + 2 * borderSize;
            SetHeight(cy);
            ReSize();
         }
      }
      else
      {
         if (rec.GetWidth() + x + xo > cx - borderSize || xMax > cy)
         {
            if (xMax)
               cx = xMax + borderSize;
            else
               cx = rec.GetWidth() + x + xo + borderSize;
            SetHeight(cy);
            ReSize();
         }
      }
   }

   w->GetSize(&r);

   r.SetX(xo + x);
   r.SetY(cy - borderSize + y - r.GetHeight());
   w->SetSize(&r);

   EnableWindowUpdate();
}
Exemple #23
0
UnicodeString& UnicodeString::operator += (const UnicodeString &S)
{
    ReSize(_Length + S._Length + 1);
    memcpy(_Data + _Length, S._Data, (S._Length + 1) * sizeof(UnicodeCharacter));
    return *this;
}
bool GeneralMatrix::ReSize(int iRow,int iCol)const
{
	return ReSize(iRow,iCol,0.0);
}
Exemple #25
0
 /// Change logical size. If necessary, do reallocation. Keeps contents.
 void SetSize(int nsize)
 {
   if (nsize > allocsize) 
     ReSize (nsize);
   this->size = nsize; 
 }
Exemple #26
0
 /// Change physical size. Keeps logical size. Keeps contents.
 void SetAllocSize (int nallocsize)
 {
   if (nallocsize > allocsize)
     ReSize (nallocsize);
 }