Example #1
0
// Save the edit cursor position
void EditCursorSlice()
{
	// Initialize new proj
	if (g_editCursorStack.Get()->GetSize() == 0)
	{
		g_editCursorStack.Get()->Resize(SWS_EDITCURSOR_STACK_SIZE);
		for (int i = 1; i < SWS_EDITCURSOR_STACK_SIZE; i++)
			g_editCursorStack.Get()->Get()[i] = -DBL_MAX;
		*g_editCursorStackPos.Get() = 0;
		*g_editCursorStack.Get()->Get() = GetCursorPosition();
	}

	double dPos = GetCursorPosition();
	if (dPos != g_editCursorStack.Get()->Get()[*g_editCursorStackPos.Get()])
	{
		(*g_editCursorStackPos.Get())++;
		if (*g_editCursorStackPos.Get() >= SWS_EDITCURSOR_STACK_SIZE)
			*g_editCursorStackPos.Get() = 0;

		int iNext = *g_editCursorStackPos.Get();

		while(g_editCursorStack.Get()->Get()[iNext] != -DBL_MAX)
		{
			g_editCursorStack.Get()->Get()[iNext] = -DBL_MAX;
			iNext++;
			if (iNext >= SWS_EDITCURSOR_STACK_SIZE)
				iNext = 0;
		}
		g_editCursorStack.Get()->Get()[*g_editCursorStackPos.Get()] = dPos;
	}
}
Example #2
0
static void SelectAllNearestEditCursor(int flag, void *data)
{
    double editCursor = GetCursorPosition();
    RprMidiTakePtr midiTake = RprMidiTake::createFromMidiEditor();

    if (midiTake->countNotes() == 0)
        return;

    int closest = midiTake->getNoteAt(0)->getItemPosition();
    double closestDifference = std::fabs(editCursor - midiTake->getNoteAt(0)->getPosition());
    for(int i = 1; i < midiTake->countNotes(); i++) {
        RprMidiNote *note = midiTake->getNoteAt(i);
        double difference = std::fabs(editCursor - note->getPosition());
        if (difference < closestDifference) {
            closest = note->getItemPosition();
            closestDifference = difference;
        }
    }

    for(int i = 0; i < midiTake->countNotes(); i++) {
        RprMidiNote *note = midiTake->getNoteAt(i);
        if (note->getItemPosition() == closest) {
            note->setSelected(true);
        } else {
            note->setSelected(false);
        }
    }
}
bool PlayerUIDialog::GetFirstAttackableEntityUnderCursor(RPG_DamageableEntity*& attackableEntity, hkvVec3& fallbackTargetPoint, RPG_BaseEntity const *const characterEntity)
{
  IVGUIContext *const context = GetContext();
  VASSERT(context);
  hkvVec2 const mousePos = GetCursorPosition(context);

  hkvVec3 traceDirOut;
  VisRenderContext_cl::GetCurrentContext()->GetTraceDirFromScreenPos(mousePos.x, mousePos.y, traceDirOut, 1.0f);
  hkvVec3 const& camPos = VisRenderContext_cl::GetCurrentContext()->GetCamera()->GetPosition();

  RPG_ClosestAttackableRaycastResult result(characterEntity);
  result.Reset();
  result.vRayStart = camPos;
  result.vRayEnd = camPos + traceDirOut * 5000.0f;

  Vision::GetApplication()->GetPhysicsModule()->PerformRaycast(&result);

  if(result.m_hit)
  {
    if(result.m_foundAttackable)
    {
      attackableEntity = static_cast<RPG_DamageableEntity*>(result.m_closestAttackableHit.pHitObject);
      fallbackTargetPoint = attackableEntity->GetPosition();
    }
    else
    {
      attackableEntity = NULL;
      fallbackTargetPoint = result.m_closestHit.vImpactPoint;
    }

    return true;
  }
  return false;
}
Example #4
0
void SelPrevRegion(COMMAND_T*)
{
	double dCurPos, d2;
	GetSet_LoopTimeRange(false, true, &dCurPos, &d2, false);
	if (dCurPos == d2)
		dCurPos = GetCursorPosition();

	int x = 0;
	bool bReg;
	double d1, dRegStart, dRegEnd;
	bool bFound = false;
	bool bRegions = false;
	while ((x = EnumProjectMarkers(x, &bReg, &d1, &d2, NULL, NULL)))
	{
		if (bReg)
		{
			bRegions = true;
			if (dCurPos > d1)
			{
				dRegStart = d1;
				dRegEnd = d2;
				bFound = true;
			}
		}
	}
	if (bFound)
		GetSet_LoopTimeRange(true, true, &dRegStart, &dRegEnd, false);
	else if (bRegions)
		GetSet_LoopTimeRange(true, true, &d1, &d2, false);
}
Example #5
0
void SelNextRegion(COMMAND_T*)
{
	double dCurPos, d2;
	GetSet_LoopTimeRange(false, true, &dCurPos, &d2, false);
	if (dCurPos == d2)
		dCurPos = GetCursorPosition();

	int x = 0;
	bool bReg;
	double dRegStart;
	double dRegEnd;
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		if (bReg && dRegStart > dCurPos)
		{
			GetSet_LoopTimeRange(true, true, &dRegStart, &dRegEnd, false);
			return;
		}
	}
	// Nothing found, loop again and set to first region
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		if (bReg)
		{
			GetSet_LoopTimeRange(true, true, &dRegStart, &dRegEnd, false);
			return;
		}
	}
}
Example #6
0
void MarkerActionTimer()
{
	static double dLastPos = 0.0;
	static double dUsualPosDelta = 0.050;
	if (g_bMAEnabled && GetPlayState() & 1)
	{
		double dPlayPos = GetPlayPosition();
		double dDelta = dPlayPos - dLastPos;
		// Ignore markers when the play state seems to have jumped forward or backwards
		if (dDelta > 0.0 && dDelta < dUsualPosDelta * 5.0)
		{
			// Quick and dirty IIR
			dUsualPosDelta = dUsualPosDelta * 0.99 + dDelta * 0.01;
			int x = 0;
			const char* cName;
			double dMarkerPos;
			// Look for markers with '!' as the first char with the right time
			while ((x = EnumProjectMarkers(x, NULL, &dMarkerPos, NULL, &cName, NULL)))
				if (dMarkerPos >= dLastPos && dMarkerPos < dPlayPos)
					RunActionMarker(cName);
		}
		dLastPos = dPlayPos;
	}
	else
		dLastPos = GetCursorPosition();
}
Example #7
0
void MoveCursorAndSel(COMMAND_T* ct)
{
	double dStart, dEnd, dPos = GetCursorPosition();
	int iEdge; // -1 for left, 1 for right
	GetSet_LoopTimeRange(false, false, &dStart, &dEnd, false);
	if (dStart == dEnd)
	{
		iEdge = (int)ct->user;
		dStart = dEnd = dPos;
	}
	else if (dPos <= dStart)
		iEdge = -1;
	else if (dPos >= dEnd)
		iEdge = 1;
	else if (dPos - dStart < dEnd - dPos)
		iEdge = -1;
	else
		iEdge = 1;

	// Set edit cursor
	dPos = ((int)ct->user == -1) ? GetPrevGridDiv(dPos) : GetNextGridDiv(dPos);
	SetEditCurPos(dPos, true, false);

	// Extend the time sel
	if (iEdge == -1)
		dStart = dPos;
	else
		dEnd = dPos;
	GetSet_LoopTimeRange(true, false, &dStart, &dEnd, false);

}
Example #8
0
void ShowMainMain (int *Choice) {
  int  InputLegth = 1;
  int  ItemCount = 6;
  int  ExitItem = 5;
  int  Top = 0;
  int  Left = 0;
  
  char *Item[6] = {"更新漫畫檔    --  Update",
                   "瀏覽漫畫      --  Browser",
                   "下載漫畫      --  Download",
                   "清除暫存檔案  --  Clear",
                   "下載資料夾    --  Download Folder",
                   "離開本程式    --  Exit"
                      };
                      
  Print (" %=NY Main Menu %=Nw\n");
  Print ("====================================================\n");
  
  GetCursorPosition (&Left, &Top);
  
  
  for (int  Index = 0; Index < ItemCount; Index++) {
    Print ("    %=NW %d%=Nw . %s\n", Index, Item[Index]);
  }
  Print ("%=NW ---------------------------------------------------- %=Nw\n");
  Print (" %=NR Please Press ←↑→↓ Choice! %=Nw\n");
  Print ("====================================================\n");
  
  MenuCursor ( 2, Top, ">", ItemCount, Choice);
  system ("CLS");
}
void OverlayControl::MouseDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	if (!ActiveOverlay)
		return;

	//	Left or right button clicked -- select the element under cursor.
	RECT clipRect, clientRect;
	GetWindowRect(hwnd, &clipRect);
	GetClientRect(hwnd, &clientRect);

	//	Save original mouse position.
	GetCursorPosition(hwnd, &clickAnchor);

	//	Element could be activated only if no element active AND user doesn't click 
	//	within the active element.
	if (!ActiveOverlay->ActiveElement || 
		!ActiveOverlay->HitTestElement(ActiveOverlay->ActiveElement, &clientRect, &clickAnchor, &hitTestAnchor))
	{
		//	Find overlay element under cursor.
		OverlayElement *element = ActiveOverlay->FindElementFromPoint(&clientRect, &clickAnchor, &hitTestAnchor);
		ActivateElement(hwnd, element);
	}

	if (!ActiveOverlay->ActiveElement)
	{
		ResetCursor();
	}

	if (0 != (wParam & MK_LBUTTON))
	{
		if (ActiveOverlay->ActiveElement)
		{
			ActiveOverlay->ActiveElement->GetRect(&clientRect, &elementRectAnchor);

			//	Show that we're about to drag the object.
			UpdateCursor(hitTestAnchor);

			//	Capture the mouse.
			SetCapture(hwnd);
			ClipCursor(&clipRect);
		}

		return;
	}

	if (0 != (wParam & MK_RBUTTON))
	{
		//	Show popup menu.
		POINT pt;
		GetCursorPos(&pt);

		__raise RightMouseButtonClicked(ActiveOverlay->ActiveElement, &pt);

		return;
	}
}
bool PlayerUIDialog::GetClosestPointOnNavMeshUnderCursor(hkVector4& point, hkVector4 const& searchPoint)
{
  IVGUIContext *const context = GetContext();
  VASSERT(context);
  hkvVec2 const mousePos = GetCursorPosition(context);

  hkvVec3 traceDirOut;
  VisRenderContext_cl::GetCurrentContext()->GetTraceDirFromScreenPos(mousePos.x, mousePos.y, traceDirOut, 1.0f);
  hkvVec3 const& camPos = VisRenderContext_cl::GetCurrentContext()->GetCamera()->GetPosition();

  hkVector4 rayStartHavok, rayEndHavok;
  RPG_VisionHavokConversion::VisionToHavokPoint(camPos, rayStartHavok);
  RPG_VisionHavokConversion::VisionToHavokPoint(camPos + traceDirOut * 5000.0f, rayEndHavok);

  hkaiNavMeshQueryMediator::HitDetails hit;
  if(vHavokAiModule::GetInstance()->GetAiWorld()->getDynamicQueryMediator()->castRay(rayStartHavok, rayEndHavok, hit))
  {
    point.setInterpolate(rayStartHavok, rayEndHavok, hit.m_hitFraction);
    return true;
  }
  else
  {
    // If the ray missed the nav mesh:
    // 1. Find the nav mesh face closest to the search point
    // 2. Intersect the ray with the plane of this face
    // 3. Find the closest point on the nav mesh to the plane point
    hkVector4 dummyPoint;
    hkaiPackedKey const searchFaceKey = 
      vHavokAiModule::GetInstance()->GetAiWorld()->getDynamicQueryMediator()->getClosestPoint(searchPoint, 1.f, dummyPoint);
    if(searchFaceKey != HKAI_INVALID_PACKED_KEY)
    {
      hkVector4 facePlane;
      hkaiNavMeshInstance const *meshInstance = vHavokAiModule::GetInstance()->GetAiWorld()->getStreamingCollection()->getInstanceAt(hkaiGetRuntimeIdFromPacked(searchFaceKey));
      {
        hkaiNavMeshUtils::calcFacePlane(*meshInstance, hkaiGetIndexFromPacked(searchFaceKey), facePlane);
      }

      hkSimdReal const f = facePlane.dot4xyz1(rayStartHavok);
      hkSimdReal const t = facePlane.dot4xyz1(rayEndHavok);
      if(f.isGreaterEqualZero() && t.isLessZero())
      {
        hkVector4 planePoint;
        {
          hkSimdReal const hitFraction = f / (f - t);
          planePoint.setInterpolate(rayStartHavok, rayEndHavok, hitFraction);
        }

        hkaiPackedKey faceKey = vHavokAiModule::GetInstance()->GetAiWorld()->getDynamicQueryMediator()->getClosestPoint(planePoint, 5.f, point);
        return (faceKey != HKAI_INVALID_PACKED_KEY);
      }
    }
  }

  return false;
}
	void FServerConsole::Serialize( const TCHAR* sData, ELogVerbosity::Type eVerbosity, const class FName& sCategory, const double fTime )
	{
		FScopeLock hLock( &m_hLock );

		#if PLATFORM_WINDOWS
			COORD hCursorPosition = GetCursorPosition();
		#endif

		ClearInputLine();

		m_pConsole->Serialize( sData, eVerbosity, sCategory, fTime );

		RedrawInputLine();

		#if PLATFORM_WINDOWS
			hCursorPosition.Y = GetCursorPosition().Y;

			SetCursorPosition( hCursorPosition );
		#endif
	}
Example #12
0
bool AreThereItemsUnderCursor(bool bSel)
{
	double dCursor = GetCursorPosition();
	for (int i = 0; i < (bSel ? CountSelectedMediaItems(0) : CountMediaItems(0)); i++)
	{
		MediaItem* item = bSel ? GetSelectedMediaItem(0, i) : GetMediaItem(0, i);
		double dItemStart = *(double*)GetSetMediaItemInfo(item, "D_POSITION", NULL);
		double dItemEnd   = *(double*)GetSetMediaItemInfo(item, "D_LENGTH", NULL) + dItemStart;
		if (dItemStart < dCursor && dItemEnd > dCursor)
				return true;
	}
	return false;
}
Example #13
0
void MarkerActionRunUnderCursor(COMMAND_T*)
{
	if (!g_bMAEnabled)
		return;

	int x = 0;
	const char* cName;
	double dMarkerPos;
	double dCurPos = GetCursorPosition();
	// Look for markers with '!' as the first char with the right time
	while ((x = EnumProjectMarkers(x, NULL, &dMarkerPos, NULL, &cName, NULL)))
		if (dMarkerPos == dCurPos)
			RunActionMarker(cName);
}
Example #14
0
    void StyledTextBox::OnKeyChar(wxKeyEvent& keyEvent) {
        // Process visible character input

        if (!keyEvent.HasModifiers()) {
            int keycode = keyEvent.GetRawKeyCode();

            if (keycode < 255 && isprint(keycode)) {
                if (HasSelectedText()) {
                    RemoveSelectedText();
                }

                char c = (wxChar)keycode;
                auto text = GetStdText();

                auto insertPosition = begin(text) + GetCursorPosition();

                text.insert(insertPosition, c);

                SetText(text);

                SetCursorPosition(GetCursorPosition() + 1);
            }
        }
    }
Example #15
0
// Goto the end of the project, *including* perhaps marker ends
void GotoEndInclMarkers(COMMAND_T*)
{
	Main_OnCommand(40043, 0);
	int x = 0;
	double dRegStart, dRegEnd;
	bool bReg;
	double dMarkerEnd = -DBL_MAX;
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		if (bReg && dRegEnd > dMarkerEnd)
			dMarkerEnd = dRegEnd;
		else if (!bReg && dRegStart > dMarkerEnd)
			dMarkerEnd = dRegStart;
	}
	if (dMarkerEnd > GetCursorPosition())
		SetEditCurPos(dMarkerEnd, true, true);
}
Example #16
0
// ct->user: -1 left, 1 right
void MoveCursorSample(COMMAND_T* ct)
{
	double dPos = GetCursorPosition();
	int* pSrate = (int*)GetConfigVar("projsrate");
	if (!pSrate)
		return;
	double dSrate = (double)*pSrate;
	INT64 iCurSample = (INT64)(dPos * dSrate + 0.5);
	if (ct->user == -1 && (dPos == (double)(iCurSample / dSrate)))
		iCurSample--;
	else if (ct->user == 1)
		iCurSample++;

	double dNewPos = (double)(iCurSample / dSrate);

	SetEditCurPos(dNewPos, true, false);
}
Example #17
0
void SelNextMarkerOrRegion(COMMAND_T*)
{
	double dCurPos = GetCursorPosition();
	double dCurStart, dCurEnd, dRegStart, dRegEnd;
	GetSet_LoopTimeRange(false, false, &dCurStart, &dCurEnd, false);
	int x = 0;
	bool bReg;
	while ((x = EnumProjectMarkers(x, &bReg, &dRegStart, &dRegEnd, NULL, NULL)))
	{
		bool bSelMatches = dCurStart == dRegStart && dCurEnd == dRegEnd;
		if (dRegStart > dCurPos || (bReg && dRegStart >= dCurPos && !bSelMatches))
		{
			GetSet_LoopTimeRange(true, false, &dRegStart, bReg ? &dRegEnd : &dRegStart, false);
			SetEditCurPos(dRegStart, true, true);
			return;
		}
	}
	// Currently no wraparound, if needed add "go to first" here.
}
Example #18
0
	//[13] 현재 블록 클리어
	void ClearBlock(int rotation, int move1, int move2)
	{
		int x, y;

		COORD cursor = GetCursorPosition();

		if (CanPositionedAt(rotation, move1, move2) == true)
		{
			for (y = 0; y < 4; y++)
			{
				for (x = 0; x < 4; x++)
				{
					SetCursorPosition(cursor.X + (x * 2), cursor.Y + y);
					if (blocks[rotation][y][x] == 1)
						printf(" ");
				}
			}
			SetCursorPosition(cursor.X + move1, cursor.Y + move2);
		}
	}
Example #19
0
void SelPrevMarkerOrRegion(COMMAND_T*)
{
	// Save the current marker list so we can traverse the list bacwards
	MarkerList ml(NULL, true);

	double dCurPos = GetCursorPosition();
	double dCurStart, dCurEnd;
	GetSet_LoopTimeRange(false, false, &dCurStart, &dCurEnd, false);
	bool bCurSel = dCurStart != dCurEnd;
	for (int i = ml.m_items.GetSize()-1; i >= 0; i--)
	{
		MarkerItem* mi = ml.m_items.Get(i);
		if (mi->GetPos() < dCurPos || (!mi->IsRegion() && mi->GetPos() <= dCurPos && bCurSel))
		{
			double dNewStart = mi->GetPos(), dNewEnd = mi->GetRegEnd();
			GetSet_LoopTimeRange(true, false, &dNewStart, mi->IsRegion() ? &dNewEnd : &dNewStart, false);
			SetEditCurPos(mi->GetPos(), true, true);
			return;
		}
	}
}
Example #20
0
void Fonts::DrawCurser(OpenGLRenderer* renderer,float deltaTime)
{
	static float totalTime = 0;
	//Vector3 pos = CalcTextWidth(s_text);
	Vector3 pos = GetCursorPosition(s_text);
	//Vector3 pos = Vector3(100.0f,100.0f,10.0f);
	//Vector3 pos = m_curserPos;
	renderer->PushMatrix();
	renderer->SetOrthographicView();
	glDisable(GL_TEXTURE_2D);
	glBegin(GL_LINES);
	{
	
		glColor4f(1.0f,0.0f,0.0f,sin(totalTime*5));
		glVertex3f(pos.x, pos.y, 0.0f);
		glVertex3f(pos.x, pos.y-m_scale, 0.0f);
	
	}
	glEnd();
	glPopMatrix();
	totalTime += deltaTime;
}
Example #21
0
void MarkerNudge(bool bRight)
{
	// Find the marker underneath the edit cursor
	int x = 0;
	int iIndex, iColor;
	double dPos, dEnd;
	bool bReg;
	double dCurPos = GetCursorPosition();
	while (x = EnumProjectMarkers3(NULL, x, &bReg, &dPos, &dEnd, NULL, &iIndex, &iColor))
	{
		if (dPos == dCurPos)
		{
			dCurPos += (bRight ? 1.0 : -1.0) / GetHZoomLevel();
			if (dCurPos >= 0)
			{
				SetProjectMarkerByIndex(NULL, x-1, bReg, dCurPos, dEnd, iIndex, NULL, iColor);
				SetEditCurPos(dCurPos, true, false);
				return;
			}
		}
	}
}
Example #22
0
void MoveCursorAndSel(COMMAND_T* ct)
{
	double dStart, dEnd, dPos = GetCursorPosition();
	int iEdge; // -1 for left, 1 for right
	GetSet_LoopTimeRange(false, false, &dStart, &dEnd, false);
	if (dStart == dEnd)
	{
		iEdge = (int)ct->user;
		dStart = dEnd = dPos;
	}
	else if (dPos <= dStart)
		iEdge = -1;
	else if (dPos >= dEnd)
		iEdge = 1;
	else if (dPos - dStart < dEnd - dPos)
		iEdge = -1;
	else
		iEdge = 1;

	// Move the edit cursor position
	double dQN = TimeMap2_timeToQN(NULL, dPos);
	// Special case for left move and on grid already
	int iQN = (int)(dQN + SWS_ADJACENT_ITEM_THRESHOLD);
	if (ct->user == -1 && fabs(dQN - iQN) < SWS_ADJACENT_ITEM_THRESHOLD)
		--iQN;
	else if (ct->user == 1)
		++iQN;
	dPos = TimeMap2_QNToTime(NULL, (double)iQN);

	// Extend the time sel
	if (iEdge == -1)
		dStart = dPos;
	else
		dEnd = dPos;
	GetSet_LoopTimeRange(true, false, &dStart, &dEnd, false);

	// Set the play cursor
	SetEditCurPos(dPos, true, false);
}
Example #23
0
	//[7] 사용 가능 위치 체크
	// 특정 위치에 블록이 들어갈 수 있는지 아닌지를 체크
	// 들어갈 수 있으면 true, 없으면 false 반환
	bool CanPositionedAt(int rotation, int move1, int move2)
	{
		int x, y;
		int arrX, arrY; // 배열좌표저장
		COORD pos = GetCursorPosition();

		arrX = pos.X + move1;
		arrY = pos.Y + move2;

		arrX = (arrX / 2) - 2;
		arrY = arrY - BOARD_Y;

		for (y = 0; y < 4; y++)
		{
			for (x = 0; x < 4; x++)
			{
				if ((blocks[rotation][y][x] == 1) && board[arrY + y][arrX + x] == 1)
					return false;//겹침 
			}
		}
		return true;  //겹치지 않음
	}
Example #24
0
	//[8] 현재 위치에 블록 출력
	void WriteBlock(int rotation)
	{
		int i, j;
		COORD cursor = GetCursorPosition();

		if (CanPositionedAt(rotation, 0, 0) == true)
		{
			//콘솔창위치 설정, 배열값에서 1은 ■출력, 0은 출력없음
			for (i = 0; i < 4; i++)        // 행 반복
			{
				for (j = 0; j < 4; j++)    // 열 반복
				{
					SetCursorPosition(cursor.X + (j * 2), cursor.Y + i);
					if (blocks[rotation][i][j] == 1)
					{
						printf("■");
					}
				}
			}
			SetCursorPosition(cursor.X, cursor.Y);
		}
	}
Example #25
0
void CUICursor::OnRender	()
{
	if( !IsVisible() ) return;
#ifdef DEBUG
	VERIFY(last_render_frame != Device.dwFrame);
	last_render_frame = Device.dwFrame;

	if(bDebug)
	{
	CGameFont* F		= UI()->Font()->pFontDI;
	F->SetAligment		(CGameFont::alCenter);
	F->SetHeightI		(0.02f);
	F->OutSetI			(0.f,-0.9f);
	F->SetColor			(0xffffffff);
	Fvector2			pt = GetCursorPosition();
	F->OutNext			("%f-%f",pt.x, pt.y);
	}
#endif

	m_static->SetWndPos	(vPos);
	m_static->Update	();
	m_static->Draw		();
}
Example #26
0
void AddToEnvPoints::doCommand(int flag)
{
    BR_Envelope envelope(GetSelectedEnvelope(NULL));
    if (!envelope.CountSelected())
        return;
    double cursorPos = GetCursorPosition();

    if( m_pp == POINTTIME)
	{
		double beat = (240.0 / TimeMap2_GetDividedBpmAtTime(0, cursorPos));
		double amount = beat * m_dAmount;

		for (int i = 0; i < envelope.CountSelected(); ++i)
		{
			int id = envelope.GetSelected(i);
			double position;
			envelope.GetPoint(id, &position, NULL, NULL, NULL);
			position += amount;
			envelope.SetPoint(id, &position, NULL, NULL, NULL);
		}
	}
	else
	{
		double amount = (envelope.LaneMaxValue() - envelope.LaneMinValue()) / 100 * m_dAmount;

		for (int i = 0; i < envelope.CountSelected(); ++i)
		{
			int id = envelope.GetSelected(i);
			double value;
			envelope.GetPoint(id, NULL, &value, NULL, NULL);
			value += amount;
			SetToBounds(value, envelope.LaneMinValue(), envelope.LaneMaxValue());
			envelope.SetPoint(id, NULL, &value, NULL, NULL);
		}
	}
	envelope.Commit();
}
Example #27
0
void
stubSwapBuffers( const WindowInfo *window, GLint flags )
{
	if (!window)
		return;

	/* Determine if this window is being rendered natively or through
	 * Chromium.
	 */

	if (window->type == NATIVE) {
		/*printf("*** Swapping native window %d\n", (int) drawable);*/
#ifdef WINDOWS
		(void) stub.wsInterface.wglSwapBuffers( window->drawable );
#elif defined(Darwin)
		/* ...is this ok? */
/*		stub.wsInterface.CGLFlushDrawable( context->cglc ); */
		crDebug("stubSwapBuffers: unable to swap (no context!)");
#elif defined(GLX)
		stub.wsInterface.glXSwapBuffers( window->dpy, window->drawable );
#endif
	}
	else if (window->type == CHROMIUM) {
		/* Let the SPU do the buffer swap */
		/*printf("*** Swapping chromium window %d\n", (int) drawable);*/
		if (stub.appDrawCursor) {
			int pos[2];
			GetCursorPosition(window, pos);
			stub.spu->dispatch_table.ChromiumParametervCR(GL_CURSOR_POSITION_CR, GL_INT, 2, pos);
		}
		stub.spu->dispatch_table.SwapBuffers( window->spuWindow, flags );
	}
	else {
		crDebug("Calling SwapBuffers on a window we haven't seen before (no-op).");
	}
}
Example #28
0
	//[9] 블록 보드판에서 1인식
	void BoardInit(int n, int move1, int move2)
	{
		COORD pos = GetCursorPosition();

		int arrX = pos.X + move1;  //콘솔좌표 열 
		int arrY = pos.Y + move2;  //콘솔좌표 행
		int x, y;

		/*커서위치정보->배열위치정보 변경*/
		arrX = arrX / 2 - 2; //콘솔좌표->배열 열 변환값
		arrY = arrY - 2;     //콘솔좌표->배열 행 변환값

		//보드판에서 블록 이동시 1인식
		for (y = 0; y < 4; y++)
		{
			for (x = 0; x < 4; x++)
			{
				if (blocks[n][y][x] == 1)
				{
					board[arrY + y][arrX + x] = 1;
				}
			}
		}
	}
Example #29
0
void MoveCursorFade(COMMAND_T* ct)
{
	double dPos = GetCursorPosition();
	dPos += fabs(*(double*)GetConfigVar("deffadelen")) * (double)ct->user; // Abs because neg value means "not auto"
	SetEditCurPos(dPos, true, false);
}
void OverlayControl::MouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	if (!ActiveOverlay || !ActiveOverlay->ActiveElement)
	{
		ResetCursor();
		return;
	}

	RECT clientRect;
	GetClientRect(hwnd, &clientRect);

	POINT pt;
	GetCursorPosition(hwnd, &pt);

	if (0 != (wParam & MK_LBUTTON))
	{
		RECT elementRect;
		memmove(&elementRect, &elementRectAnchor, sizeof(elementRect));

		int dx = pt.x - clickAnchor.x, dy = pt.y - clickAnchor.y;

		bool updateAnchors = false;

		//	Move/drag element.
		if (0 != (hitTestAnchor & ohtLeftBorder))
		{
			if (ohtInside != hitTestAnchor && dx > 0 && RectWidth(elementRect) - dx < OverlayElement::MinimalSize)
				dx = RectWidth(elementRect) - OverlayElement::MinimalSize;
			elementRect.left += dx;
		}
		if (0 != (hitTestAnchor & ohtRightBorder))
		{
			if (ohtInside != hitTestAnchor && dx < 0 && RectWidth(elementRect) + dx < OverlayElement::MinimalSize)
				dx = OverlayElement::MinimalSize - RectWidth(elementRect);
			elementRect.right += dx;
		}
		if (0 != (hitTestAnchor & ohtTopBorder))
		{
			if (ohtInside != hitTestAnchor && dy > 0 && RectHeight(elementRect) - dy < OverlayElement::MinimalSize)
				dy = RectHeight(elementRect) - OverlayElement::MinimalSize;
			elementRect.top += dy;
		}
		if (0 != (hitTestAnchor & ohtBottomBorder))
		{
			if (ohtInside != hitTestAnchor && dy < 0 && RectHeight(elementRect) + dy < OverlayElement::MinimalSize)
				dy = OverlayElement::MinimalSize - RectHeight(elementRect);
			elementRect.bottom += dy;
		}

		//	Check for sanity.
		if (elementRect.left < clientRect.left)
		{
			updateAnchors = true;
			OffsetRect(&elementRect, clientRect.left - elementRect.left, 0);
		}
		if (elementRect.right > clientRect.right)
		{
			updateAnchors = true;
			OffsetRect(&elementRect, clientRect.right - elementRect.right, 0);
		}
		if (elementRect.top < clientRect.top)
		{
			updateAnchors = true;
			OffsetRect(&elementRect, 0, clientRect.top - elementRect.top);
		}
		if (elementRect.bottom > clientRect.bottom)
		{
			updateAnchors = true;
			OffsetRect(&elementRect, 0, clientRect.bottom - elementRect.bottom);
		}

		if (updateAnchors)
		{
			memmove(&clickAnchor, &pt, sizeof(clickAnchor));
			memmove(&elementRectAnchor, &elementRect, sizeof(elementRectAnchor));
		}

		//	Update element coordinates.
		ActiveOverlay->ActiveElement->SetRect(&clientRect, &elementRect);

		//	Drag object under cursor.
		RepaintAll(hwnd);
	}
	else
	{
		//	No mouse keys pressed -- change cursor accordingly to what's 
		//	visible on the screen.
		OverlayHitTest hitTest = ohtNone;
		OverlayElement *element = ActiveOverlay->ActiveElement;

		if (ActiveOverlay->ActiveElement && 
			!ActiveOverlay->HitTestElement(ActiveOverlay->ActiveElement, &clientRect, &pt, &hitTest))
		{
			element = ActiveOverlay->FindElementFromPoint(&clientRect, &pt, &hitTest);
		}

		if (0 != element && element == ActiveOverlay->ActiveElement && ohtInside != hitTest)
			UpdateCursor(hitTest);
		else
			ResetCursor();
	}
}