forked from bakagirl/Arachne-WWW-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUIDRAW.C
1237 lines (1103 loc) · 27.1 KB
/
GUIDRAW.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ========================================================================
// GRAPHICAL USER INTERFACE for Arachne WWW browser - GUI init & redraw
// (c)1997,1998,1999,2000 Michael Polak, Arachne Labs
// ========================================================================
#include "arachne.h"
#include "html.h"
#include "gui.h"
#include "customer.h"
#define MOUSEPIX 4
//customizable toolbar icons:
void toolbar(char newtoolbarmode,char forced)
{
#ifndef CUSTOMER
focusedatom=activeadr;
if(toolbarmode==newtoolbarmode && forced)
return;
mouseoff();
toolbarmode=newtoolbarmode;
if(arachne.GUIstyle!=STYLE_SMALL1 && arachne.GUIstyle!=STYLE_SMALL2
&& !fullscreen && !customerscreen)
{
if(arachne.GUIstyle || x_maxx()<640)
{
Box3D(450,0,x_maxx()-152,48);
if(!user_interface.iconsoff && toolbarmode==0)
{
int iconx=452,icony=3,iconcount=1;
char icon[9],dummy[80],iconkey[5];
while(iconx<x_maxx()-184)
{
sprintf(iconkey,"H?%d",iconcount++);
if(toolbarpage)
iconkey[1]=toolbarpage;
else if(tcpip)
iconkey[1]='I';
else
iconkey[1]='D';
if(geticoninfo(iconkey,icon,dummy,dummy,dummy,dummy))
{
if(icon[0]=='*')
{
x_setcolor(0);
htmlfont(1,0);
x_settextjusty(1,1);
x_text_ib(iconx+17,icony+10,(unsigned char *)&icon[1]);
}
else
DrawIconLater( icon, iconx,icony);
}
if(icony==27)
iconx+=32;
icony=30-icony; //3 or 27
}
}
else
if(toolbarmode)
{
DrawIconLater( "SMALL2", 452,3);
DrawIconLater( "SMALL1", 452,27);
if(x_maxx()>=640)
{
DrawIconLater( "BLK_CUT",484,3);
DrawIconLater( "BLK_CLIP",484,27);
DrawIconLater( "BLK_PAST",516,3);
DrawIconLater( "BLK_COPY",516,27);
DrawIconLater( "BLK_MOVE",548,3);
DrawIconLater( "BLK_DEL",548,27);
DrawIconLater( "SMALL4",580,3);
//DrawIconLater( "SMALL3",580,27);
}
}//end if
#ifdef AGB
if(x_maxx()>640)
{
htmlfont(5,BOLD|ITALIC);
x_setcolor(3);
x_text_ib(endicons+5,5,(unsigned char *)"Agrobanka");
x_line(endicons+5,30,x_maxx()-156,30);
htmlfont(1,ITALIC);
x_setcolor(0);
x_text_ib(endicons+5,30,(unsigned char *)"A GE Capital Company");
}
#endif
}
else
{
Box3D(x_maxx()-150,250,x_maxx()-1,endvtoolbar());
htmlfont(1,0);
if(toolbarmode==0)
{
int icony=253,iconcount=1;
char icon[9],dummy[80],desc1[40],desc2[10],iconkey[5];
while(icony<endvtoolbar()-20)
{
sprintf(iconkey,"V?%d",iconcount++);
if(toolbarpage)
iconkey[1]=toolbarpage;
else if(tcpip)
iconkey[1]='I';
else
iconkey[1]='D';
if(geticoninfo(iconkey,icon,dummy,dummy,desc1,desc2))
{
if(!user_interface.iconsoff && icon[0]!='*')
DrawIconLater( icon,x_maxx()-148,icony);
x_setcolor(0);
x_text_ib(x_maxx()-114,icony+2,(unsigned char *)desc1);
x_settextjusty(2,2);
x_text_ib(x_maxx()-6,icony+2,(unsigned char *)desc2);
x_settextjusty(0,2); // vzdycky psat pismo od leveho horniho rohu
}
icony+=18;
}
}
else
{
DrawIconLater( "SMALL2",x_maxx()-148,253);
DrawIconLater( "SMALL1",x_maxx()-148,271);
DrawIconLater( "BLK_CUT",x_maxx()-148,289);
DrawIconLater( "BLK_CLIP",x_maxx()-148,307);
DrawIconLater( "BLK_PAST",x_maxx()-148,325);
DrawIconLater( "BLK_COPY",x_maxx()-148,343);
DrawIconLater( "BLK_MOVE",x_maxx()-148,361);
DrawIconLater( "BLK_DEL",x_maxx()-148,379);
DrawIconLater( "SMALL4",x_maxx()-148,397);
//DrawIconLater( "SMALL3",x_maxx()-148,415);
x_setcolor(0);
x_text_ib(x_maxx()-114,255,(unsigned char *)MSG_WRITEF);
x_text_ib(x_maxx()-114,273,(unsigned char *)MSG_READF);
x_text_ib(x_maxx()-114,291,(unsigned char *)MSG_BLKCUT);
x_text_ib(x_maxx()-114,309,(unsigned char *)MSG_BLKCLP);
x_text_ib(x_maxx()-114,327,(unsigned char *)MSG_BLKPST);
x_text_ib(x_maxx()-114,345,(unsigned char *)MSG_BLKCOP);
x_text_ib(x_maxx()-114,363,(unsigned char *)MSG_BLKMOV);
x_text_ib(x_maxx()-114,381,(unsigned char *)MSG_BLKDEL);
x_text_ib(x_maxx()-114,399,(unsigned char *)MSG_SRCH4);
//x_text_ib(x_maxx()-114,417,(unsigned char *)MSG_PRT);
x_settextjusty(2,2);
x_text_ib(x_maxx()-6,255,(unsigned char *)"Ctrl+W");
x_text_ib(x_maxx()-6,273,(unsigned char *)"Ctrl+R");
x_text_ib(x_maxx()-6,291,(unsigned char *)"Ctrl+X");
x_text_ib(x_maxx()-6,309,(unsigned char *)"Ctrl+C");
x_text_ib(x_maxx()-6,327,(unsigned char *)"Ctrl+V");
x_text_ib(x_maxx()-6,345,(unsigned char *)"Ctrl+K,C");
x_text_ib(x_maxx()-6,363,(unsigned char *)"Ctrl+K,M");
x_text_ib(x_maxx()-6,381,(unsigned char *)"Ctrl+K,Y");
x_text_ib(x_maxx()-6,399,(unsigned char *)"Ctrl+Q");
//x_text_ib(x_maxx()-6,417,(unsigned char *)"Ctrl+P");
x_settextjusty(0,2); // vzdycky psat pismo od leveho horniho rohu
}
}
}
#endif //CUSTOMER
DrawIcons();
mouseon();
x_settextjusty(0,2); // vzdycky psat pismo od leveho horniho rohu
}
//big icons
void buttons(void)
{
if(fullscreen)
return;
if(customerscreen)
{
#ifdef CUSTOMER_MODULE
customer_draw();
DrawIcons();
#endif
return;
}
#ifndef CUSTOMER
if(arachne.GUIstyle==STYLE_SMALL1)
{
DrawIconLater( "alticon1",4,3 );
DrawIconLater( "alticon2",x_maxx()-146,3 );
Box3Dh(0,p->htscrn_ytop-25,150,p->htscrn_ytop-2);
Box3Dh(x_maxx()-150,p->htscrn_ytop-25,x_maxx(),p->htscrn_ytop-2);
}
else
if(arachne.GUIstyle==STYLE_SMALL2)
{
if(!user_interface.iconsoff)
{
DrawIconLater( "alticon2",x_maxx()-146,4 );
DrawIconLater( "alticon1",x_maxx()-146,27 );
}
Box3Dh(x_maxx()-150,p->htscrn_ytop-50,x_maxx(),p->htscrn_ytop-2);
}
else
if(arachne.GUIstyle || x_maxx()<640)
{
//char str[10];
DrawIconLater( "buttons1",0,0 );
DrawIconLater( "buttons2",150,0 );
DrawIconLater( "buttons3",300,0 );
}
else //toolbar on the right side
{
//char str[10];
DrawIconLater( "buttons1",x_maxx()-150,100 );
DrawIconLater( "buttons2",x_maxx()-150,150 );
DrawIconLater( "buttons3",x_maxx()-150,200 );
//menu
}
toolbar(0,0);
#endif //CUSTOMER
}
void GUIInit(void) // inicializace mysi, etc.
{
if(!mousex && !mousey ||
mousex>x_maxx()-MOUSEPIX ||
mousey>x_maxy()-MOUSEPIX)
{
mousex=x_maxx()/2;
mousey=x_maxy()/2;
}
ImouseIni( 0, 0, x_maxx()-MOUSEPIX, x_maxy()-MOUSEPIX, mousex , mousey );
ImouseRead(&mousex,&mousey);
mouseon();
}
#ifndef CUSTOMER
int bannerwidth=0;
char *gettitle(char *buf)
{
#ifdef TELEMED
char *title=configvariable(&ARACHNEcfg,"MainBanner",NULL);
#else
char *title=buf;
strcpy(title,"Arachne ");
strcat(title,VER);
#endif // TELEMED
htmlfont(3,BOLD);
bannerwidth=x_txwidth (title);
return title;
}
#endif //CUSTOMER
void PaintTitle(void) // vykresleni nazvu stranky
{
#ifndef CUSTOMER
if(fullscreen || customerscreen)
return;
mouseoff();
if(arachne.GUIstyle==STYLE_SMALL1)
{
Box3Dh(152,p->htscrn_ytop-25,x_maxx()-152,p->htscrn_ytop-2);
DrawIconLater( "SMALL_WM",x_maxx()-187,p->htscrn_ytop-22);
URLprompt.xx=x_maxx()-192-user_interface.scrollbarsize;
if(user_interface.scrollbarsize>3)
Scratch3D(URLprompt.xx+3,p->htscrn_ytop-14,URLprompt.xx+user_interface.scrollbarsize-2);
}
else
{
//!!glennmcc: Begin Jan 20, 2006
// 4 choices at build-time for 'Arachne ver#' color/style
int colormap[5]={15,-1,-1,7,8};//high-contrast raised
//int colormap[5]={7,-1,-1,15,8};//high-contrast indented
//int colormap[5]={15,-1,-1,8,7};//low-contrast raised
//int colormap[5]={8,-1,-1,15,7};//low_contrast indented
//!!glennmcc: end
//int colormap[5]={8,-1,-1,15,7};//original line
//!!glennmcc: Mar 15, 2006 -- inserted description & short color list
/*
{15,-1,-1,7,8};//high-contrast raised
_^^<--top_edge/left_edge color
{15,-1,-1,7,8}
__________^<--bottom_edge/right_edge color
{15,-1,-1,7,8}
____________^<--fill color
0 BLACK
7 LIGHTGRAY
8 DARKGRAY
15 WHITE
*/
//!!glennmcc: end
char buf[64];
char *title;
Box3D(0,p->htscrn_ytop-50,x_maxx()-152,p->htscrn_ytop-27);
DrawIconLater( "SMALL_WM",x_maxx()-187,p->htscrn_ytop-46);
if(fonty(SYSFONT,0)<=16)
{
Box3D(0,p->htscrn_ytop-25,x_maxx()-152,p->htscrn_ytop-2);
URLprompt.xx=x_maxx()-152-user_interface.scrollbarsize;
if(user_interface.scrollbarsize>3)
Scratch3D(URLprompt.xx+3,p->htscrn_ytop-13,x_maxx()-155);
}
else
{
Box3D(0,p->htscrn_ytop-25,48,p->htscrn_ytop-2);
URLprompt.xx=x_maxx()-152;
}
x_setcolor(0);
title=gettitle(buf);
decorated_text(10,p->htscrn_ytop-47,MSG_TITLE,colormap);
decorated_text(10,p->htscrn_ytop-22,"URL",colormap);
x_settextjusty(2,2);
decorated_text(x_maxx()-192,p->htscrn_ytop-47,title,colormap);
x_settextjusty(0,2); // vzdycky psat pismo od leveho horniho rohu
x_setcolor(0);
}
#endif //CUSTOMER
}
void PaintStatus(void)
{
#ifndef AGB
#ifdef CUSTOMER
Box3D(0,x_maxy()-15,x_maxx(),x_maxy());
#else
Box3D(0,x_maxy()-15,x_maxx()-152,x_maxy());
#endif // CUSTOMER
#else
Box3D(0,x_maxy()-15,x_maxx(),x_maxy());
#endif // AGB
}
void RedrawALL() // redraw entire user interface
{
char oldshift=user_interface.fontshift;
user_interface.fontshift=0;
global_nomouse=1;
//
//turn on special XSWAP optimization for speed
swapoptimize=1;
InitIcons();
resetcolorcache();
xChLogo('0');
if(!noGUIredraw)
{
PaintTitle();
buttons();
}
else
{
if(arachne.GUIstyle==STYLE_SMALL1)
URLprompt.xx=x_maxx()-192-user_interface.scrollbarsize;
else
if(fonty(SYSFONT,0)<=16)
URLprompt.xx=x_maxx()-152-user_interface.scrollbarsize;
else
URLprompt.xx=x_maxx()-192-user_interface.scrollbarsize;
}
user_interface.fontshift=oldshift;
PaintStatus();
defaultmsg();
statusmsg();
MemInfo(NORMAL);
noGUIredraw=0;
global_nomouse=0;
lasthisx=-1;
//turn on special XSWAP optimization for speed
swapoptimize=0;
}
void ChangeZoom(char style, char plus, char minus)
{
char *ptr=strchr(arachne.graphics,'.');
//!!glennmcc: Feb 17, 2005 -- to prevent going over MaxRes
char *maxres=configvariable(&ARACHNEcfg,"MaxRes",NULL);
//!!glennmcc: end
mouseoff();
//1. 800x600 or more na vysku -> 2.
//2. 800x600 or more na sirku -> 3.
//3. 600x480 -> 1.
if(style)
{
arachne.GUIstyle++;
#ifdef CAV
if(arachne.GUIstyle==2) arachne.GUIstyle=3;
#endif
if(arachne.GUIstyle>STYLE_SMALL2)
{
arachne.GUIstyle=STYLE_ARACHNE;
if(!ptr || ptr[1]!='A' && ptr[1]!='C' && ptr[1]!='E' && ptr[1]!='J' && ptr[1]!='K' && ptr[1]!='L' && ptr[1]!='M')
arachne.GUIstyle++;
}
x_cleardev();
}
else if(!ptr)
return;
else
{
if(plus) // prepni na vyssi rozlisnei
{
if(!strncmpi(arachne.graphics,"VESA.X",6)) //X==640x400x256c
ptr[1]='B'; //B==640x480x256c
else if(ptr[1]=='B' && *maxres>'1')
ptr[1]='C'; //C==800x600x256c
else if(ptr[1]=='C' && *maxres>'2')
ptr[1]='E'; //E==1024x768x256c
#ifdef HICOLOR
//I==640x480xHiColor
else if(ptr[1]=='I' && *maxres>'1')
ptr[1]='J'; //J==800x600xHiColor
else if(ptr[1]=='J' && *maxres>'2')
ptr[1]='K'; //K==1024x768xHiColor
else if(ptr[1]=='K' && *maxres>'3')
ptr[1]='L'; //L==1280x1024xHiColor
else if(ptr[1]=='L' && *maxres>'4')
ptr[1]='M'; //M==1600x1200xHiColor
#endif
}
else if(minus) // prepni na nizsi rozlisnei
{
if(ptr[1]=='E') //E==1024x768x256c
ptr[1]='C'; //C==800x600x256c
else if(ptr[1]=='C')
ptr[1]='B'; //B==640x480x256c
#ifdef HICOLOR
else if(ptr[1]=='M') //M==1600x1200xHiColor
ptr[1]='L';
else if(ptr[1]=='L') //L==1280x1024xHiColor
ptr[1]='K';
else if(ptr[1]=='K') //K==1024x768xHiColor
ptr[1]='J';
else if(ptr[1]=='J') //J==800x600xHiColor
ptr[1]='I'; //I==640x480xHiColor
#endif
#ifndef ERIC
else if(!strncmpi(arachne.graphics,"VESA.B",6))
ptr[1]='X';//X==640x400x256c
#endif
}
graphicsinit(arachne.graphics); // XLOPIF SVGA GRAPHICS
}
lastonbutton=-1;
zoom();
lastonbutton=0;
arachne.target=0; //frameset homepage will be reloaded....
RedrawALL();
GUIInit();
#ifdef POSIX
configvariable(&ARACHNEcfg,"GraphicsMode",arachne.graphics);
ie_savef(&ARACHNEcfg);
#else
savepick();
#endif
GLOBAL.nothot=1;
GLOBAL.needrender=1;
GLOBAL.validtables=0; //tabulky je potreba prepocitat!!!
}
void statusmsg(void)
{
#ifndef CUSTOMER
#ifndef AGB
#ifndef CALDERA
char *msg;
if(fullscreen)
return;
mouseoff();
Box3D(x_maxx()-150,x_maxy()-15,x_maxx(),x_maxy());
x_setcolor(0);
//!!glennmcc: Aug 22, 2005
//prevent fontshift from causing regkey to over-run the online timer
htmlfont(1-user_interface.fontshift,0);
// htmlfont(1,0);
x_text_ib(x_maxx()-146,x_maxy()-15,(unsigned char *)regkey);
if(httpstub)
{
x_setcolor(1); //blue
msg="http/stub";
}
else if(tcpip>0)
{
x_setcolor(3); //green
msg="TCP/IP";
}
else
{
x_setcolor(8); //dark grey
msg="OFFLINE";
}
x_settextjusty(2,2);
// x_text_ib(x_maxx()-29,x_maxy()-15,(unsigned char *)msg);
x_text_ib(x_maxx()-4,x_maxy()-15,(unsigned char *)msg);
x_settextjusty(0,2); // vzdycky psat pismo od leveho horniho rohu
mouseon();
#endif // CALDERA
#endif // AGB
#endif //CUSTOMER
}
//===========================================================================
//imlementation of line redraw for ib_editor's ie_* family of functions...
//===========================================================================
void ie_redrawline(struct ib_editor *fajl,int x1,int y1, int zoomx, int width,int i)
{
char *ptr,txt[160];
int l;
int bbx,bex,bby,bey,block=0;
if(width>=160)width=159;
//memset(txt,' ',width);
if(fajl->blockflag==2 && i>=fajl->bby && (i<fajl->bey || i==fajl->bey && fajl->bex>0))
{
block=1;
bbx=fajl->bbx;
bby=fajl->bby;
bex=fajl->bex;
bey=fajl->bey;
}
if(i<fajl->lines)
{
if(fajl->aktrad==i)
{
l=strlen(fajl->rad)-zoomx;
if(l>0)
{
if(l>=160)l=159;
strncpy(txt,&fajl->rad[zoomx],l);
}
else
l=0;
}
else
{
ptr=ie_getswap(getXSWAPlineadr(fajl,i));
l=strlen(ptr)-zoomx;
if(ptr && l>0)
{
if(l>=160)l=159;
strncpy(txt,&ptr[zoomx],l);
}
else
l=0;
}
}
else
l=0;
if(l>0 && txt[l-1]=='\r')
l--;
if(width>l)
memset(&txt[l],' ',width-l);
txt[width]='\0';
htmlfont(SYSFONT,0);
if(fonty(SYSFONT,0)!=14)
y1-=1;
if(!block || bbx>0 || bex<=l)
{
x_setcolor(user_interface.ink);
x_setfill(0,user_interface.paper);
}
else
{
x_setcolor(BLOCK_INK);
x_setfill(0,BLOCK_PAPER);
}
if(!xg_video_XMS)
x_charmod(0);
x_text_ib(x1,y1,(unsigned char *)txt);
if(block && (bbx-zoomx>0 || bex-zoomx<=l))
{
char *ptr=txt;
int xshift=0;
if(bby==i && bbx-zoomx>0)
{
xshift=bbx-zoomx;
ptr=&txt[xshift];
}
if(bey==i && bex-zoomx<=l && bex-zoomx>0)
txt[bex-zoomx]='\0';
x_setcolor(BLOCK_INK);
x_setfill(0,BLOCK_PAPER);
x_text_ib(x1+space(SYSFONT)*xshift,y1,(unsigned char *)ptr);
}
if(!xg_video_XMS)
x_charmod(1);
}//end sub
//===========================================================================
//imlementation of window redraw for ib_editor's ie_* family of functions...
int ie_redrawwin(struct ib_editor *fajl,int x1,int y1, int x2, int y2,char allowkey)
//===========================================================================
{
int i=0,max;
int width,y;
// int dummyx,dummyy;
if(fajl->x-fajl->zoomx>(x2-x1)/fontx(SYSFONT,0,' '))
fajl->zoomx=fajl->x-(x2-x1)/fontx(SYSFONT,0,' ');
if(fajl->y-fajl->zoomy>(y2-y1)/fonty(SYSFONT,0))
fajl->zoomy=fajl->y-(y2-y1)/fonty(SYSFONT,0);
width=(x2-x1)/fontx(SYSFONT,0,' ');
if(width>=160)width=159;
//prekresleni...
max=(y2-y1)/fonty(SYSFONT,0);
y=y1;
while(i<max)
{
ie_redrawline(fajl,x1,y,fajl->zoomx,width,i+fajl->zoomy);
i++;
y+=fonty(SYSFONT,0);
if(allowkey)
{
int dummy;
wheelqueue=ImouseRead(&dummy,&dummy)>>8; //gui.h variable
if(wheelqueue || bioskey(1)) //key pressed or mouse wheel moved
{
ie_redrawline(fajl,x1,y1+(fajl->y-fajl->zoomy)*fonty(SYSFONT,0),fajl->zoomx,width,fajl->y);
atomneedredraw=1;
return 1; //nedokoncene prekreslovani !!!
}//endif
}
}//loop
return 0;
}//end sub
//===========================================================================
//output single line of drop-down meny (<OPTION> tag...)
void putoptionline(int x,int y,int limit,struct ib_editor *fajl,int line,char multi)
//===========================================================================
{
char *val=ie_getline(fajl,line);
char str[IE_MAXLEN+2],on=0;
int charlim;
if(*val=='1')
on=1;
x_setcolor(0); //black (tlacitko)
htmlfont(OPTIONFONT,0);
strcpy(str,ie_getline(fajl,line+1));
charlim=x_charmax((unsigned char *)str,limit);
if(charlim<0 || charlim>IE_MAXLEN)
charlim=0;
str[charlim]='\0';
/*if(fonty(SYSFONT,0)!=14)
y-=1;*/
x_text_ib(x+space(SYSFONT)+4,y,(unsigned char *)str);
if(on)
{
if(multi)
Cross(x+2,y+4,space(SYSFONT)-2);
else
{
x_setfill(0,0);
x_bar(x+3,y+4,x+space(SYSFONT)-1,y+fonty(OPTIONFONT,0)-6);
}
}
}
void DrawTitle(char force) // vykresleni nazvu stranky
{
int l;
char str[256];
char *titleptr;
if(fullscreen || customerscreen)
return;
#ifndef CUSTOMER
mouseoff();
drawatom(&URLprompt,0u,0,p->htscrn_xsize,p->htscrn_ysize,p->htscrn_xtop,p->htscrn_ytop);
activeatomptr=NULL; //pod mysi neni nic
if(title_ok && !force)
return;
x_setfill(0,7);
x_setcolor(0);
if(!bannerwidth)
{
char buf[64];
gettitle(buf);
}
//!!glennmcc: Aug 22, 2005 -- maintain size independant of fontshift
if(user_interface.fontshift<0) htmlfont(3+user_interface.fontshift,0); else
htmlfont(3-user_interface.fontshift,0);
// htmlfont(3,0);
if(arachne.GUIstyle==STYLE_SMALL1)
{
x_bar(156,p->htscrn_ytop-22,x_maxx()/2-(x_maxx()-300)/6-1,p->htscrn_ytop-5);
l=x_charmax((unsigned char *)arachne.title,(x_maxx()-300)/3-12);
}
else
{
x_bar(50,p->htscrn_ytop-47,x_maxx()-196-bannerwidth,p->htscrn_ytop-29);
l=x_charmax((unsigned char *)arachne.title,x_maxx()-266-bannerwidth);
}
if(l<strlen(arachne.title))
{
titleptr=str;
makestr(titleptr,arachne.title,l);
strcat(titleptr,"...");
}
else
titleptr=arachne.title;
x_settextjusty(0,1); // na stred!
if(arachne.GUIstyle==STYLE_SMALL1)
x_text_ib(156,p->htscrn_ytop-12,(unsigned char *)titleptr);
else
x_text_ib(50,p->htscrn_ytop-37,(unsigned char *)titleptr);
x_settextjusty(0,2); // vzdycky psat pismo od leveho horniho rohu
mouseon();
#endif //CUSTOMER
title_ok=1;
#ifdef GGI
Smart_ggiFlush();
#endif
}
#ifndef XTVERSION
// Only for overlay, when the mouse on a button, it pops up a little to indicate that it is active
void hidehighlight(void)
{
if((lastonbutton>9 && lastonbutton<CLICK_SPECIAL || htmlpulldown ||
arachne.GUIstyle==STYLE_SMALL1 || arachne.GUIstyle==STYLE_SMALL2)
&& lasthisx>=0)
{
mouseoff();
x_setcolor(7);
x_rect(lasthisx,lasthisy,lasthisxx,lasthisyy);
mouseon();
lasthisx=-1;
#ifdef GGI
Forced_ggiFlush();
#endif
}
}
void showhighlight(void)
{
mouseoff();
lasthisx=thisx;
lasthisy=thisy;
lasthisxx=thisxx-3;
lasthisyy=thisyy-3;
x_setcolor(15);
x_line(lasthisx,lasthisy,lasthisxx,lasthisy);
x_line(lasthisx,lasthisy,lasthisx,lasthisyy);
x_setcolor(8);
x_line(lasthisxx,lasthisy,lasthisxx,lasthisyy);
x_line(lasthisx,lasthisyy,lasthisxx,lasthisyy);
mouseon();
#ifdef GGI
Forced_ggiFlush();
#endif
}
void onlinehelp(int b)
{
hidehighlight();
if(b>9 && b<CLICK_SPECIAL && toolbarmode==0)
{
//custozmizable Arachne toolbar
char iconkey[5],dummy[80],desc1[40],desc2[10];
sprintf(iconkey,"??%d",b/10);
if(arachne.GUIstyle || x_maxx()<640)
iconkey[0]='H';
else
iconkey[0]='V';
if(toolbarpage)
iconkey[1]=toolbarpage;
else if(tcpip)
iconkey[1]='I';
else
iconkey[1]='D';
if(geticoninfo(iconkey,dummy,dummy,dummy,desc1,desc2))
{
showhighlight();
if(desc2[0])
{
sprintf(dummy,"%s (hotkey: %s)",desc1,desc2);
outs(dummy);
}
else
outs(desc1);
return;
}
b=0;
}
if((arachne.GUIstyle==STYLE_SMALL1 || arachne.GUIstyle==STYLE_SMALL2) &&
(b>0 && b<10 ||
b==CLICK_NETHOME || b==CLICK_IMAGES || b==CLICK_MAIL || b==CLICK_SAVE || b==CLICK_DESKTOP))
showhighlight();
switch(b)
{
case 1:
outs(MSG_ICON1);
break;
case 2:
outs(MSG_ICON2);
break;
case 3:
outs(MSG_ICON3);
break;
case 4:
outs(MSG_ICON4);
break;
case 5:
outs(MSG_ICON5);
break;
case 6:
outs(MSG_ICON6);
break;
case 7:
outs(MSG_ICON7);
break;
case 8:
outs(MSG_ICON8);
break;
case 9:
outs(MSG_ICON9);
break;
case CLICK_MAIL:
outs(MSG_MAIL);
break;
case CLICK_SAVE:
outs(MSG_SAVE);
break;
case CLICK_NETHOME:
outs(homepage);
break;
case CLICK_HISTORY:
outs(MSG_ICONH);
break;
case CLICK_ZOOM:
outs(MSG_ZOOM);
break;
//!!glennmcc: Sep 30, 2005
//moveing 'Up one Level' function to 'URL' instead of 'Arachne ver#'
//still will go up only when remote.. nothing will happen when local
//!!glennmcc: Feb 03, 2005 -- up one level if remote 'about:' if local
case CLICK_UPLEVEL:
if(!strstr(GLOBAL.location,"file:"))
{
outs("Up one level");
break;
}
else
// outs("about:");
break;
//!!glennmcc: end
case CLICK_ABOUT:
outs("about:");
break;
case CLICK_EXIT:
#ifdef CUSTOMER
outs("Start Windows"); //for Vadem/Infolio - InstOn/FirstLook/whatevver
#else
outs(MSG_EXIT);
#endif
break;
case CLICK_IMAGES:
outs(MSG_IMAGES);
break;
case CLICK_DESKTOP:
outs(MSG_HOME);
break;
#ifndef AGB
case CLICK_MEMINFO:
outs(MSG_INFO2);
break;
case CLICK_TCPIP:
outs(MSG_DIAL2);
break;
/*
case 10:
outs(MSG_SAVE);
break;
case 20:
outs(MSG_OPEN);
break;
case 30:
outs(MSG_PRINT);
break;
case 40:
outs(MSG_SEARCH);
break;
case 50:
outs(MSG_EDIT);
break;
case 60:
outs(MSG_SOURCE);
break;
case 70:
outs(MSG_INFO);
break;
case 80:
outs(MSG_IMAGES);
break;
case 90:
outs(MSG_MAIL);
break;
case 100:
outs(MSG_HOME);
break;
*/
//textarea toolbar:
case 10:
showhighlight();
outs(MSG_WRITEF);
break;
case 20:
showhighlight();
outs(MSG_READF);
break;
case 30:
showhighlight();
outs(MSG_BLCUT);
break;
case 40:
showhighlight();
outs(MSG_BLCLIP);
break;
case 50:
showhighlight();
outs(MSG_BLPAST);
break;
case 60:
showhighlight();
outs(MSG_BLKCOP);
break;
case 70:
showhighlight();