Exemplo n.º 1
0
/*
 * FocusOnImage - Selects one of the mdi children.
 */
void FocusOnImage( HWND hwnd )
{
    char        current_file[ _MAX_PATH ];
    char        *text;

    if (activeImage) {
        RedrawPrevClip(activeImage->hwnd);
        SetRectExists( FALSE );
    }

    activeImage = SelectImage( hwnd );
    if (!activeImage) {
        WImgEditError( WIE_ERR_BAD_HWND, WIE_INTERNAL_001 );
        return;
    }
    ResetViewWindow( activeImage->viewhwnd );
    CreateDrawnImage( activeImage );

    SetMenus( activeImage );
    SetNumColours( 1<<(activeImage->bitcount) );

    SetHotSpot( activeImage );
    DisplayImageText( activeImage );
    CheckForUndo( activeImage );

    GetFnameFromPath( activeImage->fname, current_file );

    text = (char *)
        MemAlloc( strlen( IEAppTitle ) + strlen( current_file ) + 3 + 1 );
    if( text ) {
        strcpy( text, IEAppTitle );
        strcat( text, " - " );
        strcat( text, current_file );
        _wpi_setwindowtext( _wpi_getframe(HMainWindow), text );
        MemFree( text );
    }

#ifndef __OS2_PM__
    RedrawWindow( hwnd, NULL, NULL, RDW_UPDATENOW );
#endif
} /* FocusOnImage */
Exemplo n.º 2
0
// draw days of month
int CMiniCalendarCtrl::DrawDays(CDC& _dc,
								int _iY,
								int _iLeftX,
								int _iRow,
								int _iMonth,
								int _iYear)
{
	int iReturn = 0;
	int iStartY = _iY;

	COleDateTime dtStart;
	dtStart.SetDate(_iYear, _iMonth, 1);

	COleDateTime dt(dtStart);
	while (dt.GetDayOfWeek() != m_iFirstDayOfWeek)
		dt -= 1;

	// calculate starting X position
	int iStartX = ((_iLeftX + (m_szMonthSize.cx / 2))) - (((m_iIndividualDayWidth*7) + 30) / 2);
	int iEndX = ((_iLeftX + (m_szMonthSize.cx / 2))) + (((m_iIndividualDayWidth*7) + 30) / 2);

	int iX = iStartX;

	CFont* pOldFont = _dc.SelectObject(m_pFont);
	_dc.SetBkColor(::GetSysColor(COLOR_BTNFACE));
	_dc.SetTextColor(::GetSysColor(COLOR_BTNTEXT));
	_dc.SetBkMode(TRANSPARENT);

	int iDayCounter = 0;

	// we allow up to 6 rows of days.  This is the actual maximum # of calendar
	// weeks that can occur in a month.
	int iRow; 
	for (iRow = 1; iRow <= 6; iRow++)
	{
		int iX = iStartX;

		for (int iDayOfWeek = 1; iDayOfWeek <= 7; iDayOfWeek++)
		{
			if (dt.GetMonth() == dtStart.GetMonth() ||
				(dt > dtStart && _iRow == m_iRows) ||
				(dt < dtStart && _iRow == 1))
			{
				CString strText = CCalendarUtils::LongToString(dt.GetDay());

				COLORREF cTextColor = MINICAL_COLOUR_DAY;
				if (dt.GetMonth() != _iMonth)
				{
					cTextColor = MINICAL_COLOUR_DAY_DIFFERENTMONTH;
				}

				//initialize as a normal date
				pOldFont = _dc.SelectObject(m_pFont);
				_dc.SetTextColor(cTextColor);

				if (IsDateSelected(dt))
				{
					//selected date
					if (m_pCalendarData->IsImportantDate(dt))
					{
						//important date too
						pOldFont = _dc.SelectObject(m_pFontBold);
					}
					else
					{
						pOldFont = _dc.SelectObject(m_pFont);
					}

					_dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
					_dc.FillSolidRect(iX-1, _iY, m_iIndividualDayWidth+3, m_iDaysHeight+1, ::GetSysColor(COLOR_HIGHLIGHT));
				}
				else if (m_pCalendarData->IsImportantDate(dt))
				{
					BOOL bImportantDate = TRUE;

					DWORD dwStyleCompletedTasks = m_pWnd->GetDisplayFlags();
					if (dwStyleCompletedTasks & COMPLETEDTASKS_HIDDEN)
					{
						//completed tasks are hidden. only consider this date important if there is one or more non-hidden tasks
						bImportantDate = FALSE;

						CTaskInfoList listTasks;
						m_pCalendarData->GetTasks(dt, listTasks);
						ASSERT(!listTasks.IsEmpty());

						//look for non-hidden tasks
						for (POSITION pos = listTasks.GetHeadPosition(); (pos != NULL) && !bImportantDate; )
						{
							CTaskInfo ti = listTasks.GetNext(pos);
							if (!ti.IsComplete())
							{
								bImportantDate = TRUE;
							}
						}
					}

					if (bImportantDate)
					{
						//important date
						pOldFont = _dc.SelectObject(m_pFontBold);
						if (m_pWnd->IsDateHidden(dt))
						{
							//hidden weekend date
							_dc.SetTextColor(MINICAL_COLOUR_HIDDEN_WEEKEND_DAY);
						}
						_dc.FillSolidRect(iX-1, _iY, m_iIndividualDayWidth+3, m_iDaysHeight+1, MINICAL_COLOUR_IMPORTANTDAY_BACKGROUND);
					}
				}
				else if (m_pWnd->IsDateHidden(dt))
				{
					//hidden weekend date
					pOldFont = _dc.SelectObject(m_pFont);
					_dc.SetTextColor(MINICAL_COLOUR_HIDDEN_WEEKEND_DAY);
				}

				_dc.DrawText(strText, CRect(iX, _iY, iX+m_iIndividualDayWidth,_iY+m_iDaysHeight), DT_BOTTOM | DT_RIGHT | DT_SINGLELINE);

				//highlight today
				if (IsToday(dt))
					_dc.Draw3dRect(iX-2, _iY, m_iIndividualDayWidth+5, m_iDaysHeight+1, MINICAL_COLOUR_HEADERFONT, MINICAL_COLOUR_HEADERFONT);

				SetHotSpot(_iRow, iDayCounter, dt, CRect(iX-3,_iY,iX-3+m_iIndividualDayWidth+5, _iY+m_iDaysHeight+2));
			}

			dt += 1;
			iX += (m_iIndividualDayWidth + 5);
			iDayCounter++;
		}

		_iY += (2 + m_iDaysHeight);
		iReturn += (2 + m_iDaysHeight);
	}

	_dc.SelectObject(pOldFont);

	// draw the divider line
	if (iRow == m_iRows)
	{
		CPen* pPen = new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
		CPen* pOldPen = _dc.SelectObject(pPen);

		_dc.MoveTo(iStartX, _iY);
		_dc.LineTo(iEndX, _iY);

		_dc.SelectObject(pOldPen);
		delete pPen;
	}

	iReturn += 5;

	SetCellPosition(_iRow, CRect(iStartX, iStartY, iEndX, _iY));

	return iReturn;
}
Exemplo n.º 3
0
void Sprite::SetHotSpot(int x, int y)
{
    SetHotSpot(IntVector2(x, y));
}
Exemplo n.º 4
0
/*
 * SetNewHotSpot - set the value of the hot spot for the cursor.
 */
void SetNewHotSpot( WPI_POINT *pt )
{
    activeImage->hotspot = *pt;
    SetHotSpot(activeImage);
} /* SetNewHotSpot */