Ejemplo n.º 1
0
void TTimeTextView::MakeFocus(bool focusState)
{
	BTextView::MakeFocus(focusState);
	
	// Inform target
	if ( focusState == false)
	{
		if (m_Target)
		{
			BLooper *looper = m_Target->Looper();
			
			if ( looper->Lock() )
			{
				CheckLastEdit();
				
				for (int16 index = 1; index < 5; index++)
					ConvertToTime(index);
				
				if (m_MessageID)
				{
					BMessage *message = new BMessage(m_MessageID);
					message->AddInt32("TheTime", m_Time);
					m_Target->MessageReceived( message);
					looper->Unlock();
					delete message;
				}
			}			
		}
	}
}
Ejemplo n.º 2
0
void TTimeTextView::MouseDown(BPoint where)
{
		
	// Do nothing if locked
	if (m_IsLocked)
		return;	
		
	// Deselect all	
	MakeFocus(true);
	Select(0,0);
	
	// Make sure last edit is valid
	CheckLastEdit();
			
	// Determine where the click is
	if ( m_HoursRect.Contains(where) ) 
	{
		Select(0,2);
		ScrollToSelection();
		m_CurrentCell = 1;
	}
	else if ( m_MinutesRect.Contains(where) ) 
	{
		Select(3,5);
		ScrollToSelection();	
		m_CurrentCell = 2;
	}

	else if ( m_SecondsRect.Contains(where) ) 
	{
		Select(6,8);
		ScrollToSelection();
		m_CurrentCell = 3;
	}

	else if ( m_FramesRect.Contains(where) ) 
	{
		Select(9,11);
		ScrollToSelection();
		m_CurrentCell = 4;
	}
	// Default to first cell if all else fails
	else
	{
		Select(0,2);
		ScrollToSelection();
		m_CurrentCell = 1;
	}

	//BTextView::MouseDown(where);	
}
Ejemplo n.º 3
0
void TVideoEditorText::IncrementCell()
{
	// Reset key counter
	fKeyCount = 0;

	// Verify last text entry as valid
	CheckLastEdit();

	// Clean up old cell
	InvertCurrentCell();

	// Select the next cell
	fCurrentCell++;

	// Check for overflow
	if (fCurrentCell > 4)
		fCurrentCell = 1;

	// Clean up old cell
	InvertCurrentCell();
}
Ejemplo n.º 4
0
void TVideoEditorText::DecrementCell()
{
	// Reset key counter
	fKeyCount = 0;

	// Verify last text entry as valid
	CheckLastEdit();

	// Clean up old cell
	InvertCurrentCell();

	// Select the previous cell
	fCurrentCell--;

	// Check for overflow
	if (fCurrentCell <= 0)
		fCurrentCell = 4;

	// Select new cell
	InvertCurrentCell();

}
Ejemplo n.º 5
0
void TTimeTextView::KeyDown(const char *bytes, int32 numBytes)
{
	char 	theChar = *bytes;	
	
	//	Check for a return or enter 
	if (theChar == B_ENTER || theChar == B_RETURN || theChar == 'r')
	{
		// Deselect all
		Select(0,0);		
		
		// Check integrity of last edited value
		CheckLastEdit();
		
		MakeFocus(false);
	}		
	// Accept numbers
	else if( isdigit(theChar) )
	{
		/*
		short	tmpNum;
		bool	addIt = false;

		switch (m_CurrentCell)
		{
			case 1:
				if (inputNum[0] < 2 || inputNum[0] == 2 && theChar < '4')
					addIt = true;
					break;
				
			case 2:
				if (inputNum[1] < 6)
					addIt = true;
					break;
				
			case 3:
				if (inputNum[2] < 6)
					addIt = true;
					break;
				
			case 4:
				if (GetCurrentTimeFOrmat() == kMIDI && inputNum[3] < 10)
					addIt = true;
				else if (inputNum[3] < 2)
					addIt = true;
				else if (inputNum[3] == 2) 
				{
					switch (GetCurrentTimeFormat()) 
					{
					
						case kSMPTE24:
							if (theChar < '4')
								addIt = true;
							break;
							
						case kSMPTE25:
							if (theChar < '5')
								addIt = true;
							break;
							
						case kSMPTE2997:
						case kSMPTE30:
							addIt = true;
							break;
					}
				}
				break;		
		}
		
		if (addIt) 
		{
			inputNum[itsCurrentField - 1] *= 10;
			inputNum[itsCurrentField - 1] += theChar - '0';
			//DrawEditField();
		}
		*/
		
		BTextView::KeyDown(bytes, numBytes);
	}
	// Tab key moves us through the time elements
	else if( IsTab(theChar) || theChar == '.' )
	{
		int16 lastCell = m_CurrentCell;
		
		// Deselect all
		Select(0,0);		
		
		// Check integrity of last edited value
		CheckLastEdit();
		
		// Check for shift key
		if ( IsShiftKeyDown() )
		{
			// Select the previous cell
			m_CurrentCell--;
			
			if (m_CurrentCell <= 0)
				m_CurrentCell = 4;			
		}
		else
		{
			// Select the next cell
			m_CurrentCell++;
		
			if (m_CurrentCell > 4)
				m_CurrentCell = 1;
		}
			
		switch (m_CurrentCell)
		{
			case 1:
				Select(0,2);
				ScrollToSelection();
				break;
				
			case 2:
				Select(3,5);
				ScrollToSelection();
				break;
				
			case 3:
				Select(6,8);
				ScrollToSelection();
				break;
				
			case 4:
				Select(9,11);
				ScrollToSelection();
				break;		
				
			default:
				break;				
		}
	}
	// Illegal character
	else
		beep();
}