-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKMCTEXT.c
94 lines (87 loc) · 2.84 KB
/
PKMCTEXT.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
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
#include "PKIN.h"
/****pkintextinsert()******************************************************/
void pkintextinsert(char string[256])
{
if (Lquiet == 0)
{
TEInsert(string,strlen(string), textText);
mactextselect = (*textText)->selEnd;
}
}
/*___pkintextinsert()_____________________________________________________*/
/****inserttexts()******************************************************/
void inserttexts(char string[256], int replace)
{
if (Lquiet == 0)
{
replace = replace;
TEInsert(string,strlen(string), textText);
}
}
/*___inserttexts()_____________________________________________________*/
/****pkintextreplace()******************************************************/
void pkintextreplace(char string[256])
{
long newend;
if (Lquiet == 0)
{
newend = (*textText)->selEnd;
TESetSelect(mactextselect,newend,textText);
TEDelete(textText);
TEInsert(string,strlen(string), textText);
}
}
/*___pkintextreplace()_____________________________________________________*/
/****getmactextselect()******************************************************/
void getmactextselect(void)
{
if (Lquiet == 0)
{
mactextselect = (*textText)->selEnd;
}
}
/*___getmactextselect()_____________________________________________________*/
/****adjusttext()************************************************************/
void adjusttext(int iforce)
/*must call this with iforce==0 before iforce==1 to get calc right*/
{
if (Lquiet == 0)
{
if (iforce > 0)
{
if(thenoldLines+iforce >= theviewLines) /* would be off the bottom now*/
{/*force a scroll if line would be off bottom from earlier calculation*/
/*m*/ TEScroll(0,-(iforce*textHeight),textText);
/* scroll iforce number of lines */
/*m*/ SetControlValue(vtextScroll,maxValue);
}
thenoldLines = thenoldLines + iforce;
}
else /*calculate number of lines needed for a scroll to stay on screen*/
{
/*m*/ TECalText(textText);
thenLines = (*textText)->nLines; /* total lines of text */
thendiff = thenLines - thenoldLines;
/*number of lines moved since last adjustment*/
theviewLines = (textdRect.bottom - textdRect.top)/textHeight;
/* lines viewed in window */
thenoldLines = thenLines;
if (thenLines >= (theviewLines))
{
/*m*/ TEScroll(0,-(thendiff*textHeight),textText); /* scroll ndiff lines */
/*m*/ SetControlValue(vtextScroll,maxValue);
}
}
}
}
/*___adjusttext()___________________________________________________________*/
/****cleanuptextwindow()*****************************************************/
void cleanuptextwindow()
{
if (Lquiet == 0)
{
settextTextarea();
}
}
/*___cleanuptextwindow()____________________________________________________*/