/* This callback is called when some action is performed on the scrollbar. -> action : type of action that call the event. -> x,y : scrollbar thumb positions, value between 0 and 1 */ int iupMatrixScrollCB(Ihandle* ih, int action, float x, float y) { int err; x = IupGetFloat(ih, "POSX"); y = IupGetFloat(ih, "POSY"); IsCanvasSet(ih, err); if(err == CD_OK) { switch(action) { case IUP_SBUP : ScrollUp(ih); break; case IUP_SBDN : ScrollDown(ih); break; case IUP_SBPGUP : ScrollPgUp(ih); break; case IUP_SBPGDN : ScrollPgDown(ih); break; case IUP_SBRIGHT : ScrollRight(ih); break; case IUP_SBLEFT : ScrollLeft(ih); break; case IUP_SBPGRIGHT : ScrollPgRight(ih); break; case IUP_SBPGLEFT : ScrollPgLeft(ih); break; case IUP_SBPOSV : ScrollPosVer(ih,y); break; case IUP_SBPOSH : ScrollPosHor(ih,x); break; case IUP_SBDRAGV : ScrollPosVer(ih,y); break; case IUP_SBDRAGH : ScrollPosHor(ih,x); break; } } { cdCanvasFlush(ih->data->cddbuffer); ih->data->redraw = 0; } /* always update */ return IUP_DEFAULT; }
/** * Display text stored in EEPROM memory using current font. * * \param szText Text to display in EEPROM. Must be terminated by 0 or 0xFF. * * \retval BUTTON_SHORT Button pressed short * \retval BUTTON_LONG Button pressed long * \retval BUTTON_NONE Timeout */ uint8_t ledPuts_EE( const uint8_t* szText ) { int offset = 0; uint8_t key; //copy data from EEPROM for(g_TextBufferLen=0;g_TextBufferLen<TEXTBUFFER_SIZE;g_TextBufferLen++) { g_TextBuffer[g_TextBufferLen] = eeprom_read_byte( szText + g_TextBufferLen ); //read byte from eeprom if( 0 == g_TextBuffer[g_TextBufferLen] || 0xFF /*EEPROM not programmed*/ == g_TextBuffer[g_TextBufferLen] ) { break; //end of string } } //scroll once entire text do { ScrollLeft(g_TextBuffer, g_TextBufferLen, &offset ); key = ButtonCheck(); if( key == BUTTON_SHORT || key == BUTTON_LONG ) { return key; } _delay_ms(20); } while( offset ); return BUTTON_NONE; }
void CSkinHorizontalScrollbar::OnTimer(UINT nIDEvent) { if(nIDEvent == 1) { if(bMouseDownArrowRight) { ScrollRight(); } if(bMouseDownArrowLeft) { ScrollLeft(); } } else if(nIDEvent == 2) { if(bMouseDownArrowRight) { KillTimer(2); SetTimer(1, 50, NULL); } if(bMouseDownArrowLeft) { KillTimer(2); SetTimer(1, 50, NULL); } } CStatic::OnTimer(nIDEvent); }
int EList::ExecCommand(int Command, ExState &State) { int W = 1; int H = 1; if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } FixPos(); switch (Command) { case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExScrollLeft: return ScrollLeft(8); case ExScrollRight: return ScrollRight(8); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExRescan: RescanList(); return ErOK; case ExActivate: return Activate(); case ExListMark: return Mark(); case ExListUnmark: return Unmark(); case ExListToggleMark: return ToggleMark(); case ExListMarkAll: return MarkAll(); case ExListUnmarkAll: return UnmarkAll(); case ExListToggleMarkAll: return ToggleMarkAll(); } return EModel::ExecCommand(Command, State); }
/////////////////////////////////////////////////////////////////////////////// // OnTimer void CXScrollBar::OnTimer(UINT nIDEvent) { if (nIDEvent == TIMER_MOUSE_OVER_BUTTON) // mouse is in an arrow button, // and left button is down { if (m_bMouseDownArrowLeft) { ScrollLeft(); } if (m_bMouseDownArrowRight) { ScrollRight(); } if (m_bMouseDownArrowUp) { ScrollUp(); } if (m_bMouseDownArrowDown) { ScrollDown(); } } else if (nIDEvent == TIMER_LBUTTON_PRESSED) // mouse is in an arrow button, // and left button has just been pressed { KillTimer(nIDEvent); if (m_bMouseDownArrowLeft || m_bMouseDownArrowRight || m_bMouseDownArrowUp || m_bMouseDownArrowDown) { // debounce left click SetTimer(TIMER_MOUSE_OVER_BUTTON, 100, NULL); } } else if (nIDEvent == TIMER_MOUSE_OVER_THUMB) // mouse is over thumb { CPoint point; ::GetCursorPos(&point); ScreenToClient(&point); if (!m_rectThumb.PtInRect(point)) { // no longer over thumb, restore thumb color m_bThumbHover = FALSE; KillTimer(nIDEvent); ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); Invalidate(); } } CStatic::OnTimer(nIDEvent); }
void CSkinHorizontalScrollbar::OnLButtonUp(UINT nFlags, CPoint point) { UpdateThumbPosition(); KillTimer(1); ReleaseCapture(); bool bInChannel = true; CRect clientRect; GetClientRect(&clientRect); int nWidth = clientRect.Width()-26; CRect rectLeftArrow(0,0,26,20); CRect rectThumb(nThumbLeft,0,nThumbLeft+26,20); if(rectLeftArrow.PtInRect(point)) { ScrollLeft(); bInChannel = false; } CRect rectRightArrow(nWidth,0,nWidth+26,20); if(rectRightArrow.PtInRect(point)) { ScrollRight(); bInChannel = false; } if(rectThumb.PtInRect(point)) { bInChannel = false; } if(bInChannel == true && !bMouseDown) { if(point.x > nThumbLeft) { PageRight(); } else { PageLeft(); } } //reset all variables bMouseDown = false; bDragging = false; bMouseDownArrowLeft = false; bMouseDownArrowRight = false; CStatic::OnLButtonUp(nFlags, point); }
void Game_Map::UpdateScroll() { if (scroll_rest > 0) { int distance = (1 << scroll_speed) / 2; switch (scroll_direction) { case 2: ScrollDown(distance); break; case 4: ScrollLeft(distance); break; case 6: ScrollRight(distance); break; case 8: ScrollUp(distance); break; } scroll_rest -= distance; } }
void CDxMonthPicker::ScrollRight(int nMonthCount) { int nYear = m_dtFirstMonth.GetYear(); int nMonth = m_dtFirstMonth.GetMonth(); int nYearNew = nYear + nMonthCount / 12; int nMonthNew = nMonth + nMonthCount % 12; if (nMonthNew > 12) { nMonthNew -= 12; nYearNew++; } if (m_dtMaxRange.GetStatus() == COleDateTime::valid) { int nLeftYear = m_dtMaxRange.GetYear(); int nMaxMonth = m_dtMaxRange.GetMonth(); int nLeftMonth = nMaxMonth; if (nLeftMonth < 1) { nLeftYear -= (-nLeftMonth) / 12 + 1; nLeftMonth = -(((-nLeftMonth) % 12) - 12); } if (nYearNew > nLeftYear) { nYearNew = nLeftYear; nMonthNew = nLeftMonth; } if (nLeftYear == nYearNew) { if (nMonthNew > nLeftMonth) nMonthNew = nLeftMonth; } } m_dtFirstMonth.SetDate(nYearNew, nMonthNew, 1); ScrollLeft(0); // adjust also scrolling left before calling Populate(); }
void showText(const char *text) { uint8_t softx; uint8_t charPos=0; char firstChar = *text; uint8_t moreThanOneChar = 1; if (*(text+1) == '\0') { moreThanOneChar =0; } for (;*text!='\0';text++,charPos++) // Aktuelles Zeichen lesen { for (softx=0;softx<FONTWIDTH;softx++) // Pixel des Zeichens abarbeiten { if (moreThanOneChar) { if (*(text+1)=='\0' && softx == FONTWIDTH-1 && firstChar == '1') { // Das letzte Zeichen braucht keinen rechten Rand aber nur wenn es nicht alleine ist break; } if (*(text+1)=='\0' && softx == FONTWIDTH-2 && firstChar != '1') { // Das letzte Zeichen braucht keinen rechten Rand aber nur wenn es nicht alleine ist break; } if (softx == FONTWIDTH-1) { // Zwischenraum nur eine Spalte continue; } if (*text == '1' && (softx == FONTWIDTH-3 || softx == 0)) { // Die eins verkleinern continue; } } ScrollLeft(); // Platz schaffen und Zeilen nach links schieben PrintScrollColumn(*text,softx,0); // Ganz rechts eine Spalte des Zeichens ausgeben _delay_ms(35); // Ein bischen warten damit es nicht zu schnell wird } } }
void CCrystalEditView::DoDragScroll(const CPoint &point) { CRect rcClientRect; GetClientRect(rcClientRect); if (point.y < rcClientRect.top + DRAG_BORDER_Y) { HideDropIndicator(); ScrollUp(); UpdateWindow(); ShowDropIndicator(point); return; } if (point.y >= rcClientRect.bottom - DRAG_BORDER_Y) { HideDropIndicator(); ScrollDown(); UpdateWindow(); ShowDropIndicator(point); return; } if (point.x < rcClientRect.left + GetMarginWidth() + DRAG_BORDER_X) { HideDropIndicator(); ScrollLeft(); UpdateWindow(); ShowDropIndicator(point); return; } if (point.x >= rcClientRect.right - DRAG_BORDER_X) { HideDropIndicator(); ScrollRight(); UpdateWindow(); ShowDropIndicator(point); return; } }
void CART2DImageViewer::keyPressEvent(QKeyEvent *event){ switch (event->key()) { case Qt::Key_Plus: { ZoomIn(); break; } case Qt::Key_Minus: { ZoomOut(); break; } case Qt::Key_Left: { ScrollLeft(); break; } case Qt::Key_Right: { ScrollRight(); break; } case Qt::Key_Down: { ScrollDown(); break; } case Qt::Key_Up: { ScrollUp(); break; } default: QWidget::keyPressEvent(event); } }
void CMiniCalendarCtrl::OnLButtonDown(UINT nFlags, CPoint point) { SetFocus(); if (m_rectScrollLeft.PtInRect(point)) { //left month scroll-arrow ScrollLeft(); } else if (m_rectScrollRight.PtInRect(point)) { //right month scroll-arrow ScrollRight(); } else if (HeaderHitTest(point)) { //month name, show month dropdown CMiniCalendarCtrlCell* pCell = HeaderHitTest(point); if (pCell) { m_pHeaderCell = pCell; int iCell = ((pCell->GetRow()-1) + pCell->GetCol())-1; // determine month/year of header int iMonth = m_iCurrentMonth; int iYear = m_iCurrentYear; for (int iX = 0; iX < iCell; iX++) { iMonth++; if (iMonth > 12) { iMonth = 1; iYear++; } } // make sure list is not already created if (m_pHeaderList) { ASSERT(FALSE); m_pHeaderList->DestroyWindow(); delete m_pHeaderList; m_pHeaderList = NULL; } // create list m_pHeaderList = new CMiniCalendarMonthPicker; if (!m_pHeaderList) { ASSERT(FALSE); throw (new CMemoryException()); } // create list control DWORD dwStyle = WS_POPUP | WS_EX_TOPMOST | WS_EX_WINDOWEDGE | WS_BORDER; LPCTSTR szWndCls = AfxRegisterWndClass(CS_BYTEALIGNCLIENT | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS, 0,0,0); m_iHeaderTimerID = SetTimer(MINICAL_HEADER_TIMER_ID, MINICAL_HEADER_TIMER_INTERVAL, NULL); m_pHeaderList->SetMiddleMonthYear(iMonth, iYear); m_pHeaderList->SetCalendar(this); m_pHeaderList->CreateEx(0, szWndCls, _T(""), dwStyle, 0, 0, 0, 0, m_hWnd, NULL, NULL); m_pHeaderList->AutoConfigure(); m_pHeaderList->ShowWindow(TRUE); SetCapture(); m_bHeaderTracking = TRUE; } else { ASSERT(FALSE); } } else { CMiniCalendarCtrlFontHotSpot* pSpot = HitTest(point); if (pSpot) { //clicked on a date hotspot if (!m_pWnd->IsDateHidden(pSpot->m_date)) { BOOL bDifferentDate = SelectDate(pSpot->m_date); m_dateSelected = pSpot->m_date; SetCapture(); m_bTracking = TRUE; if (bDifferentDate) { FireNotifySelectDate(); } } } } CWnd::OnLButtonDown(nFlags, point); }
void walk(map_view_t *pip, player_t *player, word pn) { #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1; //printf("player[%d].d=%d\n", pn, player[pn].d); switch(player[pn].d) { //no direction case 2: //0000pip[0].video->startclk = (*clockw); break; //right movement case 3: //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw); if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollRight(pip, player, 3, pn); ScrollRight(pip, player, 2, pn); mapScrollRight(pip, player, !(pip[0].video->p), pn); mapScrollRight(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } } else if(player[pn].tx < pip[0].map->width && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].x+=(player[pn].speed); animatePlayer(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } } else { if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); #ifdef SPRITE //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 16, 32, PLAYERBMPDATA); animate_spri(player[pn].spri); #else modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 14); #endif if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx+1; player[pn].triggery = player[pn].ty; break; //left movement case 1: if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollLeft(pip, player, 3, pn); ScrollLeft(pip, player, 2, pn); mapScrollLeft(pip, player, !(pip[0].video->p), pn); mapScrollLeft(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } } else if(player[pn].tx > 1 && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].x-=(player[pn].speed); animatePlayer(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } } else { if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); #ifdef SPRITE //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 96, 16, 32, PLAYERBMPDATA); animate_spri(player[pn].spri); #else modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 10); #endif if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx-1; player[pn].triggery = player[pn].ty; break; //down movement case 4: if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) //collision detection! { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollDown(pip, player, 3, pn); ScrollDown(pip, player, 2, pn); mapScrollDown(pip, player, !(pip[0].video->p), pn); mapScrollDown(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } } else if(player[pn].ty < pip[0].map->height && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].y+=(player[pn].speed); animatePlayer(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } } else { if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); #ifdef SPRITE //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 64, 16, 32, PLAYERBMPDATA); animate_spri(player[pn].spri); #else modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 9); #endif if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx; player[pn].triggery = player[pn].ty+1; break; //up movement case 0: if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) //collision detection! { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); ScrollUp(pip, player, 3, pn); ScrollUp(pip, player, 2, pn); mapScrollUp(pip, player, !(pip[0].video->p), pn); mapScrollUp(pip, player, (pip[0].video->p), pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } } else if(player[pn].ty > 1 && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) { if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].y-=(player[pn].speed); animatePlayer(pip, player, 0, pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } } else { if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); #ifdef SPRITE //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 0, 16, 32, PLAYERBMPDATA); animate_spri(player[pn].spri); #else modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 12); #endif if(!pageflipflop) modexShowPage(pip[1].page); player[pn].d = 2; } player[pn].triggerx = player[pn].tx; player[pn].triggery = player[pn].ty-1; break; } }
VOID CALLBACK timerProc (HWND hwnd,UINT nMsg,UINT nTimerid,DWORD dwTime) { //滚动字符 ScrollLeft(str); SetDlgItemText(hwnd,8,str); }
static int BD1_setdata(int id, int segdata, int data) { int change = 0, move = 0; switch ( data ) { case 0x25: /* flash */ move++; break; case 0x26: /* undefined */ break; case 0x2C: /* semicolon */ case 0x2E: /* decimal point */ vfds[id].segments[vfds[id].pcursor_pos] |= (1<<12); change++; break; case 0x3B: /* dummy char */ move++; break; case 0x3A: vfds[id].user_def = 2; break; default: move = 1; change = 1; } if ( move ) { int mode = vfds[id].display_mode; vfds[id].pcursor_pos = vfds[id].cursor_pos; if ( vfds[id].window_size <= 0 || (vfds[id].window_size > 16)) { /* no window selected default to rotate mode */ if ( mode == 2 ) mode = 0; else if ( mode == 3 ) mode = 1; /*mode &= -2; */ } switch ( mode ) { case 0: /* rotate left */ vfds[id].cursor_pos &= 0x0F; if ( change ) { vfds[id].string[vfds[id].cursor_pos] = BFM2ASCII[data]; vfds[id].segments[vfds[id].cursor_pos] = segdata; } vfds[id].cursor_pos++; if ( vfds[id].cursor_pos >= 16 ) vfds[id].cursor_pos = 0; break; case 1: /* Rotate right */ vfds[id].cursor_pos &= 0x0F; if ( change ) { vfds[id].string[vfds[id].cursor_pos] = BFM2ASCII[data]; vfds[id].segments[vfds[id].cursor_pos] = segdata; } vfds[id].cursor_pos--; if ( vfds[id].cursor_pos < 0 ) vfds[id].cursor_pos = 15; break; case 2: /* Scroll left */ if ( vfds[id].cursor_pos < vfds[id].window_end ) { vfds[id].scroll_active = 0; if ( change ) { vfds[id].string[vfds[id].cursor_pos] = BFM2ASCII[data]; vfds[id].segments[vfds[id].cursor_pos] = segdata; } if ( move ) vfds[id].cursor_pos++; } else { if ( move ) { if ( vfds[id].scroll_active ) ScrollLeft(id); else vfds[id].scroll_active = 1; } if ( change ) { vfds[id].string[vfds[id].window_end] = BFM2ASCII[data]; vfds[id].segments[vfds[id].cursor_pos] = segdata; } else { vfds[id].string[vfds[id].window_end] = ' '; vfds[id].segments[vfds[id].cursor_pos] = 0; } } break; case 3: /* Scroll right */ if ( vfds[id].cursor_pos > vfds[id].window_start ) { if ( change ) { vfds[id].string[vfds[id].cursor_pos] = BFM2ASCII[data]; vfds[id].segments[vfds[id].cursor_pos] = segdata; } vfds[id].cursor_pos--; } else { int i = vfds[id].window_end; while ( i > vfds[id].window_start ) { vfds[id].string[ i ] = vfds[id].string[ i-1 ]; vfds[id].segments[i] = vfds[id].segments[i-1]; i--; } if ( change ) { vfds[id].string[vfds[id].window_start] = BFM2ASCII[data]; vfds[id].segments[vfds[id].window_start] = segdata; } } break; } } return change; }
static int BD1_setdata(int id, int segdata, int data) { int change = 0, move = 0; switch ( data ) { case 0x25: // flash move++; break; case 0x26: // undefined break; case 0x2C: // semicolon case 0x2E: // decimal point bd1[id].segments[bd1[id].pcursor_pos] |= (1<<12); change++; break; case 0x3B: // dummy char move++; break; case 0x3A: bd1[id].user_def = 2; break; default: move = 1; change = 1; } if ( move ) { int mode = bd1[id].display_mode; bd1[id].pcursor_pos = bd1[id].cursor_pos; if ( bd1[id].window_size <= 0 || (bd1[id].window_size > 16)) { // no window selected default to rotate mode if ( mode == 2 ) mode = 0; else if ( mode == 3 ) mode = 1; //mode &= -2; } switch ( mode ) { case 0: // rotate left bd1[id].cursor_pos &= 0x0F; if ( change ) { bd1[id].string[bd1[id].cursor_pos] = BD1ASCII[data]; bd1[id].segments[bd1[id].cursor_pos] = segdata; } bd1[id].cursor_pos++; if ( bd1[id].cursor_pos >= 16 ) bd1[id].cursor_pos = 0; break; case 1: // Rotate right bd1[id].cursor_pos &= 0x0F; if ( change ) { bd1[id].string[bd1[id].cursor_pos] = BD1ASCII[data]; bd1[id].segments[bd1[id].cursor_pos] = segdata; } bd1[id].cursor_pos--; if ( bd1[id].cursor_pos < 0 ) bd1[id].cursor_pos = 15; break; case 2: // Scroll left if ( bd1[id].cursor_pos < bd1[id].window_end ) { bd1[id].scroll_active = 0; if ( change ) { bd1[id].string[bd1[id].cursor_pos] = BD1ASCII[data]; bd1[id].segments[bd1[id].cursor_pos] = segdata; } if ( move ) bd1[id].cursor_pos++; } else { if ( move ) { if ( bd1[id].scroll_active ) ScrollLeft(id); else bd1[id].scroll_active = 1; } if ( change ) { bd1[id].string[bd1[id].window_end] = BD1ASCII[data]; bd1[id].segments[bd1[id].cursor_pos] = segdata; } else { bd1[id].string[bd1[id].window_end] = ' '; bd1[id].segments[bd1[id].cursor_pos] = 0; } } break; case 3: // Scroll right if ( bd1[id].cursor_pos > bd1[id].window_start ) { if ( change ) { bd1[id].string[bd1[id].cursor_pos] = BD1ASCII[data]; bd1[id].segments[bd1[id].cursor_pos] = segdata; } bd1[id].cursor_pos--; } else { int i = bd1[id].window_end; while ( i > bd1[id].window_start ) { bd1[id].string[ i ] = bd1[id].string[ i-1 ]; bd1[id].segments[i] = bd1[id].segments[i-1]; i--; } if ( change ) { bd1[id].string[bd1[id].window_start] = BD1ASCII[data]; bd1[id].segments[bd1[id].window_start] = segdata; } } break; } } return change; }
/////////////////////////////////////////////////////////////////////////////// // OnLButtonUp void CXScrollBar::OnLButtonUp(UINT nFlags, CPoint point) { UpdateThumbPosition(); KillTimer(1); ReleaseCapture(); if (m_bHorizontal) { CRect rectLeftArrow(0, 0, m_nBitmapWidth, m_rectClient.Height()); CRect rectRightArrow(m_rectClient.Width() - m_nBitmapWidth, 0, m_rectClient.Width(), m_rectClient.Height()); CRect rectThumb(m_nThumbLeft, 0, m_nThumbLeft + m_nBitmapWidth, m_rectClient.Height()); if (rectLeftArrow.PtInRect(point)) { ScrollLeft(); } else if (rectRightArrow.PtInRect(point)) { ScrollRight(); } else if (rectThumb.PtInRect(point)) { m_bThumbHover = TRUE; Invalidate(); SetTimer(TIMER_MOUSE_OVER_THUMB, 50, NULL); } m_bMouseDownArrowLeft = FALSE; m_bMouseDownArrowRight = FALSE; } else { CRect rectUpArrow(0, 0, m_rectClient.Width(), m_nBitmapHeight); CRect rectDownArrow(0, m_rectClient.Height() - m_nBitmapHeight, m_rectClient.Width(), m_rectClient.Height()); CRect rectThumb(0, m_nThumbTop, m_rectClient.Width(), m_nThumbTop + m_nBitmapHeight); if (rectUpArrow.PtInRect(point)) { ScrollUp(); } else if (rectDownArrow.PtInRect(point)) { ScrollDown(); } else if (rectThumb.PtInRect(point)) { m_bThumbHover = TRUE; Invalidate(); SetTimer(TIMER_MOUSE_OVER_THUMB, 50, NULL); } m_bMouseDownArrowUp = FALSE; m_bMouseDownArrowDown = FALSE; } m_bMouseDown = FALSE; m_bDragging = FALSE; CStatic::OnLButtonUp(nFlags, point); }