FReply SMultiLineEditableText::MoveCursor( ECursorMoveMethod::Type Method, int8 Direction, ECursorAction::Type Action ) { FTextLocation NewCursorPosition; if (Method == ECursorMoveMethod::CharacterHorizontal) { NewCursorPosition = TranslatedLocation(CursorPosition, Direction); PreferredCursorOffsetInLine = AbsoluteToWrapped(NewCursorPosition).GetOffset(); } else if (Method == ECursorMoveMethod::Word) { NewCursorPosition = ScanForWordBoundary( CursorPosition, Direction ); PreferredCursorOffsetInLine = AbsoluteToWrapped(NewCursorPosition).GetOffset(); } else { ensure( Method == ECursorMoveMethod::CharacterVertical ); NewCursorPosition = TranslateLocationVertical(CursorPosition, Direction); } if (Action == ECursorAction::SelectText) { // We are selecting text. Just remember where the selection started. // The cursor is implicitly the other endpoint. if (!SelectionStart.IsSet()) { this->SelectionStart = CursorPosition; } } else { // No longer selection text; clear the selection! this->ClearSelection(); } if( WrappedText.Num() > 0 ) { const int32 NewWrappedCursorPosition = AbsoluteToWrapped( NewCursorPosition ).GetLineIndex(); const float LineHeight = WrappedText[NewCursorPosition.GetLineIndex()].Size.Y; const float NumLinesOnScreen = CachedLastFrameGeometry.Size.Y / LineHeight; const float FractionOfTotalLinesOnScreen = FMath::Clamp(NumLinesOnScreen / WrappedText.Num(), 0.0f, 1.0f); if ( NewWrappedCursorPosition < NumLinesScrollOffset ) { NumLinesScrollOffset = NewWrappedCursorPosition; UpdateScrollbar( CachedLastFrameGeometry ); } else if ( FMath::Floor(NumLinesScrollOffset + NumLinesOnScreen - 1) < NewWrappedCursorPosition ) { NumLinesScrollOffset = FMath::Clamp( FMath::Floor(NewWrappedCursorPosition - NumLinesOnScreen + 1 ), 0, WrappedText.Num()); UpdateScrollbar( CachedLastFrameGeometry ); } } CursorPosition = NewCursorPosition; LastCursorInteractionTime = FSlateApplication::Get().GetCurrentTime(); return FReply::Handled(); }
void DrawTable(DmOpenRef db, Int16 category) { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormMain)) return; TablePtr table = (TablePtr) GetObjectPtr(form, SMSTable); if (table == NULL) return; if (category >= 0) g_SelectedCategory = category; for (int c = 0; c < TABLE_NUM_COLUMNS; ++c) { TblSetCustomDrawProcedure(table, c, PrivDrawCell); TblSetColumnUsable(table, c, true); TblSetColumnWidth(table, c, COLUMN_WIDTHS[c]); } for (int r = 0; r < TABLE_PAGE_SIZE; ++r) { UInt32 cursor = g_CurrentPage * TABLE_PAGE_SIZE + r; if (cursor >= GetSMSCount(db, g_SelectedCategory)) { TblSetRowUsable(table, r, false); } else { TblSetRowSelectable(table, r, true); TblSetRowUsable(table, r, true); for(int c = 0; c < TABLE_NUM_COLUMNS; c++ ) TblSetItemStyle(table, r, c, customTableItem); } } TblDrawTable(table); UpdateScrollbar(db); UpdateUnread(db); UpdatePos(db); }
void DataSetValuesView::resizeEvent(QResizeEvent *event) { //keep visible rows in sync with size . . . uint64_t visibleRows = CalculateVisibleRows(); m_bufferValues->UpdateVisibleRows(m_bufferValues->GetVisibleRowStart(), visibleRows); UpdateScrollbar(); //always force tableview to rebuild emit m_tableModel->layoutChanged(); }
void SMultiLineEditableText::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) { if ( CachedLastFrameGeometry.Size != AllottedGeometry.Size ) { CachedLastFrameGeometry = AllottedGeometry; ReWrap( AllottedGeometry ); UpdateScrollbar(AllottedGeometry); } }
bool wxVScrolledWindow::ScrollToLine(size_t line) { if ( !m_lineMax ) { // we're empty, code below doesn't make sense in this case return false; } // determine the real first line to scroll to: we shouldn't scroll beyond // the end size_t lineFirstLast = FindFirstFromBottom(m_lineMax - 1, true); if ( line > lineFirstLast ) line = lineFirstLast; // anything to do? if ( line == m_lineFirst ) { // no return false; } // remember the currently shown lines for the refresh code below size_t lineFirstOld = GetVisibleBegin(), lineLastOld = GetVisibleEnd(); m_lineFirst = line; // the size of scrollbar thumb could have changed UpdateScrollbar(); // finally refresh the display -- but only redraw as few lines as possible // to avoid flicker if ( GetChildren().empty() && (GetVisibleBegin() >= lineLastOld || GetVisibleEnd() <= lineFirstOld ) ) { // the simplest case: we don't have any old lines left, just redraw // everything Refresh(); } else // overlap between the lines we showed before and should show now { // Avoid scrolling visible parts of the screen on Mac #ifdef __WXMAC__ if (!IsShownOnScreen()) Refresh(); else #endif ScrollWindow(0, GetLinesHeight(GetVisibleBegin(), lineFirstOld)); } return true; }
void DisplayNextRecord(DmOpenRef db, Int16 step) { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormDetail)) return; CalculateNextRow(db, step); DisplayCurrentRecord(db); FieldPtr fieldContent = (FieldPtr) GetObjectPtr(form, FieldContent); FldDrawField(fieldContent); UpdateScrollbar(form, FieldContent, ScrollbarContent); }
void PropertyTree::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); RecreateBackBuffer(cx, cy); UpdateScrollbar(); Invalidate(); UpdateWindow(); // inform all items that a resize has been made UpdateMoveAllItems(); }
void CIORegView::ChangeReg(int reg) { Reg = reg; IOReg _reg = IORegs[CPU][Reg]; if ((_reg.type == AllRegs) || (_reg.type == CatBegin)) numlines = 2 + _reg.size; else numlines = 3 + _reg.numBitfields; UpdateScrollbar(); SendMessage(hRegCombo, CB_SETCURSEL, Reg, 0); }
/* UpdateScrollbarBG -- * Idle handler to update the scrollbar. */ static void UpdateScrollbarBG(ClientData clientData) { ScrollHandle h = (ScrollHandle)clientData; Tcl_Interp *interp = h->corePtr->interp; int code; h->flags &= ~SCROLL_UPDATE_PENDING; Tcl_Preserve((ClientData) interp); code = UpdateScrollbar(interp, h); if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) { Tcl_BackgroundError(interp); } Tcl_Release((ClientData) interp); }
void DataSetValuesView::OnModelStructureChanged() { //sync gui to model settings . . . m_loading = true; m_valueColumns->setCurrentIndex(m_valueColumns->findData((int)m_bufferValues->GetColumns())); m_valueDataType->setCurrentIndex(m_valueDataType->findData(m_bufferValues->GetDataType())); m_valueFormat->setCurrentIndex(m_valueFormat->findData(m_bufferValues->GetFormat())); m_indexFormat->setCurrentIndex(m_valueFormat->findData(m_bufferValues->GetIndexFormat())); m_refresh->setVisible(m_bufferValues->CanRefreshData()); UpdateScrollbar(); m_loading = false; //always force tableview to rebuild emit m_tableModel->layoutChanged(); emit m_tableModel->headerDataChanged(Qt::Vertical,0,m_bufferValues->GetVisibleRowCount()-1); //also update row index/address }
void ScrollLines( Word fldindex, Word sbarindex, int numLinesToScroll, Boolean redraw ) { FormPtr frm=FrmGetActiveForm(); FieldPtr fld; fld = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, fldindex ) ); if( numLinesToScroll<0 ) FldScrollField( fld, -numLinesToScroll, up ); else FldScrollField( fld, numLinesToScroll, down ); if( (FldGetNumberOfBlankLines(fld) && numLinesToScroll<0) || redraw ) UpdateScrollbar( fldindex, sbarindex ); }
//================================================================================================= void FlowContainer::Reposition() { int sizex = (word_warp ? size.x - 20 : 10000); int y = 2; bool have_button = false; for(FlowItem* fi : items) { if(fi->type != FlowItem::Button) { if(fi->type != FlowItem::Section) { if(have_button) { fi->size = GUI.default_font->CalculateSize(fi->text, sizex - 2 - button_size.x); fi->pos = Int2(4 + button_size.x, y); } else { fi->size = GUI.default_font->CalculateSize(fi->text, sizex); fi->pos = Int2(2, y); } } else { fi->size = GUI.fBig->CalculateSize(fi->text, sizex); fi->pos = Int2(2, y); } have_button = false; y += fi->size.y; } else { fi->size = button_size; fi->pos = Int2(2, y); have_button = true; } } UpdateScrollbar(y); }
void PropertyTree::OnLButtonDblClk(UINT, CPoint point) { SendNotify(NM_DBLCLK); PropertyTreeItem* pItem; if ( (pItem = FindItem(point))!=NULL ) { if ( pItem->IsRootLevel() ) { if (pItem->GetChild() && !SendNotify(PTN_ITEMEXPANDING, pItem)) { pItem->Expand(!pItem->IsExpanded()); UpdateScrollbar(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); } return; } PropertyTreeItem* pOldFocus = GetFocusedItem(); SelectItems(NULL, FALSE); SetFocusedItem(pItem); pItem->Select(); Invalidate(); if ( !pItem->IsRootLevel() && pItem != pOldFocus ) SendNotify(PTN_SELCHANGE, pItem); } }
void wxVListBox::OnSize(wxSizeEvent& event) { UpdateScrollbar(); event.Skip(); }
void wxVScrolledWindow::OnSize(wxSizeEvent& event) { UpdateScrollbar(); event.Skip(); }
void SMultiLineEditableText::OnScrollbarScrolled( float OffsetFraction ) { NumLinesScrollOffset = FMath::Clamp(OffsetFraction * WrappedText.Num(), 0.0f, WrappedText.Num()-1.0f); UpdateScrollbar( CachedLastFrameGeometry ); }
void CEquationEditorWindow::Redraw() { RECT rctB = { 0, 0, 1800, 1800 }; ::InvalidateRect( hwnd, &rctB, TRUE ); UpdateScrollbar(); }
void CEquationEditorWindow::Show( int cmdShow ) { UpdateScrollbar(); ::ShowWindow( hwnd, cmdShow ); }
void PropertyTree::OnKeyDown(UINT nChar, UINT, UINT) { PropertyTreeItem* pItem; switch (nChar) { case VK_RETURN: if ((pItem = GetFocusedItem())!=NULL && !pItem->IsRootLevel()) { pItem->Activate(); } break; case VK_LEFT: if ((pItem = GetFocusedItem())!=NULL) { if (!SendNotify(PTN_ITEMEXPANDING, pItem)) { if (pItem->GetChild() && pItem->IsExpanded()) { pItem->Expand(FALSE); UpdateScrollbar(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); break; } } } else break; // pass thru to next case VK_UP case VK_UP: if (FocusPrev()) Invalidate(); break; case VK_RIGHT: if ((pItem = GetFocusedItem())!=NULL) { if (!SendNotify(PTN_ITEMEXPANDING, pItem)) { if (pItem->GetChild() && !pItem->IsExpanded()) { pItem->Expand(); UpdateScrollbar(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); break; } } } else break; // pass thru to next case VK_DOWN case VK_DOWN: if (FocusNext()) Invalidate(); break; } }
void PropertyTree::OnLButtonDown(UINT flags, CPoint point) { // // hide edit in place // if ( m_EditInPlace.IsVisible() ) m_EditInPlace.Cancel(); SendNotify(NM_CLICK); if (!IsWindowEnabled()) return; SetFocus(); LONG nHit = HitTest(point); PropertyTreeItem* pItem; CRect rc; switch (nHit) { case HTEXPAND: if ( flags != RTCLKITEM && (pItem = FindItem(point))!=NULL) { if (pItem->GetChild() && !SendNotify(PTN_ITEMEXPANDING, pItem)) { pItem->Expand(!pItem->IsExpanded()); UpdateScrollbar(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); } } break; default: if ((pItem = FindItem(point))!=NULL) { PropertyTreeItem* pOldFocus = GetFocusedItem(); if ( pItem->IsRootLevel() ) return; SelectItems(NULL, FALSE); SetFocusedItem(pItem); pItem->Select(); Invalidate(); if ( flags == RTCLKITEM ) m_LastBtn = RTCLKITEM; else m_LastBtn = LFCLKITEM; // don't send a sel change event for removable devices if (pItem!=pOldFocus ) SendNotify(PTN_SELCHANGE, pItem); if (nHit==HTATTRIBUTE && !pItem->IsRootLevel()) { if (!SendNotify(PTN_PROPCLICK, pItem)) pItem->Activate(); } } break; } }
static void SetupReplyForm(FormPtr frm) { FrmSetTitle(frm , "Reply"); UpdateScrollbar(frm, FieldReference, ScrollbarReference); }
void CEquationEditorWindow::Show( int nCmdShow ) { cmdShow = nCmdShow; UpdateScrollbar(); ::ShowWindow( hwnd, nCmdShow ); }
static Boolean MyMainFormHandleEvent( EventPtr event ) { Boolean handled = false; Int i; FieldPtr fld; FormPtr frm; Word readerNum; #ifdef __GCC__ CALLBACK_PROLOGUE #endif frm = FrmGetActiveForm(); switch( event->eType ) { case frmOpenEvent: UpdateScrollbar( dataFieldID, dataSbarID ); FrmDrawForm( frm ); break; case ctlSelectEvent: if( event->data.ctlSelect.controlID==updateButtonID ) { handled=true; if( readerType==SC_READER_UNKNOWN ) { FrmAlert( alert6FormID ); break; } FrmHideObject(frm, FrmGetObjectIndex(frm, updateButtonID)); i=scdir(); UpdateScrollbar( dataFieldID, dataSbarID ); if( i==1 ) FrmAlert(alert1FormID); else if( i==2 ) FrmAlert(alert2FormID); else if( i==3 ) FrmAlert(alert3FormID); else if( i==4 ) FrmAlert(alert4FormID); else if( i>4 ) FrmAlert(alert5FormID); FrmShowObject(frm, FrmGetObjectIndex(frm, updateButtonID)); } break; case menuEvent: fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, dataFieldID)); switch( event->data.menu.itemID ) { case selectMenuID: handled = true; FldSetSelection (fld, 0, FldGetTextLength (fld)); break; case copyMenuID: handled = true; FldCopy(fld); break; case readerMenuID: handled = true; switch(readerType) { case SC_READER_DUMBMOUSE: readerNum=0; break; case SC_READER_TOWITOKO: readerNum=1; break; default: readerNum=-1; break; } readerNum = ChooseReader( readerNum ); switch(readerNum) { case 0: readerType=SC_READER_DUMBMOUSE; break; case 1: readerType=SC_READER_TOWITOKO; break; default: readerType=SC_READER_UNKNOWN; break; } break; case aboutMenuID: handled = true; FrmAlert(aboutFormID); break; case helpMenuID: handled = true; FrmAlert(helpFormID); break; default: break; } case fldChangedEvent: if( event->data.fldChanged.fieldID==dataFieldID ) { UpdateScrollbar( dataFieldID, dataSbarID ); handled=true; } break; case sclRepeatEvent: if( event->data.sclRepeat.scrollBarID==dataSbarID ) { ScrollLines( dataFieldID, dataSbarID, event->data.sclRepeat.newValue - event->data.sclRepeat.value, false ); } break; case keyDownEvent: if( event->data.keyDown.chr == pageUpChr ) { PageScroll( dataFieldID, dataSbarID, up ); handled = true; } else if( event->data.keyDown.chr == pageDownChr ) { PageScroll( dataFieldID, dataSbarID, down ); handled = true; } break; default: break; } #ifdef __GCC__ CALLBACK_EPILOGUE #endif return handled; }
void WheelBase::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); /* If tweens aren't controlling the position of the wheel, set positions. */ if( !GetTweenTimeLeft() ) SetPositions(); for( int i=0; i<NUM_WHEEL_ITEMS; i++ ) { WheelItemBase *pDisplay = m_WheelBaseItems[i]; if( m_WheelState == STATE_LOCKED && i != NUM_WHEEL_ITEMS/2 ) pDisplay->m_colorLocked = WHEEL_ITEM_LOCKED_COLOR.GetValue(); else pDisplay->m_colorLocked = RageColor(0,0,0,0); } //Moved to CommonUpdateProcedure, seems to work fine //Revert if it happens to break something UpdateScrollbar(); if( m_Moving ) { m_TimeBeforeMovingBegins -= fDeltaTime; m_TimeBeforeMovingBegins = max(m_TimeBeforeMovingBegins, 0); } // update wheel state m_fTimeLeftInState -= fDeltaTime; if( m_fTimeLeftInState <= 0 ) // time to go to a new state UpdateSwitch(); if( m_WheelState == STATE_LOCKED ) { /* Do this in at most .1 sec chunks, so we don't get weird if we * stop for some reason (and so it behaves the same when being * single stepped). */ float fTime = fDeltaTime; while( fTime > 0 ) { float t = min( fTime, 0.1f ); fTime -= t; m_fPositionOffsetFromSelection = clamp( m_fPositionOffsetFromSelection, -0.3f, +0.3f ); float fSpringForce = - m_fPositionOffsetFromSelection * LOCKED_INITIAL_VELOCITY; m_fLockedWheelVelocity += fSpringForce; float fDrag = -m_fLockedWheelVelocity * t*4; m_fLockedWheelVelocity += fDrag; m_fPositionOffsetFromSelection += m_fLockedWheelVelocity*t; if( fabsf(m_fPositionOffsetFromSelection) < 0.01f && fabsf(m_fLockedWheelVelocity) < 0.01f ) { m_fPositionOffsetFromSelection = 0; m_fLockedWheelVelocity = 0; } } } if( IsMoving() ) { /* We're automatically moving. Move linearly, and don't clamp * to the selection. */ float fSpinSpeed = m_SpinSpeed*m_Moving; m_fPositionOffsetFromSelection -= fSpinSpeed*fDeltaTime; /* Make sure that we don't go further than 1 away, in case the * speed is very high or we miss a lot of frames. */ m_fPositionOffsetFromSelection = clamp(m_fPositionOffsetFromSelection, -1.0f, 1.0f); /* If it passed the selection, move again. */ if((m_Moving == -1 && m_fPositionOffsetFromSelection >= 0) || (m_Moving == 1 && m_fPositionOffsetFromSelection <= 0)) { ChangeMusic( m_Moving ); if( PREFSMAN->m_iMusicWheelSwitchSpeed < MAX_WHEEL_SOUND_SPEED ) m_soundChangeMusic.Play(); } if( PREFSMAN->m_iMusicWheelSwitchSpeed >= MAX_WHEEL_SOUND_SPEED && m_MovingSoundTimer.PeekDeltaTime() >= 1.0f / MAX_WHEEL_SOUND_SPEED ) { m_MovingSoundTimer.GetDeltaTime(); m_soundChangeMusic.Play(); } } else { // "rotate" wheel toward selected song float fSpinSpeed = 0.2f + fabsf( m_fPositionOffsetFromSelection ) / SWITCH_SECONDS; if( m_fPositionOffsetFromSelection > 0 ) { m_fPositionOffsetFromSelection -= fSpinSpeed*fDeltaTime; if( m_fPositionOffsetFromSelection < 0 ) m_fPositionOffsetFromSelection = 0; } else if( m_fPositionOffsetFromSelection < 0 ) { m_fPositionOffsetFromSelection += fSpinSpeed*fDeltaTime; if( m_fPositionOffsetFromSelection > 0 ) m_fPositionOffsetFromSelection = 0; } } }
void wxVScrolledWindow::RefreshAll() { UpdateScrollbar(); Refresh(); }