예제 #1
0
/*
 * Returns the sub document associated with the scroll id.
 */
static bool
GetDOMTargets(uint64_t aScrollId,
              nsCOMPtr<nsIDocument>& aSubDocument,
              nsCOMPtr<nsIContent>& aTargetContent)
{
  // For tabs and subframes this will return the HTML sub document
  aTargetContent = nsLayoutUtils::FindContentFor(aScrollId);
  if (!aTargetContent) {
    return false;
  }
  nsCOMPtr<mozilla::dom::Element> domElement = do_QueryInterface(aTargetContent);
  if (!domElement) {
    return false;
  }

  aSubDocument = domElement->OwnerDoc();

  if (!aSubDocument) {
    return false;
  }

  // If the root element equals domElement, FindElementWithViewId found
  // a document, vs. an element within a document.
  if (aSubDocument->GetRootElement() == domElement && IsTab(aSubDocument)) {
    aTargetContent = nullptr;
  }

  return true;
}
예제 #2
0
void TVideoEditorText::KeyDown(const char *bytes, int32 numBytes)
{
	char theChar = *bytes;
			
	// Increment our counter
	m_KeyCount++;
	if (m_KeyCount > 2)
		m_KeyCount = 1;
		
	//	Check for a return or enter 
	if (theChar == B_ENTER || theChar == B_RETURN || theChar == 'r')
	{
		MakeFocus(false);
	}		
	// We have a number.  Update the cell...
	else if ( isdigit(theChar) )
	{
		UpdateCurrentCell(theChar);	
	}
	// Reset selected cell to zero
	else if ( IsDelete(theChar) || IsBackspace(theChar) )
	{
		//ClearCell();
	}
	// Tab key or period '.' moves us through the time elements
	else if( IsTab(theChar) || theChar == '.' )
	{	
		// Check for shift key.  This move us back through the elements
		if ( IsShiftKeyDown() )		
			DecrementCell();
		else
			IncrementCell();
	}
	else if ( IsArrows(theChar) )
	{
		switch(theChar)
		{
			// Increment value
			case B_UP_ARROW:
				break;
				
			// Decrement value
			case B_DOWN_ARROW:
				break;
				
			// Select next cell
			case B_LEFT_ARROW:
				DecrementCell();
				break;
				
			// Select previous cell
			case B_RIGHT_ARROW:
				IncrementCell();
				break;
		}
	}
	// Illegal character
	else
		;//beep();
}
예제 #3
0
파일: parsertemp.c 프로젝트: jff/mathspad
static void add_version_to_parser(VERSION *vers, int pmode, int prec)
{
    Char *c=vers->format[LATEXFORMAT];
    int i=vers->max[LATEXFORMAT];
    int j,n,shortop=0;
    if (!c) {
	c=vers->format[SCREENFORMAT];
	i=vers->max[SCREENFORMAT];
    }
    for (j=n=0;j<i;j++) if (c[j]>SoftNewline && c[j]!=Newline) n++;
    if (i==1 && (pmode&INFIX) && !IsPh(c[0]) && !IsTab(c[0])) shortop=1;
    if (vers->latexmode & LTEXTMODE) {
	add_format_to_parser(c, i, vers->ivnr, InText,n, pmode, prec, 0);
	if (shortop)
	    add_format_to_parser(c, i, vers->ivnr, InText,n, pmode, prec, 1);
    }
    if (vers->latexmode & LMATHMODE) {
	add_format_to_parser(c, i, vers->ivnr, InMath,n, pmode|EXPR, prec, 0);
	if (shortop)
	    add_format_to_parser(c, i, vers->ivnr, InMath,n,
				 pmode|EXPR, prec, 1);
    }
}
예제 #4
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();
}