BYTE refreshImageList(void) { commandShort[4] = FDD_CMD_SEARCH_REFRESHLIST; // tell the host that it should refresh image list commandShort[5] = 0; sectorCount = 1; // read 1 sector BYTE res = Supexec(ce_acsiReadCommand); if(res != FDD_OK) { showComError(); return 0; } res = searchInit(); // try to initialize return res; }
BYTE loopForDownload(void) { DWORD lastStatusCheckTime = 0; search.len = 0; // clear search string memset(search.text, 0, MAX_SEARCHTEXT_LEN + 1); search.pageCurrent = 0; search.pagesCount = 0; search.row = 0; search.prevRow = 0; destDir.isSet = 0; BYTE res = searchInit(); // try to initialize if(res == 0) { // failed to initialize? return to floppy config screen return KEY_F8; } getStatus(); lastStatusCheckTime = getTicksAsUser(); // fill status.doWeHaveStorage before 1st showMenuDownload() imageSearch(); showMenuDownload(SHOWMENU_ALL); BYTE showMenuMask; BYTE gotoPrevPage, gotoNextPage; while(1) { BYTE key, kbshift; DWORD now = getTicksAsUser(); gotoPrevPage = 0; gotoNextPage = 0; showMenuMask = 0; if(now >= (lastStatusCheckTime + 200)) { // if last check was at least a second ago, do new check BYTE refreshDataAndRedraw = FALSE; lastStatusCheckTime = now; getStatus(); // talk to CE to see the status if(status.downloadCount == 0 && status.prevDownloadCount > 0) { // if we just finished downloading (not downloading now, but were downloading a while ago) refreshDataAndRedraw = TRUE; // do a refresh } if(status.doWeHaveStorage != status.prevDoWeHaveStorage) { // if user attached / detached drive, redraw all refreshDataAndRedraw = TRUE; // do a refresh } if(refreshDataAndRedraw) { // should do a refresh? getResultsPage(search.pageCurrent); // refresh current page data showMenuDownload(SHOWMENU_ALL); // draw all on screen } } key = getKeyIfPossible(); // get key if one is waiting or just return 0 if no key is waiting if(key == 0) { // no key? just go back to start continue; } kbshift = Kbshift(-1); if(key == KEY_F10 || key == KEY_F8) { // should quit or switch mode? return key; } if(key == KEY_F1 || key == KEY_F2 || key == KEY_F3) { // insert image into slot 1, 2, 3? insertCurrentIntoSlot(key); showMenuDownload(SHOWMENU_RESULTS_ROW); continue; } if(key == KEY_F4) { // start downloading images? downloadCurrentToStorage(); // start download continue; } if(key == KEY_F5) { // refresh the list of images getResultsPage(search.pageCurrent); // refresh current page data showMenuDownload(SHOWMENU_ALL); // draw all on screen continue; } if(key >= 'A' && key <= 'Z') { // upper case letter? to lower case! key += 32; } if((key >= 'a' && key <='z') || key == ' ' || (key >= 0 && key <= 9) || key == KEY_ESC || key == KEY_BACKSP) { res = handleWriteSearch(key); if(res) { // if the search string changed, search for images imageSearch(); showMenuMask = SHOWMENU_SEARCHSTRING | SHOWMENU_RESULTS_ALL; } } if((kbshift & (K_RSHIFT | K_LSHIFT)) != 0) { // shift pressed? if(key == KEY_PAGEUP) { // shift + arrow up = page up gotoPrevPage = 1; } if(key == KEY_PAGEDOWN) { // shift + arrow down = page down gotoNextPage = 1; } } else { // shift not pressed? if(key == KEY_UP) { // arrow up? if(search.row > 0) { // not the top most line? move one line up setSelectedRow(search.row - 1); showMenuMask = SHOWMENU_RESULTS_ROW; // just change the row highlighting } else { // this is the top most line gotoPrevPage = 1; } } if(key == KEY_DOWN) { // arrow up? if(search.row < 14) { // not the bottom line? move one line down setSelectedRow(search.row + 1); showMenuMask = SHOWMENU_RESULTS_ROW; // just change the row highlighting } else { // this is the top most line gotoNextPage = 1; } } } if(gotoPrevPage) { if(search.pageCurrent > 0) { // not the first page? move to previous page search.pageCurrent--; // getResultsPage(search.pageCurrent); // get previous results showMenuMask = SHOWMENU_RESULTS_ALL; // redraw all results setSelectedRow(14); // move to last row } } if(gotoNextPage) { if(search.pageCurrent < (search.pagesCount - 1)) { // not the last page? move to next page search.pageCurrent++; // getResultsPage(search.pageCurrent); // get next results showMenuMask = SHOWMENU_RESULTS_ALL; // redraw all results setSelectedRow(0); // move to first row } } showMenuDownload(showMenuMask); } }
void Menu_Search::searchcategorySlot() { searchInit(); searchSelectObjHandleInAdmin(); this->close();changewindow(CATEGORYMENU); }
void Menu_Search::searchcrossSlot() { searchInit(); searchSelectObjHandleInAdmin(); this->close();changewindow(ROADMENU); }
void Menu_Search::keywordSlot() { searchInit(); searchSelectObjHandleInAdmin(); this->close();changewindow(KEYWORDMENU); }
void Menu_Search::searcharoundSlot() { searchInit(); this->close();changewindow(AROUNDMENU); }