projects
/
ncurses.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ncurses 5.7 - patch 20090912
[ncurses.git]
/
c++
/
cursespad.cc
diff --git
a/c++/cursespad.cc
b/c++/cursespad.cc
index 2d067a0e56f00790550fc8a9d35f11ed3a5b4a54..28c58fab36acaae85ff1016ecc5effdf639cf842 100644
(file)
--- a/
c++/cursespad.cc
+++ b/
c++/cursespad.cc
@@
-1,6
+1,6
@@
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
- * Copyright (c) 1998-200
2,2003
Free Software Foundation, Inc. *
+ * Copyright (c) 1998-200
7,2008
Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@
-32,20
+32,21
@@
****************************************************************************/
#include "internal.h"
****************************************************************************/
#include "internal.h"
-#include "etip.h"
-#include "cursesw.h"
-MODULE_ID("$Id: cursespad.cc,v 1.7 2003/10/25 15:04:46 tom Exp $")
+#include <etip.h>
+#include <cursesw.h>
-NCursesPad::NCursesPad(int lines, int cols)
+MODULE_ID("$Id: cursespad.cc,v 1.13 2008/08/04 18:59:22 tom Exp $")
+
+NCursesPad::NCursesPad(int nlines, int ncols)
: NCursesWindow(),
: NCursesWindow(),
- viewWin(
(NCursesWindow*)0
),
- viewSub(
(NCursesWindow*)0
),
+ viewWin(
static_cast<NCursesWindow*>(0)
),
+ viewSub(
static_cast<NCursesWindow*>(0)
),
h_gridsize(0), v_gridsize(0),
min_row(0), min_col(0)
{
h_gridsize(0), v_gridsize(0),
min_row(0), min_col(0)
{
- w = ::newpad(
lines,
cols);
- if (
(WINDOW*)0==
w) {
+ w = ::newpad(
nlines, n
cols);
+ if (
static_cast<WINDOW*>(0) ==
w) {
count--;
err_handler("Cannot construct window");
}
count--;
err_handler("Cannot construct window");
}
@@
-84,7
+85,7
@@
void NCursesPad::operator()(void)
{
NCursesWindow* W = Win();
{
NCursesWindow* W = Win();
- if (
(NCursesWindow*)0
!= W) {
+ if (
static_cast<NCursesWindow*>(0)
!= W) {
int Width = W->width();
int Height = W->height();
int Width = W->width();
int Height = W->height();
@@
-169,7
+170,7
@@
void NCursesPad::operator()(void)
int NCursesPad::refresh()
{
int res = noutrefresh();
int NCursesPad::refresh()
{
int res = noutrefresh();
- if (res==OK && (
(NCursesWindow*)0
!= viewWin)) {
+ if (res==OK && (
static_cast<NCursesWindow*>(0)
!= viewWin)) {
res = (viewWin->refresh());
}
return(res);
res = (viewWin->refresh());
}
return(res);
@@
-179,9
+180,11
@@
int NCursesPad::noutrefresh()
{
int res = OK;
NCursesWindow* W = Win();
{
int res = OK;
NCursesWindow* W = Win();
- if ((NCursesWindow*)0 != W) {
- res = copywin(*W,min_row,min_col,
- 0,0,W->maxy(),W->maxx(),
+ if (static_cast<NCursesWindow*>(0) != W) {
+ int high = W->maxy();
+ int wide = W->maxx();
+ res = copywin(*W, min_row, min_col,
+ 0, 0, high, wide,
FALSE);
if (res==OK) {
W->syncup();
FALSE);
if (res==OK) {
W->syncup();
@@
-207,8
+210,9
@@
void NCursesPad::setWindow(NCursesWindow& view,
void NCursesPad::setSubWindow(NCursesWindow& sub)
{
void NCursesPad::setSubWindow(NCursesWindow& sub)
{
- if (
(NCursesWindow*)0
== viewWin)
+ if (
static_cast<NCursesWindow*>(0)
== viewWin)
err_handler("Pad has no viewport");
err_handler("Pad has no viewport");
+ assert(viewWin != 0);
if (!viewWin->isDescendant(sub))
THROW(new NCursesException("NCursesFramePad", E_SYSTEM_ERROR));
viewSub = ⊂
if (!viewWin->isDescendant(sub))
THROW(new NCursesException("NCursesFramePad", E_SYSTEM_ERROR));
viewSub = ⊂
@@
-217,9
+221,9
@@
void NCursesPad::setSubWindow(NCursesWindow& sub)
void NCursesFramedPad::OnOperation(int pad_req)
{
NCursesWindow* W = Win();
void NCursesFramedPad::OnOperation(int pad_req)
{
NCursesWindow* W = Win();
- NCursesWindow* W
in
= getWindow();
+ NCursesWindow* W
2
= getWindow();
- if ((
(NCursesWindow*)0 != W) && ((NCursesWindow*)0 != Win
)) {
+ if ((
static_cast<NCursesWindow*>(0) != W) && (static_cast<NCursesWindow*>(0) != W2
)) {
int Width = W->width();
int Height = W->height();
int i, row, col, h_len, v_len;
int Width = W->width();
int Height = W->height();
int i, row, col, h_len, v_len;
@@
-244,32
+248,32
@@
void NCursesFramedPad::OnOperation(int pad_req)
if (row + v_len > Height)
row = Height - v_len;
if (row + v_len > Height)
row = Height - v_len;
- W
in
->vline(1,Width+1,Height);
- W
in
->attron(A_REVERSE);
+ W
2
->vline(1,Width+1,Height);
+ W
2
->attron(A_REVERSE);
if (v_len>=2) {
if (v_len>=2) {
- W
in
->addch(row+1,Width+1,ACS_UARROW);
+ W
2
->addch(row+1,Width+1,ACS_UARROW);
for(i=2;i<v_len;i++)
for(i=2;i<v_len;i++)
- W
in
->addch(row+i,Width+1,' ');
- W
in
->addch(row+v_len,Width+1,ACS_DARROW);
+ W
2
->addch(row+i,Width+1,' ');
+ W
2
->addch(row+v_len,Width+1,ACS_DARROW);
}
else {
for(i=1;i<=v_len;i++)
}
else {
for(i=1;i<=v_len;i++)
- W
in
->addch(row+i,Width+1,' ');
+ W
2
->addch(row+i,Width+1,' ');
}
}
- W
in
->attroff(A_REVERSE);
+ W
2
->attroff(A_REVERSE);
- W
in
->hline(Height+1,1,Width);
- W
in
->attron(A_REVERSE);
+ W
2
->hline(Height+1,1,Width);
+ W
2
->attron(A_REVERSE);
if (h_len >= 2) {
if (h_len >= 2) {
- W
in
->addch(Height+1,col+1,ACS_LARROW);
+ W
2
->addch(Height+1,col+1,ACS_LARROW);
for(i=2;i<h_len;i++)
for(i=2;i<h_len;i++)
- W
in
->addch(Height+1,col+i,' ');
- W
in
->addch(Height+1,col+h_len,ACS_RARROW);
+ W
2
->addch(Height+1,col+i,' ');
+ W
2
->addch(Height+1,col+h_len,ACS_RARROW);
}
else {
for(i=1;i<=h_len;i++)
}
else {
for(i=1;i<=h_len;i++)
- W
in
->addch(Height+1,col+i,' ');
+ W
2
->addch(Height+1,col+i,' ');
}
}
- W
in
->attroff(A_REVERSE);
+ W
2
->attroff(A_REVERSE);
}
}
}
}