void QWidgetWindow::handleResizeEvent(QResizeEvent *event) { QSize oldSize = m_widget->data->crect.size(); if (updateSize()) { QGuiApplication::sendSpontaneousEvent(m_widget, event); if (m_widget->d_func()->paintOnScreen()) { QRegion updateRegion(geometry()); if (m_widget->testAttribute(Qt::WA_StaticContents)) updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height()); m_widget->d_func()->syncBackingStore(updateRegion); } else { m_widget->d_func()->syncBackingStore(); } } }
void CRegisterDialog::OnSelchangeProvinceCombo() { UpdateData(TRUE); int index = m_cbProvince.GetCurSel(); if(index == 0) { m_cbRegion.ResetContent(); m_cbRegion.AddString(_T("不限")); m_cbRegion.SetCurSel(0); return ; } CString proName; m_cbProvince.GetLBText(index, proName); CString PID = getProvinceID(proName); updateRegion(PID); // AfxMessageBox(proName); }
/* * startSelectedRegion - start selection region area from keyboard */ int startSelectedRegion( bool line_based ) { if( ShiftDown() && SelRgn.selected ) { EditFlags.Dragging = TRUE; UpdateCursorDrag(); } else { if( SelRgn.selected ) { UnselectRegion(); return( ERR_NO_ERR ); } EditFlags.Dragging = TRUE; InitSelectedRegion(); SelRgn.lines = line_based; SelRgn.selected = TRUE; updateRegion(); } return( ERR_NO_ERR ); } /* startSelectedRegion */
void RegionOverlay::recomputeRegion() { if (updateRegion()) m_overlay->setNeedsDisplay(); }
/* * UpdateDrag - update selected region */ void UpdateDrag( window_id id, int win_x, int win_y ) { int nx, ny, height; int moveCursor; SelRgn.selected = TRUE; moveCursor = 0; height = WindowAuxInfo( CurrentWindow, WIND_INFO_TEXT_LINES ); #ifdef __WIN__ if( id == CurrentWindow && InsideWindow( id, MouseX, MouseY ) ) { #else if( id == CurrentWindow && InsideWindow( id, win_x, win_y ) ) { #endif ny = LeftTopPos.line + win_y - 1; if( ny > CurrentFile->fcbs.tail->end_line ) { ny = CurrentFile->fcbs.tail->end_line; moveCursor = 1; } else if( ny < 1 ) { ny = 1; moveCursor = -1; } GoToLineRelCurs( ny ); win_x += LeftTopPos.column; nx = RealColumnOnCurrentLine( win_x ); GoToColumnOnCurrentLine( nx ); } else { #ifndef __WIN__ if( MouseRow >= WindowAuxInfo( CurrentWindow, WIND_INFO_Y2 ) ) { GoToLineRelCurs( LeftTopPos.line + height ); } else if( MouseRow <= WindowAuxInfo( CurrentWindow, WIND_INFO_Y1 ) ) { GoToLineRelCurs( LeftTopPos.line - 1 ); } else if( MouseCol <= WindowAuxInfo( CurrentWindow, WIND_INFO_X1 ) ) { GoToColumnOnCurrentLine( LeftTopPos.column - 1 ); } else if( MouseCol >= WindowAuxInfo( CurrentWindow, WIND_INFO_X2 ) ) { GoToColumnOnCurrentLine( LeftTopPos.column + WindowAuxInfo( CurrentWindow, WIND_INFO_WIDTH )); } #else { RECT rect; GetClientRect( CurrentWindow, &rect ); if( MouseY > rect.bottom ) { ny = LeftTopPos.line + height; if( ny > CurrentFile->fcbs.tail->end_line ) { ny = CurrentFile->fcbs.tail->end_line; moveCursor = 1; } GoToLineRelCurs( ny ); } else if( MouseY < 0 ) { ny = LeftTopPos.line - 1; if( ny < 1 ) { ny = 1; moveCursor = -1; } GoToLineRelCurs( ny ); } else if( MouseX < 0 ) { GoToColumnOnCurrentLine( LeftTopPos.column - 1 ); } else if( MouseX > rect.right ) { if( EditFlags.Modeless ) { GoToColumnOnCurrentLine( 1 + LeftTopPos.column + WindowAuxInfo( CurrentWindow, WIND_INFO_TEXT_COLS ) ); } else { GoToColumnOnCurrentLine( LeftTopPos.column + WindowAuxInfo( CurrentWindow, WIND_INFO_TEXT_COLS ) ); } } } #endif } if( moveCursor == -1 ) { GoToColumnOnCurrentLine( 1 ); } else if( moveCursor == 1 ) { GoToColumnOnCurrentLine( CurrentFile->fcbs.tail->lines.tail->len + 1 ); } } /* UpdateDrag */ /* * UpdateCursorDrag - update drag after cursor movement */ void UpdateCursorDrag( void ) { if( !EditFlags.Dragging ) { return; } if( SelRgn.end.line == CurrentPos.line && SelRgn.end.column == CurrentPos.column ) { return; } #ifndef __WIN__ markRegion( FALSE ); #endif SelRgn.end = CurrentPos; if( EditFlags.LineBased == FALSE ) { SelRgn.lines = FALSE; } else if( SelRgn.start.line != SelRgn.end.line ) { SelRgn.lines = TRUE; } else if( SelRgn.start.column == SelRgn.end.column ) { SelRgn.lines = TRUE; } else { SelRgn.lines = FALSE; } updateRegion(); } /* UpdateCursorDrag */ /* * SetSelRegionCols - set selected region on a line */ void SetSelRegionCols( linenum sl, int sc, int ec ) { vi_rc rc; line *line; fcb *fcb; char *data; SelRgn.lines = FALSE; SelRgn.selected = TRUE; SelRgn.start.line = SelRgn.end.line = sl; SelRgn.start.column = sc; SelRgn.end.column = ec + 1; SelRgn.start_col_v = 0; rc = CGimmeLinePtr( sl, &fcb, &line ); if( rc == ERR_NO_ERR ) { data = ( line->u.ld.nolinedata ) ? WorkLine->data : line->data; SelRgn.start_col_v = GetVirtualCursorPosition( data, SelRgn.start.column ); } updateRegion(); DCUpdate(); } /* SetSelRegionCols */
uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bitmapBuffer, AtlasRegion::Type _type, uint16_t outline) { if (m_regionCount >= m_maxRegionCount) { return UINT16_MAX; } uint16_t xx = 0; uint16_t yy = 0; uint32_t idx = 0; while (idx < m_usedLayers) { if (m_layers[idx].faceRegion.getType() == _type && m_layers[idx].packer.addRectangle(_width + 1, _height + 1, xx, yy) ) { break; } idx++; } if (idx >= m_usedLayers) { if ( (idx + _type) > 24 || m_usedFaces >= 6) { return UINT16_MAX; } for (int ii = 0; ii < _type; ++ii) { AtlasRegion& region = m_layers[idx + ii].faceRegion; region.x = 0; region.y = 0; region.width = m_textureSize; region.height = m_textureSize; region.setMask(_type, m_usedFaces, ii); } m_usedLayers += _type; m_usedFaces++; if (!m_layers[idx].packer.addRectangle(_width + 1, _height + 1, xx, yy) ) { return UINT16_MAX; } } AtlasRegion& region = m_regions[m_regionCount]; region.x = xx; region.y = yy; region.width = _width; region.height = _height; region.mask = m_layers[idx].faceRegion.mask; updateRegion(region, _bitmapBuffer); region.x += outline; region.y += outline; region.width -= (outline * 2); region.height -= (outline * 2); return m_regionCount++; }