View difference between Paste ID: m3b680988 and
SHOW: | | - or go back to the newest paste.
1-
1+
  switch (viewer->lines[line].tokens[j])
2
            {
3
                case WPS_TOKEN_ALIGN_CENTER:
4
                case WPS_TOKEN_ALIGN_LEFT:
5
                case WPS_TOKEN_ALIGN_LEFT_RTL:
6
                case WPS_TOKEN_ALIGN_RIGHT:
7
                case WPS_TOKEN_ALIGN_RIGHT_RTL:
8
                    alignment = viewer->lines[line].tokens[j];
9
                    break;
10
                case WPS_TOKEN_STRING:
11
                case WPS_TOKEN_CHARACTER:
12
                    snprintf(tempbuf, sizeof(tempbuf), "%s",
13
                             viewer->lines[line].strings[cur_string]);
14
                    cur_string++;
15
                    break;
16
                case WPS_TOKEN_PLAYLIST_POSITION:
17
                    snprintf(tempbuf, sizeof(tempbuf), "%d", i);
18
                    break;
19
                case WPS_TOKEN_FILE_NAME:
20
                    get_dir(tempbuf, sizeof(tempbuf), filename, 0);
21
                    break;
22
                case WPS_TOKEN_FILE_PATH:
23
                    snprintf(tempbuf, sizeof(tempbuf), "%s", filename);
24
                    break;
25
                default:
26
                    tempbuf[0] = '\0';
27
                    break;
28
            }
29
            if (tempbuf[0])
30
            {
31
                snprintf(&buf[buf_used], sizeof(buf)-buf_used, "%s", tempbuf);
32
                buf_used += strlen(tempbuf);
33
            }
34
            j++;
35
        }
36
            
37
        int vpwidth = viewer->vp->width;
38
        length = gwps->display->getstringsize(buf, NULL, NULL);
39
        if (viewer->lines[line].scroll && length >= vpwidth)
40
        {
41
            gwps->display->puts_scroll(0, (i-start_item), buf );
42
        }
43
        else
44
        {    
45
            if (length >= vpwidth)
46
                x = 0;
47
            else
48
            {
49
                switch (alignment)
50
                {
51
                    case WPS_TOKEN_ALIGN_CENTER:
52
                        x = (vpwidth-length)/2;
53
                        break;
54
                    case WPS_TOKEN_ALIGN_LEFT:
55
                        x = 0;
56
                        break;
57
                    case WPS_TOKEN_ALIGN_LEFT_RTL:
58
                    case WPS_TOKEN_ALIGN_RIGHT:
59
                        x = vpwidth = length;
60
                        break;
61
                    case WPS_TOKEN_ALIGN_RIGHT_RTL:
62
			break;
63
                }
64
            }                    
65
            gwps->display->putsxy(x, (i-start_item)*line_height, buf );
66
        }
67
    }
68
}