3 source/calltips.c | 44 +++++++++++++++++++++-----------------------
4 source/calltips.h | 11 +++++------
5 2 files changed, 26 insertions(+), 29 deletions(-)
7 diff --quilt old/source/calltips.c new/source/calltips.c
8 --- old/source/calltips.c
9 +++ new/source/calltips.c
16 -static char* expandAllTabs(const char *text, const int tab_width);
17 -Boolean getRangeOfLine(const char* textString, const unsigned line,
18 - unsigned* begin, unsigned* end);
19 -Widget createTip(const Widget parent, const Pixel foreground,
20 - const Pixel background, const unsigned char alignment);
21 +static char *expandAllTabs(const char *text, int tab_width);
22 +Boolean getRangeOfLine(const char *textString, unsigned line,
23 + unsigned *begin, unsigned *end);
24 +Widget createTip(const Widget parent, Pixel foreground,
25 + Pixel background, unsigned char alignment);
28 ** Pop-down a calltip if one exists, else do nothing
30 void KillCalltip(WindowInfo *window, int calltipID) {
31 @@ -76,11 +76,11 @@ void TextDKillCalltip(textDisp *textD, i
33 ** Returns the calltip ID of the currently displayed calltip, or 0 if
34 ** there is no calltip displayed.
36 int GetCalltipID(const WindowInfo *window) {
37 - textDisp *textD = ((TextWidget)window->lastFocus)->text.textD;
38 + const textDisp *textD = ((TextWidget)window->lastFocus)->text.textD;
40 return textD->calltip.ID;
43 #define CALLTIP_EDGE_GUARD 5
44 @@ -186,29 +186,29 @@ void TextDRedrawCalltip(textDisp *textD,
45 ** a pointer to text if there were no tabs. Returns NULL on malloc failure.
46 ** Note that this is dumb replacement, not smart tab-like behavior! The goal
47 ** is to prevent tabs from turning into squares in calltips, not to get the
48 ** formatting just right.
50 -static char* expandAllTabs(const char* text, const int tab_width)
51 +static char *expandAllTabs(const char *text, int tab_width)
60 - for (c = (char*) text; *c; ++c) {
61 + for (c = text; *c; ++c) {
69 /* Allocate the new string */
70 len = strlen(text) + (tab_width - 1) * nTabs;
71 - textCpy = (char*) malloc(len + 1);
72 + textCpy = malloc(len + 1);
74 fprintf(stderr, "nedit: Out of heap memory in expandAllTabs!\n");
78 @@ -234,12 +234,11 @@ static char* expandAllTabs(const char* t
79 ** with the new calltip.
81 ** Returns the ID of the calltip or 0 on failure.
83 int ShowCalltip(const WindowInfo *window, const char *text,
84 - const Boolean anchored, const int pos, const int hAlign,
85 - const int vAlign, const int alignMode)
86 + Boolean anchored, int pos, int hAlign, int vAlign, int alignMode)
88 static unsigned StaticCalltipID = 1;
89 textDisp *textD = ((TextWidget)window->lastFocus)->text.textD;
92 @@ -331,19 +330,18 @@ int ShowCalltip(const WindowInfo *window
93 ** - The calltip ID given is invalid (CT_INVALID_ID).
94 ** - The user requested to remove all highlightings (CT_OK).
95 ** - The requested line is highlighted (CT_OK).
96 ** - The requested line is not in the provided text (CT_NOLINE).
98 -int HighlightCalltipLine(const WindowInfo* window, const int calltipID,
99 - const unsigned line)
100 +int HighlightCalltipLine(const WindowInfo *window, int calltipID, unsigned line)
102 - textDisp* textD = ((TextWidget) window->lastFocus)->text.textD;
103 + textDisp *textD = ((TextWidget) window->lastFocus)->text.textD;
104 Boolean result = False;
106 if (calltipID == textD->calltip.ID) {
107 Widget textWidget = textD->calltip.widget;
108 - char* textString = XmTextGetString(textWidget);
109 + char *textString = XmTextGetString(textWidget);
110 XmTextPosition textLength = XmTextGetLastPosition(textWidget);
111 unsigned begin = 0, end = 0;
112 Boolean lineIsValid = False;
114 /* First remove all existing highlights. */
115 @@ -375,12 +373,12 @@ int HighlightCalltipLine(const WindowInf
118 ** Sets the parameters to beginning and end of the line. Returns False if
119 ** the line is not in the text, True otherwise.
121 -Boolean getRangeOfLine(const char* textString, const unsigned line,
122 - unsigned* begin, unsigned* end)
123 +Boolean getRangeOfLine(const char *textString, unsigned line,
124 + unsigned *begin, unsigned *end)
129 for (i = 0; i < line; i++)
130 @@ -400,12 +398,12 @@ Boolean getRangeOfLine(const char* textS
134 ** Pop up a scroll calltip.
136 -Boolean ShowScrolltip(textDisp* textD, const char* text, const int x,
137 - const int y, int align)
138 +Boolean ShowScrolltip(textDisp* textD, const char *text, int x, int y,
143 if (NULL == textD->scrolltip) {
144 textD->scrolltip = createTip(textD->w, textD->calltipFGPixel,
145 @@ -431,11 +429,11 @@ Boolean ShowScrolltip(textDisp* textD, c
149 ** Pop down scrolltip if it exists
151 -void KillScrolltip(textDisp* textD)
152 +void KillScrolltip(textDisp *textD)
154 if (NULL != textD->scrolltip && NULL != XtParent(textD->scrolltip)) {
155 XtPopdown(XtParent(textD->scrolltip));
158 @@ -454,12 +452,12 @@ void KillScrolltip(textDisp* textD)
159 ** TODO: Some helper functions are still desirable to make this function
160 ** available from other parts of the code. At the moment the caller must
161 ** use calls to Motif/Intrinsics functions to handle it.
164 -Widget createTip(const Widget grandfather, const Pixel foreground,
165 - const Pixel background, const unsigned char alignment)
166 +Widget createTip(const Widget grandfather, Pixel foreground,
167 + Pixel background, unsigned char alignment)
173 diff --quilt old/source/calltips.h new/source/calltips.h
174 --- old/source/calltips.h
175 +++ new/source/calltips.h
176 @@ -40,18 +40,17 @@ enum TipVAlignMode {TIP_ABOVE, TIP_BELOW
177 enum TipAlignStrict {TIP_SLOPPY, TIP_STRICT};
178 enum TipHighlightError {CT_OK, CT_INVALID_ID, CT_NOLINE};
179 enum ScrollTipAlignMode {SCROLLTIP_LEFT, SCROLLTIP_RIGHT};
181 int ShowCalltip(const WindowInfo *window, const char *text,
182 - const Boolean anchored, const int pos, const int hAlign,
183 - const int vAlign, const int alignMode);
184 + Boolean anchored, int pos, int hAlign, int vAlign, int alignMode);
185 void KillCalltip(WindowInfo *window, int calltipID);
186 -Boolean ShowScrolltip(textDisp* textD, const char* text, const int x,
187 - const int y, int align);
188 +Boolean ShowScrolltip(textDisp *textD, const char *text, int x, int y,
190 void KillScrolltip(textDisp* textD);
191 void TextDKillCalltip(textDisp *textD, int calltipID);
192 int GetCalltipID(const WindowInfo *window);
193 void TextDRedrawCalltip(textDisp *textD, int calltipID);
194 -int HighlightCalltipLine(const WindowInfo* window, const int calltipID,
195 - const unsigned line);
196 +int HighlightCalltipLine(const WindowInfo *window, int calltipID,
199 #endif /* ifndef NEDIT_CALLTIPS_H_INCLUDED */