void EditboxView::pageDown() { int textheight = text_height(textfont); int height = getAreaHeight(); int numlines = height/textheight; for(int i=0; i<int(numlines);i++) { lineDown(); } }
void CMainFrame::OnActivatePartner() { TextView *view = getActiveTextView(); if(view) { view->activatePartner(); } } #define APPLY_TO_ACTIVE_TEXTVIEW(f) { TextView *view = getActiveTextView(); if(view) { view->f; } } void CMainFrame::OnCharLeft() { APPLY_TO_ACTIVE_TEXTVIEW(charLeft() ) } void CMainFrame::OnCharRight() { APPLY_TO_ACTIVE_TEXTVIEW(charRight() ) } void CMainFrame::OnCtrlCharLeft() { APPLY_TO_ACTIVE_TEXTVIEW(ctrlCharLeft() ) } void CMainFrame::OnCtrlCharRight() { APPLY_TO_ACTIVE_TEXTVIEW(ctrlCharRight()) } void CMainFrame::OnLineDown() { APPLY_TO_ACTIVE_TEXTVIEW(lineDown() ) } void CMainFrame::OnLineUp() { APPLY_TO_ACTIVE_TEXTVIEW(lineUp() ) } void CMainFrame::OnPageDown() { APPLY_TO_ACTIVE_TEXTVIEW(pageDown() ) } void CMainFrame::OnPageUp() { APPLY_TO_ACTIVE_TEXTVIEW(pageUp() ) } void CMainFrame::OnHome() { APPLY_TO_ACTIVE_TEXTVIEW(home() ) } void CMainFrame::OnEnd() { APPLY_TO_ACTIVE_TEXTVIEW(end() ) } void CMainFrame::OnCtrlHome() { APPLY_TO_ACTIVE_TEXTVIEW(ctrlHome() ) } void CMainFrame::OnCtrlEnd() { APPLY_TO_ACTIVE_TEXTVIEW(ctrlEnd() ) } void CMainFrame::refreshDoc(bool recomp) { TextView *view = getActiveTextView(); if(view == NULL) { return; } CWinDiffDoc *doc = view->getDocument();
int BndsTicketView::exec() { string t; char str [50]; int res; BndsTicketsListView *btlv; /// Muestra la pantalla. show(); while(1) { swiWaitForVBlank(); scanKeys(); /// Procesa los eventos de la pantalla tactil. int itemSelected = g_video->eventTemplateListB(); if (keysDown() & KEY_LEFT) { previousPage(); } else if (keysDown() & KEY_RIGHT) { nextPage(); } else if (keysDown() & KEY_L) { /// Vuelta a la pantalla anterior. g_video->resetBgSub(); break; } else if (keysDown() & KEY_R) { /// Seleccionar mesa y enviar. itemSelected = -10; } else if (keysDown() & KEY_UP) { itemSelected = -6; } else if (keysDown() & KEY_DOWN) { itemSelected = -7; } // end if switch (itemSelected) { case -1: /// Necesita repintarse. show(); break; case -2: if (m_currentLine == 0) break; /// Boton - cantidad. m_currentTicketLine->setQuantityArticle(m_currentTicketLine->quantityArticle() - 1); /// Si la cantidad es <= 0 entonces se borra la linea de ticket. if (m_currentTicketLine->quantityArticle() <= 0) { m_ticket->removeTicketLine( m_currentTicketLine ); /// Establece el numero de items a mostrar en la lista. setTotalItems( m_ticket->ticketLines().size() ); } // end if m_ticket->recalculeTotal(); show(); break; case -3: if (m_currentLine == 0) break; /// Boton + cantidad. m_currentTicketLine->setQuantityArticle(m_currentTicketLine->quantityArticle() + 1); m_ticket->recalculeTotal(); show(); break; case -4: if (m_currentLine == 0) break; /// Boton borrar linea m_ticket->removeTicketLine( m_currentTicketLine ); /// Establece el numero de items a mostrar en la lista. setTotalItems( m_ticket->ticketLines().size() ); m_ticket->recalculeTotal(); show(); break; case -5: /// Boton anterior. /// Vuelta a la pantalla anterior. g_video->resetBgSub(); return 0; break; case -6: /// Dibuja boton 'Sube linea'. lineUp(); break; case -7: /// Dibuja boton 'Baja linea'. lineDown(); break; case -10: /// Seleccionar mesa y enviar. g_video->resetBgMain(); g_video->resetBgSub(); /// Primero cambiar el nombre al ticket. Despues enviar los datos. /// TODO: Provisionalmente genera 40 mesas (40 nombres de tickets). /// luego comprueba que el nombre no exista en la base de datos (se esta usando). /// muestra la lista completa, pero solo deja elegir los que esten disponibles. btlv = new BndsTicketsListView(); res = btlv->exec(); delete btlv; /// TODO: manera nada adecuada de conseguir el nombre del ticket seleccionado. sprintf(str,"%i", res); t = string("MESA ") + string(str); m_ticket->setNomTicket(t); /// TODO: tecla provisional. Enviar ticket. g_db->saveTicket(); m_ticket->clearTicket(); setTotalItems( m_ticket->ticketLines().size() ); m_ticket->setNomTicket(m_ticket->defaultTicketName()); return 0; break; case 2: break; } // end switch } // end while return 0; }