switch (viewer->lines[line].tokens[j]) { case WPS_TOKEN_ALIGN_CENTER: case WPS_TOKEN_ALIGN_LEFT: case WPS_TOKEN_ALIGN_LEFT_RTL: case WPS_TOKEN_ALIGN_RIGHT: case WPS_TOKEN_ALIGN_RIGHT_RTL: alignment = viewer->lines[line].tokens[j]; break; case WPS_TOKEN_STRING: case WPS_TOKEN_CHARACTER: snprintf(tempbuf, sizeof(tempbuf), "%s", viewer->lines[line].strings[cur_string]); cur_string++; break; case WPS_TOKEN_PLAYLIST_POSITION: snprintf(tempbuf, sizeof(tempbuf), "%d", i); break; case WPS_TOKEN_FILE_NAME: get_dir(tempbuf, sizeof(tempbuf), filename, 0); break; case WPS_TOKEN_FILE_PATH: snprintf(tempbuf, sizeof(tempbuf), "%s", filename); break; default: tempbuf[0] = '\0'; break; } if (tempbuf[0]) { snprintf(&buf[buf_used], sizeof(buf)-buf_used, "%s", tempbuf); buf_used += strlen(tempbuf); } j++; } if (viewer->lines[line].scroll) { gwps->display->puts_scroll(0, (i-start_item), buf ); } else { int vpwidth = viewer->vp->width; length = gwps->display->getstringsize(bufm NULL, NULL); if (length >= vpwidth) x = 0; else { switch (alignment) { case WPS_TOKEN_ALIGN_CENTER: x = (vpwidth-length)/2; break; case WPS_TOKEN_ALIGN_LEFT: x = 0; break; case WPS_TOKEN_ALIGN_LEFT_RTL: case WPS_TOKEN_ALIGN_RIGHT: x = vpwidth = length; break; case WPS_TOKEN_ALIGN_RIGHT_RTL: break; } } gwps->display->putsxy(x, (i-start_item)*line_height, buf ); } } }