1 /* Specific command window processing.
2 Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Hewlett-Packard Company.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
29 /*****************************************
30 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
31 ******************************************/
35 /*****************************************
36 ** PUBLIC FUNCTIONS **
37 ******************************************/
40 ** tuiDispatchCtrlChar().
41 ** Dispatch the correct tui function based upon the control character.
48 tuiDispatchCtrlChar (ch
)
52 TuiWinInfoPtr winInfo
= tuiWinWithFocus ();
55 ** If the command window has the logical focus, or no-one does
56 ** assume it is the command window; in this case, pass the
57 ** character on through and do nothing here.
59 if (winInfo
== (TuiWinInfoPtr
) NULL
|| winInfo
== cmdWin
)
63 unsigned int c
= 0, chCopy
= ch
;
67 /* If this is an xterm, page next/prev keys aren't returned
68 ** by keypad as a single char, so we must handle them here.
69 ** Seems like a bug in the curses library?
71 term
= (char *) getenv ("TERM");
72 for (i
= 0; (term
&& term
[i
]); i
++)
73 term
[i
] = toupper (term
[i
]);
74 if ((strcmp (term
, "XTERM") == 0) && m_isStartSequence (ch
))
76 unsigned int pageCh
= 0, tmpChar
;
79 while (!m_isEndSequence (tmpChar
))
81 tmpChar
= (int) wgetch (cmdWin
->generic
.handle
);
86 else if (tmpChar
== 54)
95 tuiScrollForward (winInfo
, 0);
98 tuiScrollBackward (winInfo
, 0);
102 tuiScrollForward (winInfo
, 1);
106 tuiScrollBackward (winInfo
, 1);
109 tuiScrollLeft (winInfo
, 1);
112 tuiScrollRight (winInfo
, 1);
123 } /* tuiDispatchCtrlChar */
127 ** tuiIncrCommandCharCountBy()
128 ** Increment the current character count in the command window,
129 ** checking for overflow. Returns the new value of the char count.
133 tuiIncrCommandCharCountBy (
136 tuiIncrCommandCharCountBy (count
)
142 if ((count
+ cmdWin
->detail
.commandInfo
.curch
) >= cmdWin
->generic
.width
)
143 cmdWin
->detail
.commandInfo
.curch
=
144 (count
+ cmdWin
->detail
.commandInfo
.curch
) - cmdWin
->generic
.width
;
146 cmdWin
->detail
.commandInfo
.curch
+= count
;
149 return cmdWin
->detail
.commandInfo
.curch
;
150 } /* tuiIncrCommandCharCountBy */
154 ** tuiDecrCommandCharCountBy()
155 ** Decrement the current character count in the command window,
156 ** checking for overflow. Returns the new value of the char count.
160 tuiDecrCommandCharCountBy (
163 tuiDecrCommandCharCountBy (count
)
169 if ((cmdWin
->detail
.commandInfo
.curch
- count
) < 0)
170 cmdWin
->detail
.commandInfo
.curch
=
171 cmdWin
->generic
.width
+ (cmdWin
->detail
.commandInfo
.curch
- count
);
173 cmdWin
->detail
.commandInfo
.curch
-= count
;
176 return cmdWin
->detail
.commandInfo
.curch
;
177 } /* tuiDecrCommandCharCountBy */
181 ** tuiSetCommandCharCountTo()
182 ** Set the character count to count.
186 tuiSetCommandCharCountTo (
189 tuiSetCommandCharCountTo (count
)
195 if (count
> cmdWin
->generic
.width
- 1)
197 cmdWin
->detail
.commandInfo
.curch
= 0;
198 tuiIncrCommandCharCountBy (count
);
201 cmdWin
->detail
.commandInfo
.curch
-= count
;
204 return cmdWin
->detail
.commandInfo
.curch
;
205 } /* tuiSetCommandCharCountTo */
210 ** tuiClearCommandCharCount()
211 ** Clear the character count to count.
215 tuiClearCommandCharCount (void)
217 tuiClearCommandCharCount ()
221 cmdWin
->detail
.commandInfo
.curch
= 0;
223 return cmdWin
->detail
.commandInfo
.curch
;
224 } /* tuiClearCommandCharCount */
228 /*****************************************
229 ** STATIC LOCAL FUNCTIONS **
230 ******************************************/
This page took 0.045398 seconds and 4 git commands to generate.