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.
44 tuiDispatchCtrlChar (unsigned int ch
)
46 TuiWinInfoPtr winInfo
= tuiWinWithFocus ();
49 ** If the command window has the logical focus, or no-one does
50 ** assume it is the command window; in this case, pass the
51 ** character on through and do nothing here.
53 if (winInfo
== (TuiWinInfoPtr
) NULL
|| winInfo
== cmdWin
)
57 unsigned int c
= 0, chCopy
= ch
;
61 /* If this is an xterm, page next/prev keys aren't returned
62 ** by keypad as a single char, so we must handle them here.
63 ** Seems like a bug in the curses library?
65 term
= (char *) getenv ("TERM");
66 for (i
= 0; (term
&& term
[i
]); i
++)
67 term
[i
] = toupper (term
[i
]);
68 if ((strcmp (term
, "XTERM") == 0) && m_isStartSequence (ch
))
70 unsigned int pageCh
= 0, tmpChar
;
73 while (!m_isEndSequence (tmpChar
))
75 tmpChar
= (int) wgetch (cmdWin
->generic
.handle
);
80 else if (tmpChar
== 54)
89 tuiScrollForward (winInfo
, 0);
92 tuiScrollBackward (winInfo
, 0);
96 tuiScrollForward (winInfo
, 1);
100 tuiScrollBackward (winInfo
, 1);
103 tuiScrollLeft (winInfo
, 1);
106 tuiScrollRight (winInfo
, 1);
117 } /* tuiDispatchCtrlChar */
121 ** tuiIncrCommandCharCountBy()
122 ** Increment the current character count in the command window,
123 ** checking for overflow. Returns the new value of the char count.
126 tuiIncrCommandCharCountBy (int count
)
130 if ((count
+ cmdWin
->detail
.commandInfo
.curch
) >= cmdWin
->generic
.width
)
131 cmdWin
->detail
.commandInfo
.curch
=
132 (count
+ cmdWin
->detail
.commandInfo
.curch
) - cmdWin
->generic
.width
;
134 cmdWin
->detail
.commandInfo
.curch
+= count
;
137 return cmdWin
->detail
.commandInfo
.curch
;
138 } /* tuiIncrCommandCharCountBy */
142 ** tuiDecrCommandCharCountBy()
143 ** Decrement the current character count in the command window,
144 ** checking for overflow. Returns the new value of the char count.
147 tuiDecrCommandCharCountBy (int count
)
151 if ((cmdWin
->detail
.commandInfo
.curch
- count
) < 0)
152 cmdWin
->detail
.commandInfo
.curch
=
153 cmdWin
->generic
.width
+ (cmdWin
->detail
.commandInfo
.curch
- count
);
155 cmdWin
->detail
.commandInfo
.curch
-= count
;
158 return cmdWin
->detail
.commandInfo
.curch
;
159 } /* tuiDecrCommandCharCountBy */
163 ** tuiSetCommandCharCountTo()
164 ** Set the character count to count.
167 tuiSetCommandCharCountTo (int count
)
171 if (count
> cmdWin
->generic
.width
- 1)
173 cmdWin
->detail
.commandInfo
.curch
= 0;
174 tuiIncrCommandCharCountBy (count
);
177 cmdWin
->detail
.commandInfo
.curch
-= count
;
180 return cmdWin
->detail
.commandInfo
.curch
;
181 } /* tuiSetCommandCharCountTo */
186 ** tuiClearCommandCharCount()
187 ** Clear the character count to count.
190 tuiClearCommandCharCount (void)
193 cmdWin
->detail
.commandInfo
.curch
= 0;
195 return cmdWin
->detail
.commandInfo
.curch
;
196 } /* tuiClearCommandCharCount */
200 /*****************************************
201 ** STATIC LOCAL FUNCTIONS **
202 ******************************************/
This page took 0.032267 seconds and 4 git commands to generate.