// C Source File // Created 07/02/2004; 23:33:07 #include "mkhibliba.h" /** * Read a file at a dertimined bookmark or line * * @param num_line the number of line to begin with (-1 to disable it) * @param bookmark the bookmark to begin with (-1 to disable it); it should be used to return the * bookmark to begin with the new file to open * @param name_var a buffer which will be able to contain the name of the var to open * @param hfile the file to read * @param hcfg the config * @param hlangbookmark the i18n texts for the bookmark menu * @param hlanglink the i18n texts for the link view * * @return HKEY_NEWFILE if a new file have to be opend, else HKEY_NOKEY */ short h_readPic(h_File * hfile, h_Config * hcfg) { short key = 0; h_initSynchro(hcfg->speed_key); hl_refreshScreen(hfile); //wait for a key do { key=HKEY_NOKEY; h_waitSynchro(); if (K_DOWN && hl_canGoDown(hfile)) { if (K_DIAM) { //to the bottom h_startSynchro(hcfg->speed_key); hl_goLastPage(hfile); } else if (K_2ND) { //by page h_startSynchro(hcfg->speed_key); hl_goPageDown(hfile, PAGE_SCROLL_COMMON_BAND); } else { //by pixel h_startSynchro(hcfg->speed_scroll); hl_goPixelDown(hfile); } } else if (K_UP && hl_canGoUp(hfile)) { //scroll to the beginning if (K_DIAM) { //to the top h_startSynchro(hcfg->speed_key); hl_goFirstPage(hfile); } else if (K_2ND) { //by page h_startSynchro(hcfg->speed_key); hl_goPageUp(hfile, PAGE_SCROLL_COMMON_BAND); } else { //by pixel h_startSynchro(hcfg->speed_scroll); hl_goPixelUp(hfile); } } else if (K_RIGHT && hl_canGoRight(hfile)) { if (K_DIAM) { //to the top h_startSynchro(hcfg->speed_key); hl_goRight(hfile); } else if (K_2ND) { //by page h_startSynchro(hcfg->speed_key); hl_goPageRight(hfile,PAGE_SCROLL_COMMON_BAND); } else { //by pixel h_startSynchro(hcfg->speed_scroll); hl_goPixelRight(hfile); } } else if (K_LEFT && hl_canGoLeft(hfile)) { if (K_DIAM) { h_startSynchro(hcfg->speed_key); hl_goLeft(hfile); } else if (K_2ND) { //by page h_startSynchro(hcfg->speed_key); hl_goPageLeft(hfile, PAGE_SCROLL_COMMON_BAND); } else { //by pixel h_startSynchro(hcfg->speed_scroll); hl_goPixelLeft(hfile); } } else if (K_CLEAR) { // turn the calculator off off(); h_startSynchro(hcfg->speed_key); } else if (K_ESC) { h_startSynchro(hcfg->speed_key); key=KEY_ESC; } else if (K_PLUS && K_DIAM) { //to control the contrast h_startSynchro(hcfg->speed_key); OSContrastUp(); } else if (K_MOINS && K_DIAM) { h_startSynchro(hcfg->speed_key); OSContrastDn(); } else { h_saveEnergy(); } } while (key == 0); h_waitSynchro(); h_freeSynchro(); return key; }