Beispiel #1
0
void CHeaderView::PreSubClassWnd() 
{
	m_pParentWnd = GetParent();
	ASSERT(m_pParentWnd);
	ClearImages();
	ReDraw(); 
}
void CCxLoginBar::OnLoadImages ()
{
	//static const int cxImg = 16;
	//static const int cyImg = 16;

	static const LPCTSTR arrImageName[] = {
		"User.png",
		"Login.png", "login_Pressed.png", "login_Focused.png",
		"Logout.png", "logout_Pressed.png", "logout_Focused.png"
	};

	CString strDir = GetExecDir() + "\\Res\\Login\\";
	Bitmap * pBitmap = NULL;
	HBITMAP hbmp = NULL;

	//ResetAll();
	ClearImages();

	Color crImgBg;
	crImgBg.SetFromCOLORREF(g_crToolbarBg);

	//m_BCGToolbarImages.SetImageSize( CSize(cxImg, cyImg) );
	m_BCGToolbarImages.SetTransparentColor (g_crToolbarBg);

	int nCount = sizeof( arrImageName ) / sizeof( LPCTSTR );
	for (int i=0; i<nCount; i++)
	{
		pBitmap = GetNewBitmap( strDir + arrImageName[i] );
		if ( pBitmap == NULL )
		{
			ClearImages();
			return;
		}
		m_vImages.push_back( pBitmap );
		pBitmap->GetHBITMAP( crImgBg, &hbmp);
		if ( hbmp == NULL )
		{
			ClearImages();
			return;
		}
		m_vHBitmaps.push_back( hbmp );
		m_BCGToolbarImages.AddImage( hbmp );
	}

	if ( m_BCGToolbarImages.GetCount() == 0 ) return;
}
//********************************************************************
void CGuiHeaderCtrl::PreSubclassWindow() 
{
	m_pParentWnd = GetParent();
	ASSERT(m_pParentWnd);
	CHeaderCtrl::PreSubclassWindow();
	ClearImages();
	ReDraw(); 
}
bool MY_UI::Controls::Image::Set_Texture(std::string filename){
	ClearImages();
	if(Add_Texture(filename)){
		Set_ShownImage(0);// set this  so the object can draw
		return true;
	}
	return false;
}
Beispiel #5
0
void CImageDialogTools::ExecCommand( ImageDialogToolCommand cmd, unsigned int unParam )
{
    int			index;

    // Get the current index
    index = m_lImagesList.GetCurSel();

    // Switch for each command.
    switch (cmd)
    {
    case CMD_LINK:
        m_bLinked = ( unParam != 0) ? true : false;
        UpdateData( false );
        break;

    case CMD_GOTO:
        m_lImagesList.SetCurSel( unParam );
        ShowSelectedImage();
        break;

    case CMD_REWIND:
        m_lImagesList.SetCurSel( 0 );
        ShowSelectedImage();
        break;

    case CMD_FRAMEBACK:
        if ( (index != 0) && (index != LB_ERR) )
        {
            m_lImagesList.SetCurSel( index - 1 );
            ShowSelectedImage();
        }
        break;

    case CMD_FRAMENEXT:
        if ( ( index !=  m_lImagesList.GetCount()-1 ) && (index != LB_ERR) )
        {
            m_lImagesList.SetCurSel( index + 1 );
            ShowSelectedImage();
        }
        break;

    case CMD_TOEND:
        m_lImagesList.SetCurSel( m_lImagesList.GetCount() - 1 );
        ShowSelectedImage();
        break;

    case CMD_CLEAR:
        m_pImageDialog->ClearImages();
        ClearImages();
        break;
    }
}
Beispiel #6
0
	virtual void ApplySchemeSettings(IScheme *pScheme)
	{
		// set up the scheme settings
		Button::ApplySchemeSettings(pScheme);

		_textColor = GetSchemeColor("PropertySheet.SelectedTextColor", GetFgColor(), pScheme);
		_dimTextColor = GetSchemeColor("PropertySheet.TextColor", GetFgColor(), pScheme);
		m_pActiveBorder = pScheme->GetBorder("TabActiveBorder");
		m_pNormalBorder = pScheme->GetBorder("TabBorder");

		if ( m_pImage )
		{
			ClearImages();
			m_pImage->SetImage(scheme()->GetImage(m_pszImageName, false));
			AddImage( m_pImage->GetImage(), 2 );
			int w, h;
			m_pImage->GetSize( w, h );
			w += m_pContextLabel ? 10 : 0;
			if ( m_pContextLabel )
			{
				m_pImage->SetPos( 10, 0 );
			}
			SetSize( w + 4, h + 2 );
		}
		else
		{
			int wide, tall;
			int contentWide, contentTall;
			GetSize(wide, tall);
			GetContentSize(contentWide, contentTall);

			wide = max(m_bMaxTabWidth, contentWide + 10);  // 10 = 5 pixels margin on each side
			wide += m_pContextLabel ? 10 : 0;
			SetSize(wide, tall);
		}

		if ( m_pContextLabel )
		{
			SetTextInset( 12, 0 );
		}
	}
Beispiel #7
0
//********************************************************************
int CHeaderView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	ClearImages();
	ReDraw();
	return 0;
}
Beispiel #8
0
void MythUIEditBar::Display(void)
{
    QRect keeparea = QRect();
    QRect cutarea  = QRect();
    MythUIType *position    = GetChild("position");
    MythUIType *keep        = GetChild("keep");
    MythUIType *cut         = GetChild("cut");
    MythUIType *cuttoleft   = GetChild("cuttoleft");
    MythUIType *cuttoright  = GetChild("cuttoright");
    MythUIType *keeptoleft  = GetChild("keeptoleft");
    MythUIType *keeptoright = GetChild("keeptoright");

    if (position)
        position->SetVisible(false);

    if (keep)
    {
        keep->SetVisible(false);
        keeparea = keep->GetArea();
    }

    if (cut)
    {
        cut->SetVisible(false);
        cutarea = cut->GetArea();
    }

    if (cuttoleft)
        cuttoleft->SetVisible(false);

    if (cuttoright)
        cuttoright->SetVisible(false);

    if (keeptoleft)
        keeptoleft->SetVisible(false);

    if (keeptoright)
        keeptoright->SetVisible(false);

    if (position && keeparea.isValid())
    {
        int offset = position->GetArea().width() / 2;
        int newx   = (int)(((float)keeparea.width() * m_editPosition) + 0.5f);
        int newy   = position->GetArea().top();
        position->SetPosition(newx - offset, newy);
        position->SetVisible(true);
    }

    ClearImages();

    if (!m_regions.size())
    {
        if (keep)
            keep->SetVisible(true);

        return;
    }

    MythUIShape *barshape   = dynamic_cast<MythUIShape *>(cut);
    MythUIImage *barimage   = dynamic_cast<MythUIImage *>(cut);
    MythUIShape *leftshape  = dynamic_cast<MythUIShape *>(cuttoleft);
    MythUIImage *leftimage  = dynamic_cast<MythUIImage *>(cuttoleft);
    MythUIShape *rightshape = dynamic_cast<MythUIShape *>(cuttoright);
    MythUIImage *rightimage = dynamic_cast<MythUIImage *>(cuttoright);

    QListIterator<QPair<float, float> > regions(m_regions);

    while (regions.hasNext() && cutarea.isValid())
    {
        QPair<float, float> region = regions.next();
        int left  = (int)((region.first * cutarea.width()) + 0.5f);
        int right = (int)((region.second * cutarea.width()) + 0.5f);

        if (left >= right)
            right = left + 1;

        if (cut)
        {
            AddBar(barshape, barimage, QRect(left, cutarea.top(), right - left,
                                             cutarea.height()));
        }

        if (cuttoleft && (region.second < 1.0f))
            AddMark(leftshape, leftimage, right, true);

        if (cuttoright && (region.first > 0.0f))
            AddMark(rightshape, rightimage, left, false);
    }

    CalcInverseRegions();

    barshape   = dynamic_cast<MythUIShape *>(keep);
    barimage   = dynamic_cast<MythUIImage *>(keep);
    leftshape  = dynamic_cast<MythUIShape *>(keeptoleft);
    leftimage  = dynamic_cast<MythUIImage *>(keeptoleft);
    rightshape = dynamic_cast<MythUIShape *>(keeptoright);
    rightimage = dynamic_cast<MythUIImage *>(keeptoright);

    QListIterator<QPair<float, float> > regions2(m_invregions);

    while (regions2.hasNext() && keeparea.isValid())
    {
        QPair<float, float> region = regions2.next();
        int left  = (int)((region.first * keeparea.width()) + 0.5f);
        int right = (int)((region.second * keeparea.width()) + 0.5f);

        if (left >= right)
            right = left + 1;

        if (keep)
        {
            AddBar(barshape, barimage, QRect(left, keeparea.top(), right - left,
                                             keeparea.height()));
        }

        if (keeptoleft && (region.second < 1.0f))
            AddMark(leftshape, leftimage, right, true);

        if (keeptoright && (region.first > 0.0f))
            AddMark(rightshape, rightimage, left, false);
    }

    if (position)
        position->MoveToTop();
}
Beispiel #9
0
void MythUIEditBar::ReleaseImages(void)
{
    ClearImages();
}
TimeFrequencyImager::~TimeFrequencyImager()
{
	ClearImages();
	if(_sortedTable != 0)
		delete _sortedTable;
}
void TimeFrequencyImager::image(size_t antenna1Select, size_t antenna2Select, size_t spectralWindowSelect, size_t startIndex, size_t endIndex)
{
	size_t timeCount = _observationTimes.size();
	int frequencyCount = _measurementSet->FrequencyCount();

	initializePolarizations();
	checkPolarizations();

	if(_sortedTable == 0)
	{
		casa::Table *rawTable = _measurementSet->OpenTable();
		casa::Block<casa::String> names(4);
		names[0] = "DATA_DESC_ID";
		names[1] = "ANTENNA1";
		names[2] = "ANTENNA2";
		names[3] = "TIME";
		_sortedTable = new casa::Table(rawTable->sort(names));
		delete rawTable;
	}

	casa::Block<casa::String> selectionNames(3);
	selectionNames[0] = "DATA_DESC_ID";
	selectionNames[1] = "ANTENNA1";
	selectionNames[2] = "ANTENNA2";
	casa::TableIterator iter(*_sortedTable, selectionNames, casa::TableIterator::Ascending, casa::TableIterator::NoSort);
	while(!iter.pastEnd())
	{
		casa::Table table = iter.table();
		casa::ScalarColumn<int> antenna1(table, "ANTENNA1"); 
		casa::ScalarColumn<int> antenna2(table, "ANTENNA2");
		casa::ScalarColumn<int> windowColumn(table, "DATA_DESC_ID");
		if(table.nrow() > 0 && windowColumn(0) == (int) spectralWindowSelect && antenna1(0) == (int) antenna1Select && antenna2(0) == (int) antenna2Select)
		{
			break;
		} else {
			iter.next();
		}
	}
	if(iter.pastEnd())
	{
		throw std::runtime_error("Baseline not found");
	}

	casa::Table table = iter.table();

	if(startIndex > timeCount)
	{
		std::cerr << "Warning: startIndex > timeCount" << std::endl;
	}
	if(endIndex > timeCount)
	{
		endIndex = timeCount;
		std::cerr << "Warning: endIndex > timeCount" << std::endl;
	}

	size_t width = endIndex-startIndex;
	if(width == 0 || frequencyCount == 0)
		return;

	ClearImages();

	if(_readData) {
		if(_realXX==0 && _readXX)
		{
			_realXX = Image2D::CreateZeroImagePtr(width, frequencyCount);
			_imaginaryXX = Image2D::CreateZeroImagePtr(width, frequencyCount);
		}
		if(_realXY == 0 && _readXY)
		{
			_realXY = Image2D::CreateZeroImagePtr(width, frequencyCount);
			_imaginaryXY = Image2D::CreateZeroImagePtr(width, frequencyCount);
		}
		if(_realYX == 0 && _readYX)
		{
			_realYX = Image2D::CreateZeroImagePtr(width, frequencyCount);
			_imaginaryYX = Image2D::CreateZeroImagePtr(width, frequencyCount);
		}
		if(_realYY == 0 && _readYY)
		{
			_realYY = Image2D::CreateZeroImagePtr(width, frequencyCount);
			_imaginaryYY = Image2D::CreateZeroImagePtr(width, frequencyCount);
		}
		if(_realStokesI == 0 && _readStokesI)
		{
			_realStokesI = Image2D::CreateZeroImagePtr(width, frequencyCount);
			_imaginaryStokesI = Image2D::CreateZeroImagePtr(width, frequencyCount);
		}
	}
	if(_readFlags) {
		// The flags should be initialized to true, as this baseline might
		// miss some time scans that other baselines do have, and these
		// should be flagged.
		if(_flagXX==0 && _readXX)
			_flagXX = Mask2D::CreateSetMaskPtr<true>(width, frequencyCount);
		if(_flagXY==0 && _readXY)
			_flagXY = Mask2D::CreateSetMaskPtr<true>(width, frequencyCount);
		if(_flagYX==0 && _readYX)
			_flagYX = Mask2D::CreateSetMaskPtr<true>(width, frequencyCount);
		if(_flagYY==0 && _readYY)
			_flagYY = Mask2D::CreateSetMaskPtr<true>(width, frequencyCount);
		if(_flagCombined==0 && _readStokesI)
			_flagCombined = Mask2D::CreateSetMaskPtr<true>(width, frequencyCount);
	}
	_uvw.resize(width);

	casa::ScalarColumn<int> antenna1(table, "ANTENNA1"); 
	casa::ScalarColumn<int> antenna2(table, "ANTENNA2");
	casa::ScalarColumn<int> windowColumn(table, "DATA_DESC_ID");
	casa::ScalarColumn<double> timeColumn(table, "TIME");
	casa::ArrayColumn<float> weightColumn(table, "WEIGHT");
	casa::ArrayColumn<double> uvwColumn(table, "UVW");

	casa::ArrayColumn<casa::Complex> *dataColumn = 0;
	if(_readData)
		dataColumn = CreateDataColumn(_dataKind, table);

	ArrayColumnIterator<casa::Complex> *modelIter;
	if(_dataKind == ResidualData) {
		casa::ArrayColumn<casa::Complex> *modelColumn;
		modelColumn = new casa::ArrayColumn<casa::Complex>(table, "MODEL_DATA");
		modelIter = new ArrayColumnIterator<casa::Complex>(ArrayColumnIterator<casa::Complex>::First(*modelColumn));
	} else {
		modelIter = 0;
	}
	casa::ArrayColumn<bool> flagColumn(table, "FLAG");

	ScalarColumnIterator<int> antenna1Iter = ScalarColumnIterator<int>::First(antenna1);
	ScalarColumnIterator<int> antenna2Iter = ScalarColumnIterator<int>::First(antenna2);
	ScalarColumnIterator<int> windowIter = ScalarColumnIterator<int>::First(windowColumn);
	ScalarColumnIterator<double> timeIter = ScalarColumnIterator<double>::First(timeColumn);
	ArrayColumnIterator<double> uvwIter = ArrayColumnIterator<double>::First(uvwColumn);
	ArrayColumnIterator<float> weightIter = ArrayColumnIterator<float>::First(weightColumn);
	ArrayColumnIterator<casa::Complex> dataIter = 
		ArrayColumnIterator<casa::Complex>::First(*dataColumn);
	ArrayColumnIterator<bool> flagIter = 
		ArrayColumnIterator<bool>::First(flagColumn);

	for(size_t i=0;i<table.nrow();++i) {
		double time = *timeIter;
		size_t timeIndex = _observationTimes.find(time)->second;
		bool timeIsSelected = timeIndex>=startIndex && timeIndex<endIndex;
		if(_readData && timeIsSelected) {
			if(_dataKind == WeightData)
				ReadWeights(timeIndex-startIndex, frequencyCount, *weightIter);
			else if(modelIter == 0)
				ReadTimeData(timeIndex-startIndex, frequencyCount, *dataIter, 0);
			else {
				const casa::Array<casa::Complex> model = **modelIter; 
				ReadTimeData(timeIndex-startIndex, frequencyCount, *dataIter, &model);
			}
		}
		if(_readFlags && timeIsSelected) {
			const casa::Array<bool> flag = *flagIter;
			ReadTimeFlags(timeIndex-startIndex, frequencyCount, flag);
		}
		if(timeIsSelected) {
			casa::Array<double> arr = *uvwIter;
			casa::Array<double>::const_iterator i = arr.begin();
			_uvw[timeIndex-startIndex].u = *i;
			++i;
			_uvw[timeIndex-startIndex].v = *i;
			++i;
			_uvw[timeIndex-startIndex].w = *i;
		}

		if(_readData)
		{
			++dataIter;
			if(modelIter != 0)
				++(*modelIter);
		}
		if(_readFlags)
		{
			++flagIter;
		}

		++weightIter;
		++antenna1Iter;
		++antenna2Iter;
		++timeIter;
		++uvwIter;
		++windowIter;
	}
	if(dataColumn != 0)
		delete dataColumn;
}
MY_UI::Controls::Image::~Image(){
	ClearImages();
}
void MY_UI::Controls::Image::Set_Texture(Utilities::Texture& tex, bool takeownership){
	ClearImages();
	Add_Texture(tex, takeownership);
	
	Set_ShownImage(0);// set this  so the object can draw
}
Beispiel #14
0
void ViewPort::RenderImages( RECT region, double pixel_size, double offset_x, double offset_y, bool use_proxy )
{
	Transform *transform;									// render image onto view using pixel_size
	Point *p, min, max;
	Contour *domain;
	RECT r, labeled;
	double x, y, area;
	int index, i;
	char txt[128];
	Image_Ptr images[MAX_DOMAINS];						// number of domains is limited by 8bit mask size
	Nform_Ptr nforms[MAX_DOMAINS];
	POINT mins[MAX_DOMAINS], maxs[MAX_DOMAINS];
// begin debug logging...
	DWORD byteswritten;
	char line[MAX_PATH];
	if ( debugLogFile != INVALID_HANDLE_VALUE )
		{
		sprintf(line,"Entered ViewPort::RenderImages\r\n");
		WriteFile(debugLogFile, line, strlen(line), &byteswritten, NULL);
		}
// ...end debug logging
startTime3 = GetTickCount();
															// check for valid render region
	if ( (region.right - region.left) < 0 ) return;
	if ( (region.bottom - region.top) < 0 ) return;
															// limit render region to view pixels
	if ( region.left < 0 ) r.left = 0; else r.left = region.left;
	if ( region.right >= width ) r.right = width-1; else r.right = region.right;
	if ( region.top < 0 ) r.top = 0; else r.top = region.top;
	if ( region.bottom >= height ) r.bottom = height-1; else r.bottom = region.bottom;
	
	ClearImages( r );								// clear the region to all zeros before rendering
	
	for (index=0; index < MAX_DOMAINS; index++)		// clear the image and nform pointer arrays
		{
		images[index] = NULL;
		nforms[index] = NULL;
		}

	if ( section->transforms )
		{											// FIRST PASS... Create index mask for images on view
		index = 0;													// count every domain in section with index
		transform = section->transforms->first;						// render in order, back to front
		while ( transform && (index < MAX_DOMAINS) )
			{			
			if ( transform->image ) 								// do only if image is present and not hidden
				{
				if ( transform->domain && !transform->domain->hidden )
					{												// use domain boundary to define render area...
					index++;										
					domain = new Contour( *(transform->domain) );	// create a copy of domain
					domain->Scale( transform->image->mag );			// go from pixels to units
					domain->InvNform( transform->nform );			// transform into section
					domain->Shift( -offset_x, -offset_y );			// shift from view offset			
					labeled = view->Mask( domain, pixel_size, index, r );	// label pixels for rendering
					if ( labeled.left <= labeled.right )			// only use if some interior pixels were set
						{									
						images[index] = transform->image;			// store ptr to image for later rendering step
						nforms[index] = transform->nform;
						mins[index].x = labeled.left; mins[index].y = labeled.top;
						maxs[index].x = labeled.right; maxs[index].y = labeled.bottom;
						}
					delete domain;									// delete copy of domain
					}
				}
			transform = transform->next;				// do next transform in list
			}

		while ( index > 0 )							// SECOND PASS... render each indexed subregion from image sources
			{										
			view->MaskXform( images[index], nforms[index], index, mins[index], maxs[index],
																	pixel_size, offset_x, offset_y, use_proxy );
			index--;
			}
		}
totalTime3 += GetTickCount() - startTime3;	// DEBUGGING
nTime3++;
}