Example #1
0
BOOL CDomain::AddStockSort( LPCTSTR lpszStockCode )
{
	if( NULL == lpszStockCode || strlen(lpszStockCode) <= 0 )
		return FALSE;

	for( int k=0; k<GetSize(); k++ )
	{
		int nCmp = ElementAt(k).CompareNoCase(lpszStockCode);
		if( 0 == nCmp )
			return FALSE;
		if( nCmp > 0 )
		{
			InsertAt(k, lpszStockCode );
			return TRUE;
		}
	}

	Add( lpszStockCode );
	return TRUE;
}
Example #2
0
void CLineCrossings::AddCrossing(CFixed lPosition, int nCount)
{
    int nCrossings = Crossings();
    int nCrossing;

    // Look for the crossing in the array.
    // This will also determine the place to insert if it is not found.
    for (nCrossing = 0; nCrossing < nCrossings; nCrossing++)
    {
        // Get the crossing to check where we are.
        CLineCrossing* pCrossing = Crossing(nCrossing);

        // If this crossing is at our position, merge the counts.
        if (pCrossing->m_lPosition == lPosition)
        {
            // Update the existing one.
            if ((pCrossing->m_nCount += nCount) == 0)
            {
                // The crossing went away! Get rid of it.
                delete pCrossing;
                RemoveAt(nCrossing);
            }
            return;
        }
        if (pCrossing->m_lPosition > lPosition)
        {
            // Insert here.
            break;
        }
    }

    // The crossing was not found. Create a new one.
    CLineCrossing* pCrossing = new CLineCrossing;

    // Fill in the values.
    pCrossing->m_lPosition = lPosition;
    pCrossing->m_nCount = nCount;

    // Insert it where we stopped searching.
    InsertAt(nCrossing, pCrossing);
}
Example #3
0
    Data* Data::FindKey(const Data& key)
    {
	if(!IsList())
	    throw LangErr("Data::FindKey","object is not a list");

	bool is_old;
	size_t i;

	i=KeyLookup(key,is_old);

	if(!is_old)
	{
	    Data pair;

	    pair.MakeList(2);
	    pair.vec[0]=key;
			
	    return InsertAt(i,pair);
	}
		
	return &vec[i];
    }
Example #4
0
	Data* DataFileDB::FindKey(const Data& key)
	{
		if(dbtype==DBNone)
			throw LangErr("DataFileDB::FindKey(const Data&)","cannot do key lookup on database type DBNone");
		else if(dbtype==DBSingleFile)
		{
			MarkAllDirty();
			return Data::FindKey(key);
		}
		else if(dbtype==DBStringKeys)
		{
			bool is_old;
			size_t pos;
		
			pos=KeyLookup(key,is_old);

			if(is_old)
				LoadCache(pos);
			else
			{
				Data pair;

				pair.MakeList(2);
				pair[0]=key;
				InsertAt(pos,pair);
			}

			Touch(pos);
			MarkDirty(pos);
			CacheUpdate();
			
			return &vec[pos];
		}
		else
			throw Error::NotYetImplemented("DataFileDB::FindKey(const Data&)");
	}
Example #5
0
void COXMaskedEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// If there is no mask, then exit quickly performing the default operation. 
	if(m_listData.GetCount()==0 || GetStyle()&ES_READONLY)
	{
		CEdit::OnChar(nChar, nRepCnt, nFlags);
		return;
	}
	
	int nSelectionStart=0;
	int nSelectionEnd  =0;
	GetSel(nSelectionStart, nSelectionEnd);
	
	// If character value is above 32, then it is ANSI or Extended. 
	// Below 32 are control and navigation characters. 
	if(nChar >= 32)
	{
		if(nSelectionStart==nSelectionEnd)
		{
			if(IsInputData(nSelectionStart))
			{
				int nActualInsertionPoint=nSelectionStart;
				if(m_bInsertMode)
					nActualInsertionPoint=InsertAt(nSelectionStart, (TCHAR)nChar);
				else
					nActualInsertionPoint=SetAt   (nSelectionStart, (TCHAR)nChar);
				
				// InsertAt will return -1 if the character cannot be inserted here. 
				if(nActualInsertionPoint >= 0)
					nSelectionStart=nActualInsertionPoint + 1;
				else
					ValidationError();
				
				Update(nSelectionStart);
			}
			else
			{
				// Beep if trying to type over a literal. 
				ValidationError();
				UpdateInsertionPointForward(nSelectionStart);
			}
		}
		else
		{
			// First delete the remaining selection. 
			// The function will return a valid count if 
			// some input characters were deleted. We use 
			// this value to determine if it makes sense to insert. 
			if(DeleteRange(nSelectionStart, nSelectionEnd))
			{
				// InsertAt will place the character at the next available position, 
				// then return that positition
				int nActualInsertionPoint=nSelectionStart;
				nActualInsertionPoint=InsertAt(nSelectionStart, (TCHAR)nChar);
				
				// InsertAt will return -1 if the character cannot be inserted here. 
				if(nActualInsertionPoint >= 0)
					nSelectionStart=nActualInsertionPoint + 1;
				else
					ValidationError();
				
				Update(nSelectionStart);
			}
			else  // Must be on a literal, so beep and move to a valid location. 
			{
				ValidationError();
				UpdateInsertionPointForward(nSelectionStart);
			}
		}
	}
	else
	{
		if(nChar==VK_BACK)
		{
			// Backspace performs two functions, if there is a selection,
			// then the backspace is the same as deleting the selection.
			// If there is no selection, then the backspace deletes the
			// first non-literal character to the left.
			if(nSelectionStart==nSelectionEnd)
			{
				if (nSelectionStart >= 1)
				{
					while (nSelectionStart>=0)
					{
						nSelectionStart--; // Do the equivalent of a backspace.

						if (DeleteRange(nSelectionStart, nSelectionEnd))
						{
							Update(nSelectionStart);
							break;
						}

						nSelectionEnd--;
					}
				}
			}
			else if(DeleteRange(nSelectionStart, nSelectionEnd))
			{
				Update(nSelectionStart);
			}
			else	// Must be on a literal, so continue moving to left
					// and re-attempting the delete until we either delete
					// a character or run out of characters.
			{
				if (nSelectionStart >= 1)
				{
					while (nSelectionStart>=0)
					{
						nSelectionStart--; // Do the equivalent of a backspace.

						if (DeleteRange(nSelectionStart, nSelectionEnd))
						{
							Update(nSelectionStart);
							break;
						}
						
						nSelectionEnd--;
					}
				}
			}
		}
		else
			// let edit control to do its job 
			CEdit::OnChar(nChar, nRepCnt, nFlags);
	}
}
Example #6
0
/** Add a new entry, same as "SetAtGrow(GetSize(), ...)"
 * @return the index of the newly added row
 */
int c4_View::Add(const c4_RowRef& newElem_) 
{
  int i = GetSize();
  InsertAt(i, newElem_);
  return i;
}
Example #7
0
long scCharArray::ReadText( scSpecRun&	specRun,
						   APPCtxPtr	ctxPtr,
						   IOFuncPtr	readFunc,
						   int			charset )
{
	UCS2	ch,
				lastCh;
	long		ret;
	long		i;
	CharRecord	chRecBuf[kMaxCharBuf];
	CharRecord	chRec;
	TypeSpec	ts		= specRun.SpecAtOffset( 0 );
	scDBCSDetector detector( ts );

	i = 0;
	
	for ( lastCh = '\0'; (ret = scAPPReadCharacter( ctxPtr, readFunc, ch, detector )) == 1L; ) {
		if ( ch < 256 && !sc_CharType[(ch)+1] )
			continue;
		
		if ( ch == scHardReturn )
			break;
		
#ifdef JAPANESE //j
	if ( IntlScript() != smJapanese )
	{ // this does not work well with japanese fonts
		if ( ch == '"' )
		{
			if ( lastCh == ' ' || lastCh == '\0' )
				ch = 0xD2;
			else
				ch = 0xD3;
		}
		else if ( ch == '-' ) {
			if ( lastCh == '-' ) {
				if ( (chRec-1)->character == '-' ) {
					(chRec-1)->character = emDash;
					continue;
				}
			}
		}
	}
#endif JAPANESE

		chRecBuf[i].ClearFlags();
		chRecBuf[i].character		= ch;
		chRecBuf[i++].escapement	= 0;

		if ( i == kMaxCharBuf ) {
			InsertAt( GetNumItems() - 1, (ElementPtr)chRecBuf, kMaxCharBuf );
			i = 0;
		}
		lastCh				= ch;
	}

	if ( i )
		InsertAt( GetNumItems() - 1, (ElementPtr)chRecBuf, i );
	
	Validate();
	
	return ret;
}
Example #8
0
	int8 *Guest::Ram::MapAdd(const void *persist, int32 dev_lo, int32 dev_hi, const MemHandlers *handlers) {
		GuestDev *dev = FindPersist(persist);
		if(!dev) {
			ZSSERT(0);
			return 0;
		}

		if(dev_lo > dev_hi) {
			Piston::Gui::MessageBox::Show(Piston::StringBuilder::Build(L"'",
				dev->GetName(), L"' requested a memory map from 0x",
				Piston::String::Renderhex(dev_lo).PadLeft(dev_lo <= 0xffff ? 4 : 8, L'0'), L" to 0x",
				Piston::String::Renderhex(dev_hi).PadLeft(dev_lo <= 0xffff ? 4 : 8, L'0'), L".  Lower "
				L"bound is greater than upper bound."), Piston::Gui::MessageBox::Icons::Warning);
			return 0;
		}

		int i;
		for(i = 0; i < MapCount; ++i)
			if(dev_lo <= maps[i].mem_hi) {
				if(dev_hi <= maps[i].mem_hi) {
					if(!InsertAt(i)) goto MapSpaceMsg;
					maps[i].Set(persist, dev_lo - 1, dev_hi, handlers);
					return ram + dev_lo;
				} else // dev_hi > maps[i].mem_hi
					goto OverlapMsg;
			} else if(dev_lo <= maps[i].dev_hi)
				goto OverlapMsg;

		{
			Piston::StringBuilder err(L"An internal memory map error occured when '");
			err.Append(dev->GetName());
			err.Append(L"' requested a memory map from 0x");
			err.Append(Piston::String::Renderhex(dev_lo).PadLeft(dev_hi <= 0xffff ? 4 : 8, L'0'));
			err.Append(L" to 0x");
			err.Append(Piston::String::Renderhex(dev_hi).PadLeft(dev_hi <= 0xffff ? 4 : 8, L'0'));
			err.Append(L".\r\n\r\nMap dump:");
			for(int j = 0; j < MapCount; ++j) {
				err.Append(L"\r\n[");
				err.Append(Piston::String::Render(i).PadLeft(2, L'0'));
				err.Append(L"]: 0x");
				err.Append(Piston::String::Renderhex(maps[j].dev_hi).PadLeft(8, L'0'));
				err.Append(L"-0x");
				err.Append(Piston::String::Renderhex(maps[j].mem_hi).PadLeft(8, L'0'));
				err.Append(L", '");
				err.Append(FindPersist(maps[j].dev_persist)->GetName());
				err.Append(L"'");
				if(maps[j].dev_hi == 0xffffffff)
					break;
			}
			Piston::Gui::MessageBox::Show(err.Render(), Piston::Gui::MessageBox::Icons::Warning);
		}
		return 0;

MapSpaceMsg:
		Piston::Gui::MessageBox::Show(Piston::StringBuilder::Build(L"Ran out of memory map space when '",
			dev->GetName(), L"' requested a memory map from 0x",
			Piston::String::Renderhex(dev_lo).PadLeft(dev_hi <= 0xffff ? 4 : 8, L'0'), L" to 0x",
			Piston::String::Renderhex(dev_hi).PadLeft(dev_hi <= 0xffff ? 4 : 8, L'0'), L"."),
			Piston::Gui::MessageBox::Icons::Warning);
		return 0;

OverlapMsg:
		Piston::Gui::MessageBox::Show(Piston::StringBuilder::Build(L"'",
			dev->GetName(), L"' requested a memory map from 0x",
			Piston::String::Renderhex(dev_lo).PadLeft(dev_hi <= 0xffff ? 4 : 8, L'0'), L" to 0x",
			Piston::String::Renderhex(dev_hi).PadLeft(dev_hi <= 0xffff ? 4 : 8, L'0'),
			L".  This overlaps with memory range ",
			Piston::String::Renderhex(maps[i].mem_hi + 1).PadLeft(maps[i].dev_hi <= 0xffff ? 4 : 8, L'0'), L" to 0x",
			Piston::String::Renderhex(maps[i].dev_hi).PadLeft(maps[i].dev_hi <= 0xffff ? 4 : 8, L'0'),
			L" already mapped by '" + FindPersist(maps[i].dev_persist)->GetName(), L"'."),
			Piston::Gui::MessageBox::Icons::Warning);
		return 0;
	}
Example #9
0
void processMsg(void)
{
  struct IntuiMessage *msg;
  struct DropMessage *dm;
  int    source,target;

  while(!ende)
  {
    WaitPort(win->UserPort);
    while((msg = GTD_GetIMsg(win->UserPort)) != 0)
    {
      imsg = *msg;

      if (imsg.Class == IDCMP_OBJECTDROP)
      {
        if ((dm = imsg.IAddress) != 0)
        {
          if (!dm->dm_Object.od_Owner && dm->dm_Target)
          {
            target = dm->dm_Target->GadgetID;
            switch(target)
            {
              case 1:
              case 2:
                source = dm->dm_Gadget->GadgetID;
                if (source < 3)
                {
                  source--;  target--;
                  GT_SetGadgetAttrs(lvgad[0],win,NULL,GTLV_Labels,~0L,TAG_END);
                  GT_SetGadgetAttrs(lvgad[1],win,NULL,GTLV_Labels,~0L,TAG_END);
                  if (target)
                    MoveTo(dm->dm_Object.od_Object,&list[source],dm->dm_SourceEntry,&list[target],dm->dm_TargetEntry);
                  else
                  {
                    Remove(dm->dm_Object.od_Object);
                    AddTail(&list[target],dm->dm_Object.od_Object);
                  }
                  GT_SetGadgetAttrs(lvgad[0],win,NULL,GTLV_Labels,&list[0],TAG_END);
                  GT_SetGadgetAttrs(lvgad[1],win,NULL,GTLV_Labels,&list[1],TAG_END);
                }
                else
                {
                  target--;
                  GT_SetGadgetAttrs(lvgad[target],win,NULL,GTLV_Labels,~0L,TAG_END);
                  if ((node = AllocMem(sizeof(struct Node),MEMF_CLEAR | MEMF_PUBLIC)) != 0)
                  {
                    node->ln_Name = in.in_Name;
                    InsertAt(&list[target],node,dm->dm_TargetEntry);
                  }
                  GT_SetGadgetAttrs(lvgad[target],win,NULL,GTLV_Labels,&list[target],TAG_END);
                }
                break;
              case 3:
                DisplayBeep(NULL);
                break;
              case 4:
              case 5:
                source = dm->dm_Gadget->GadgetID-1;
                GT_SetGadgetAttrs(lvgad[source],win,NULL,GTLV_Labels,~0L,TAG_END);
                if (target == 4)
                {
                  if ((node = AllocMem(sizeof(struct Node),MEMF_CLEAR | MEMF_PUBLIC)) != 0)
                  {
                    node->ln_Name = ((struct ImageNode *)dm->dm_Object.od_Object)->in_Name;
                    AddTail(&list[source],node);
                  }
                }
                else
                {
                  Remove((struct Node *)dm->dm_Object.od_Object);
                  FreeMem(dm->dm_Object.od_Object,sizeof(struct Node));
                }
                GT_SetGadgetAttrs(lvgad[source],win,NULL,GTLV_Labels,&list[source],TAG_END);
                break;
            }
          }
          else if (!dm->dm_Object.od_Owner)
          {
            DisplayBeep(NULL);   // unsupported drag?!
          }
          else if (!stricmp(dm->dm_Object.od_Owner,"dragtest"))
          {
            char t[256];

            if (GTD_GetString(&dm->dm_Object,t,256))
              ErrorRequest("I do not want a node from a clone of mine.\nEspecially, I don't like \"%s\".",t);
          }
          else if (!strcmp(dm->dm_Object.od_Owner,"intuition"))
            ErrorRequest("An object from a custom gadget?\nThat's nothing for me.",dm->dm_Object.od_Owner);
          else
            ErrorRequest("An object from %s?\nSounds interesting.",dm->dm_Object.od_Owner);
        }
        else
          DisplayBeep(NULL);
      }
      GTD_ReplyIMsg(msg);

      switch(imsg.Class)
      {
        case IDCMP_GADGETDOWN:
          break;
        case IDCMP_GADGETUP:
          switch(((struct Gadget *)imsg.IAddress)->GadgetID)
          {
            case 3:
              GT_SetGadgetAttrs(lvgad[0],win,NULL,GTLV_Labels,~0L,TAG_END);
              if ((node = AllocMem(sizeof(struct Node),MEMF_CLEAR | MEMF_PUBLIC)) != 0)
              {
                node->ln_Name = in.in_Name;
                AddTail(&list[0],node);
              }
              GT_SetGadgetAttrs(lvgad[0],win,NULL,GTLV_Labels,&list[0],TAG_END);
              break;
          }
          break;
        case IDCMP_CLOSEWINDOW:
          ende = TRUE;
          break;
      }
    }
  }
}
Example #10
0
int CKData::MergeKData( CKData * pother )
{
	if( !pother || pother->GetSize() == 0 )
		return 0;
	if( GetKType() != pother->GetKType() )
		return 0;

	if( GetSize() == 0 )
	{
		CopyData( *pother );
		return GetSize();
	}

	int	nCount		= 0;
	SetSize( GetSize(), pother->GetSize()+1 );
	for( int i=0; i<pother->GetSize(); i++ )
	{
		KDATA	kdnew	=	pother->ElementAt(i);
		if( kdnew.m_fClose < 1e-4 || kdnew.m_fOpen < 1e-4 || kdnew.m_fHigh < 1e-4 || kdnew.m_fLow < 1e-4 )
			continue;

		for( int j=0; j<GetSize(); j++ )
		{
			if( kdnew.m_date == ElementAt(j).m_date )
			{
				SetAt(j,kdnew);
				break;
			}
			if( kdnew.m_date < ElementAt(j).m_date )
			{
				InsertAt(j,kdnew);
				break;
			}
		}
		if( GetSize() == j )
			Add( kdnew );
		nCount	++;
	}

	return nCount;

/*	The Old Version
	if( !pother || pother->GetSize() == 0 )
		return GetSize();
	if( GetKType() != pother->GetKType() )
		return GetSize();

	if( GetSize() == 0 )
	{
		CopyData( *pother );
		return GetSize();
	}

	int nLen = GetSize();
	int nLenOther = pother->GetSize();

	SP_ASSERT( 0 != nLen && 0 != nLenOther );

	if( ElementAt(nLen-1).m_date < pother->ElementAt(0).m_date )
		CopyData( *pother );
//	else if( ElementAt(0).m_date > pother->ElementAt(nLenOther-1).m_date )
//		;
//	else if( ElementAt(0).m_date <= pother->ElementAt(0).m_date
//		&& ElementAt(nLen-1).m_date >= pother->ElementAt(nLenOther-1).m_date )
//		;
	else if( ElementAt(0).m_date > pother->ElementAt(0).m_date
		&& ElementAt(nLen-1).m_date < pother->ElementAt(nLenOther-1).m_date )
		CopyData( *pother );
	else if( ElementAt(0).m_date <= pother->ElementAt(0).m_date
		&& ElementAt(nLen-1).m_date < pother->ElementAt(nLenOther-1).m_date )
	{
		// append from pother
		DWORD	date	=	ElementAt(nLen-1).m_date;
		SetSize( GetSize(), pother->GetSize() );
		for( int i=0; i<pother->GetSize(); i++ )
		{
			KDATA	& kd	=	pother->ElementAt(i);
			if( kd.m_date > m_data )
				Add( kd );
		}
	}
	else if( ElementAt(0).m_date >= pother->ElementAt(0).m_date
		&& ElementAt(nLen-1).m_date > pother->ElementAt(nLenOther-1).m_date )
	{
		// insert from pother
		CKData	temp	=	(*pother);
		DWORD	date	=	pother->ElementAt(nLenOther-1).m_date;
		temp.SetSize( temp.GetSize(), GetSize()+5 );
		for( int i=0; i<GetSize(); i++ )
		{
			KDATA	& kd	=	ElementAt(i);
			if( kd.m_date > date )
				temp.Add( kd );
		}
		CopyData( temp );
	}
	
	return GetSize();
*/
}
CXTPChartTitle* CXTPChartTitleCollection::Add(CXTPChartTitle* pTitle)
{
	InsertAt(GetCount(), pTitle);

	return pTitle;
}
Example #12
0
void vToken::SetSeparator( char *sep ,char *pOP,BOOL bEmpty)
{
#ifndef VTFIX
	for (int i=0;i<m_arg.GetSize();i++)
		m_arg[i].Close();
	m_arg.RemoveAll();	
#endif
	nMaxArg = 0;

	// separate tokens.
	char *p	= (char*)m_in.GetBuffer();
	char *ret;
	int max = strlen(p);
	int ni	= 0;

	// copy
	char *pcopy	= new char[max+1];
	strcpy(pcopy,p);
	pcopy[max]	= 0;

	// synth
	char newsep[100];
	strcpy(newsep,sep);
	strcat(newsep,pOP);

	/*
	// find former part. ex) when " (1+2)", ( cannot be neglected!.
	ret	= strtok(p,newsep);
	if ( strlen(ret)!=strlen(p))
	{
		ret	= strtok(p,sep);
		for ( int i=0;i<strlen(ret);i++)
		for ( int j=0;j<strlen(pOP);j++)
			if ( ret[i]==pOP[j]	)	Add(pOP[j]);
	}
	strcpy(p,pcopy);	
	*/

	// general separating routine
	while(*p!=0 )
	{	
		ret	= strtok(p,newsep);
		if ( ret==NULL)
		{			
			for ( int i=0;i<strlen(p);i++)
			for ( int j=0;j<strlen(pOP);j++)
				if ( p[i]==pOP[j]	)	
					Add(vString(pOP[j]));
			break;
		}
		
		char *p2 = p;
		while( strlen(ret)!=strlen(p2))
		{
			for ( int j=0;j<strlen(pOP);j++)
			if ( *p2==pOP[j]	)	
				Add(vString(pOP[j]));
			p2++;
		}
		strcpy(p,&pcopy[ni]);	
		
		ret	= strtok(p,newsep);
		Add(vString(ret));

		int n	= ni+strlen(p);
		for ( int i=0;i<strlen(pOP);i++)
		if ( pcopy[n]==pOP[i] )	
		{
			Add(vString(pOP[i]));
			break;
		}
		
		ni+=strlen(p);
		p+=strlen(p);
		
		p++;
		ni++;

		if ( ni>=max )	break;
	}

	delete pcopy;

	if ( bEmpty)
	for (int i=0;i<GetSize();i++)
	{
		CString tmp = m_arg[i];

		BOOL bSep = FALSE;
		int j;
		for ( j=0;j<strlen(pOP);j++)
		if ( tmp==pOP[j])
		{
			bSep = TRUE;
			break;
		}

		if ( bSep)
		{
			CString tmp2;
			if ( i+1<GetSize())	tmp2 = m_arg[i+1];

			if ( tmp2.IsEmpty())	
			{
				Add("");
				return;
			}
			else
			{
				for ( j=0;j<strlen(pOP);j++)
				if ( tmp2==pOP[j])
				{
					InsertAt("",i+1);
					i++;
					break;
				}	
			}
		}
	}
}
bool OSDMenuKeyboard_EventHandler(word *event, dword *param1, dword *param2)
{
  TRACEENTER();

  (void) param2;

  if(OSDMenuKeyboard_StringVarOrig == NULL)
  {
    TRACEEXIT();
    return FALSE;
  }

  if(!OSDMenuKeyboard_GUIInitialized)
  {
    OSDMenuKeyboard_CursorPosition = strlenUC(OSDMenuKeyboard_StringVar);
    OSDMenuKeyboard_TextStartPosition = 0;
    KeyPadPosition = 0;

    OSDMenuKeyboard_Draw();
    OSDMenuKeyboard_TMSRemoteDirectMode(TRUE);
    OSDMenuKeyboard_GUIInitialized = TRUE;
  }

  if(event)
  {
    switch(*event)
    {
      case EVT_KEY:
      {
        switch(*param1)
        {
          case RKEY_Right:      //Zeichenauswahl rechts
          case RKEY_VolUp:
          {
            KeyPadPosition++;
            switch(KeyPadPosition)
            {
              case  8: KeyPadPosition =  0; break;
              case 16: KeyPadPosition =  8; break;
              case 24: KeyPadPosition = 16; break;
              case 29: KeyPadPosition = 24; break;
            }
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Left:       //Zeichenauswahl links
          case RKEY_VolDown:
          {
            KeyPadPosition--;

            switch(KeyPadPosition)
            {
              case -1: KeyPadPosition =  7; break;
              case  7: KeyPadPosition = 15; break;
              case 15: KeyPadPosition = 23; break;
              case 23: KeyPadPosition = 28; break;
            }
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Down:       //Zeichenauswahl hinunter
          case RKEY_ChUp:
          {
            //Spezialbehandlung durch die 2 grossen Tasten
            switch(KeyPadPosition)
            {
              case 18:
              case 19: KeyPadPosition = 26; break;
              case 20:
              case 21: KeyPadPosition = 27; break;
              case 22:
              case 23: KeyPadPosition = 28; break;
              case 24: KeyPadPosition =  0; break;
              case 25: KeyPadPosition =  1; break;
              case 26: KeyPadPosition =  2; break;
              case 27: KeyPadPosition =  4; break;
              case 28: KeyPadPosition =  6; break;

              default: KeyPadPosition += 8;
            }
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Up:         //Zeichenauswahl hoch
          case RKEY_ChDown:
          {
            //Spezialbehandlung durch die 2 grossen Tasten
            switch(KeyPadPosition)
            {
              case  0: KeyPadPosition = 24; break;
              case  1: KeyPadPosition = 25; break;
              case  2:
              case  3: KeyPadPosition = 26; break;
              case  4:
              case  5: KeyPadPosition = 27; break;
              case  6:
              case  7: KeyPadPosition = 28; break;
              case 27: KeyPadPosition = 20; break;
              case 28: KeyPadPosition = 22; break;
              default: KeyPadPosition -= 8;
            }
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Next:       //Cursor rechts
          {
            OSDMenuKeyboard_CursorRight();
            break;
          }

          case RKEY_Prev:       //Cursor links
          {
            OSDMenuKeyboard_CursorLeft();
            break;
          }

          case RKEY_Slow:       //Cursor ans Ende
          {
            OSDMenuKeyboard_CursorEnd();
            break;
          }

          case RKEY_Ok:         //Zeichen übernehmen
          {
            switch(KeyPadPosition)
            {
              case 26:
              {
                if(strlen(OSDMenuKeyboard_StringVar) < OSDMenuKeyboard_StringMaxLen)
                {
                  InsertAt(OSDMenuKeyboard_StringVar, OSDMenuKeyboard_CursorPosition, " ");
                  OSDMenuKeyboard_CursorPosition++;
                  OSDMenuKeyboard_Draw();
                }
                break;
              }

              case 27:
              {
                OSDMenuKeyboard_DeleteLeft();
                break;
              }

              case 28:
              {
                OSDMenuKeyboard_SaveAndFinish();

                TRACEEXIT();
                return TRUE;
              }

              default:
              {
                if(strlen(OSDMenuKeyboard_StringVar) < OSDMenuKeyboard_StringMaxLen)
                {
                  InsertAt(OSDMenuKeyboard_StringVar, OSDMenuKeyboard_CursorPosition, Keypad[KeyPadMode][KeyPadPosition]);
                  OSDMenuKeyboard_CursorPosition++;
                  OSDMenuKeyboard_Draw();
                }
              }
            }
            break;
          }

          case RKEY_Info:       //Zeichensatz ändern
          case RKEY_Play:
          {
            KeyPadMode++;
            if(KeyPadMode >= KPM_NrModes) KeyPadMode = 0;
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Pause:      //Zwischen normalen und CAPS Zeichen wechseln
          {
            if(KeyPadMode == KPM_Standard)
              KeyPadMode = KPM_CAPS;
            else
              KeyPadMode = KPM_Standard;
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Forward:    //Zeichen rechts löschen
          {
            OSDMenuKeyboard_DeleteRight();
            break;
          }

          case RKEY_Rewind:     //Zeichen links löschen
          {
            OSDMenuKeyboard_DeleteLeft();
            break;
          }

          case RKEY_Recall:     //Original wiederherstellen
          {
            memset(OSDMenuKeyboard_StringVar, 0, OSDMenuKeyboard_StringMaxLen + 4);
            strncpy(OSDMenuKeyboard_StringVar, OSDMenuKeyboard_StringVarOrig, OSDMenuKeyboard_StringMaxLen);
            StrMkUTF8(OSDMenuKeyboard_StringVar, 9);
            OSDMenuKeyboard_CursorPosition = strlenUC(OSDMenuKeyboard_StringVar);
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Blue:       //Gesamten Text löschen
          {
            memset(OSDMenuKeyboard_StringVar, 0, OSDMenuKeyboard_StringMaxLen + 4);
            OSDMenuKeyboard_CursorPosition = 0;
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Yellow:     //Add *text*
          {
            if((strlen(OSDMenuKeyboard_StringVar) < OSDMenuKeyboard_StringMaxLen) && (OSDMenuKeyboard_StringVar[0] != '*')) InsertAt(OSDMenuKeyboard_StringVar, 0, "*");
            if((strlen(OSDMenuKeyboard_StringVar) < OSDMenuKeyboard_StringMaxLen) && (OSDMenuKeyboard_StringVar[strlen(OSDMenuKeyboard_StringVar) - 1] != '*')) strcat(OSDMenuKeyboard_StringVar, "*");
            OSDMenuKeyboard_Draw();
            break;
          }

          case RKEY_Exit:       //Speichern und beenden
          {
            OSDMenuKeyboard_SaveAndFinish();

            TRACEEXIT();
            return TRUE;
          }
        }
        *param1 = 0;
        break;
      }

      case EVT_TMSREMOTEASCII:
      {
        switch(*param1)
        {
          case 0x08:    //BS
          {
            OSDMenuKeyboard_DeleteLeft();
            break;
          }

          case 0x0D:    //CR
          {
            OSDMenuKeyboard_SaveAndFinish();

            TRACEEXIT();
            return TRUE;
          }

          case 0x1B:    //ESC
          {
            OSDMenuKeyboard_SaveAndFinish();

            TRACEEXIT();
            return TRUE;
          }

          case 0x7f:    //Del
          {
            OSDMenuKeyboard_DeleteRight();
            break;
          }

          case 0x0124:  //Pos1
          {
            OSDMenuKeyboard_CursorPosition = 0;
            OSDMenuKeyboard_Draw();
            break;
          }

          case 0x0123:  //End
          {
            OSDMenuKeyboard_CursorPosition = strlen(OSDMenuKeyboard_StringVar);
            OSDMenuKeyboard_Draw();
            break;
          }

          case 0x0125:  //Left
          {
            OSDMenuKeyboard_CursorLeft();
            break;
          }

          case 0x0127:  //Right
          {
            OSDMenuKeyboard_CursorRight();
            break;
          }

          case 0x0170:   //F1 = RED
          {
            OSDMenuKeyboard_Finish();

            TRACEEXIT();
            return TRUE;
          }

          case 0x0171:   //F2 = GREEN
          {
            OSDMenuKeyboard_SaveAndFinish();

            TRACEEXIT();
            return TRUE;
          }

          case 0x0173:   //F4 = BLUE
          {
            memset(OSDMenuKeyboard_StringVar, 0, OSDMenuKeyboard_StringMaxLen + 4);
            OSDMenuKeyboard_CursorPosition = 0;
            OSDMenuKeyboard_Draw();
            break;
          }

          default:
          {
            //ASCII Codes
            if((*param1 < 0x100) && (((*param1 >= 0x20) && (*param1 < 0x7f)) || (*param1 >= 0xa0)))
            {
              if(strlen(OSDMenuKeyboard_StringVar) < OSDMenuKeyboard_StringMaxLen)
              {
                char          ToBeInserted[8];

                ToBeInserted[0] = *param1;
                ToBeInserted[1] = '\0';
                ToBeInserted[2] = '\0';
                ToBeInserted[3] = '\0';
                ToBeInserted[4] = '\0';
                StrMkUTF8(ToBeInserted, 9);
                InsertAt(OSDMenuKeyboard_StringVar, OSDMenuKeyboard_CursorPosition, ToBeInserted);
                OSDMenuKeyboard_CursorPosition++;
                OSDMenuKeyboard_Draw();
              }
            }
          }
        }
        break;
      }
    }
  }

  TRACEEXIT();
  return FALSE;
}
Example #14
0
void PyView::insertAt(int i, PyObject* o) {
  c4_Row temp;
  makeRow(temp, o);
  InsertAt(i, temp);
}
Example #15
0
bool HexDoc::InsertAt(uint64 nIndex, uint8 src, THSIZE nCount /*= 1*/)
{
    return InsertAt(nIndex, &src, 1, nCount);
}
Example #16
0
static int Insert(ElementType *SC,CHAR_TYPE *newval)
{
    return InsertAt(SC,0,newval);
}