Rev 6732 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6732 | leency | 1 | int verthoriz=0; |
2 | int shownums=1; |
||
3 | |||
4 | char str[MAX_PATH]; |
||
5 | word attr[MAX_PATH]; |
||
6 | |||
7 | printstrat(int x,y,size,_text,_attr) |
||
8 | { |
||
9 | int i; |
||
10 | for (i=0; i |
||
11 | { |
||
12 | con_set_flags stdcall (ESBYTE[i*2+_attr]); |
||
13 | con_set_cursor_pos stdcall (x+i,y); |
||
14 | con_write_string stdcall (_text+i, 1); |
||
15 | } |
||
16 | } |
||
17 | |||
18 | |||
19 | drawline(int x,y,width,linex,s1,s2,ln) |
||
20 | { |
||
21 | int i; |
||
22 | int s1l; |
||
23 | int s2l; |
||
24 | int c1,c2; |
||
25 | char temp[10]; |
||
26 | int x2,width2; |
||
27 | |||
28 | |||
29 | s1l=-1; |
||
30 | s2l=-1; |
||
31 | if(s1!=-1)s1l=strlen(s1); |
||
32 | if(s2!=-1)s2l=strlen(s2); |
||
33 | |||
34 | FillMemory(#attr,width*2,0x1F); |
||
35 | str[0]='║'; str[x+width-1]='║'; |
||
36 | |||
37 | if(s1==-1) |
||
38 | { |
||
39 | FillMemory(#str[1],width-2,'·'); |
||
40 | FillMemory(#attr[2],width-2*2,7); |
||
41 | }else{//строка присутствует |
||
42 | x2=1; |
||
43 | width2=width; |
||
44 | if(shownums) |
||
45 | { |
||
46 | wsprintf(#temp,"%6d",ln+1); |
||
47 | for(i=0;i<6;i++) |
||
48 | { |
||
49 | str[i+1]=temp[i]; |
||
50 | attr[i+1]=0x19; |
||
51 | } |
||
52 | str[7]='│'; |
||
53 | x2+=7; |
||
54 | width2-=7; |
||
55 | } |
||
56 | if(s1>0)&&(s2>0)&&(!strcmp(s1,s2)) |
||
57 | {//строки совпадают |
||
58 | for(i=0;i |
||
59 | if(i+linex |
||
60 | }else |
||
61 | { |
||
62 | for(i=0;i |
||
63 | { |
||
64 | if(i+linex |
||
65 | if(i+linex |
||
66 | str[x2+i]=c1; |
||
67 | if(c1==c2)attr[x2+i]=0x4F;else attr[x2+i]=0x4E; |
||
68 | } |
||
69 | } |
||
70 | } |
||
71 | printstrat(x,y,width,#str,#attr); |
||
72 | } |
||
73 | |||
74 | drawborder(dword x1,y1,xs1,ys1,fname,line) |
||
75 | char temp[MAX_PATH]; |
||
76 | int titlelen; |
||
77 | { |
||
78 | int i,j; |
||
79 | |||
80 | FillMemory(#str,xs1,'═'); |
||
81 | FillMemory(#attr,xs1*2,0x1F); |
||
82 | |||
83 | str[0]='╚'; str[xs1-1]='╝'; |
||
84 | printstrat(x1,y1+ys1-1,xs1,#str,#attr); //нижняя строчка |
||
85 | |||
86 | str[0]='╔'; str[xs1-1]='╗'; |
||
87 | titlelen=xs1-4; |
||
88 | if(!shownums)titlelen-=8; |
||
89 | if(strlen(fname)>titlelen)wsprintf(#temp," ...%s ",strlen(fname)+fname-titlelen+3); |
||
90 | else wsprintf(#temp," %s ",fname); |
||
91 | for(i=0;temp[i];i++){ str[i+1]=temp[i]; attr[i+1]=0x1E; } |
||
92 | if(!shownums) |
||
93 | { |
||
94 | wsprintf(#temp,"[%6d]",line); |
||
95 | CopyMemory(xs1-9+#str,#temp,8); |
||
96 | FillMemory(xs1-8*2+#attr,12,0x19); |
||
97 | } |
||
98 | printstrat(x1,y1,xs1,#str,#attr); |
||
99 | } |
||
100 | |||
101 | printpanel(dword line,linex ,x1,y1,xs1,ys1 ,x2,y2,xs2,ys2) |
||
102 | { |
||
103 | int i,j; |
||
104 | int s,d,sl,dl; |
||
105 | int line1,line2; |
||
106 | |||
107 | for(j=line;j |
||
108 | if(s==-1)s=srcfilelines.Count-1; |
||
109 | drawborder(x1,y1,xs1,ys1,srcfilename,s+1); |
||
110 | |||
111 | for(j=line;j |
||
112 | if(d==-1)d=dstfilelines.Count-1; |
||
113 | drawborder(x2,y2,xs2,ys2,dstfilename,d+1); |
||
114 | for(j=0;j |
||
115 | { |
||
116 | if(j+line |
||
117 | line1=s; |
||
118 | if(s!=-1)s=srcfilelines.At(s); |
||
119 | if(j+line |
||
120 | line2=d; |
||
121 | if(d!=-1)d=dstfilelines.At(d); |
||
122 | drawline(x1,y1+j+1,xs1,linex,s,d,line1); |
||
123 | drawline(x2,y2+j+1,xs2,linex,d,s,line2); |
||
124 | } |
||
125 | } |
||
126 | |||
127 | |||
128 | ifinit() |
||
129 | int linenum=0; |
||
130 | int linex=0; |
||
131 | int ys; |
||
132 | int sbi_x, sbi_y; |
||
133 | { |
||
134 | load_dll(libConsole, #con_init, 0); |
||
135 | con_init stdcall (122, 40, 122, 800, #window_title); |
||
136 | |||
137 | linenum=diffs.At(0); |
||
138 | |||
139 | sbi_x = 122; |
||
140 | sbi_y = 800; |
||
141 | |||
142 | sbi_y--; |
||
143 | ys=sbi_y-2; |
||
144 | |||
145 | if(linenum+ys>srcfilenums.Count)linenum=srcfilenums.Count-ys; |
||
146 | if(linenum<0) linenum=0; |
||
147 | |||
148 | @redraw: |
||
149 | if(!verthoriz) |
||
150 | { |
||
151 | printpanel(linenum,linex |
||
152 | ,0,0 |
||
153 | ,sbi_x/2 ,sbi_y |
||
154 | ,sbi_x/2 ,0 |
||
155 | ,sbi_x/2 ,sbi_y |
||
156 | ); |
||
157 | ys=sbi_y-2; |
||
158 | } |
||
159 | else |
||
160 | { |
||
161 | printpanel(linenum,linex |
||
162 | ,0,0 |
||
163 | ,sbi_x ,sbi_y/2 |
||
164 | ,0 ,sbi_y/2 |
||
165 | ,sbi_x ,sbi_y/2 |
||
166 | ); |
||
167 | if(sbi_y&1) |
||
168 | { |
||
169 | FillMemory(#str,sbi_x,'░'); |
||
170 | FillMemory(#attr,sbi_x*2,0); |
||
171 | printstrat(0,sbi_y-1,sbi_x,#str,#attr); |
||
172 | } |
||
173 | ys=sbi_y/2-2; |
||
174 | } |
||
175 | |||
176 | if (!ys) goto redraw; |
||
177 | else { |
||
178 | con_set_cursor_pos stdcall (2,0); |
||
179 | ExitProcess(); |
||
180 | } |
||
181 | }0)> |