~ubuntu-branches/ubuntu/jaunty/cmake/jaunty-security

« back to all changes in this revision

Viewing changes to Source/CursesDialog/cmCursesLongMessageForm.cxx

  • Committer: Bazaar Package Importer
  • Author(s): A. Maitland Bottoms
  • Date: 2006-06-18 16:34:11 UTC
  • mfrom: (1.4.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060618163411-pi234s3v6jwlcmof
Tags: 2.4.2-1
* New upstream release (Closes: #338324)
* Put cmake .vim files into /usr/share/vim/addons/plugin/
  where they can be used. (Closes: #366663)
* Install cmake-mode.el so it can be used. (Closes: #366664)
* Ensure cmake FindKDE locates KDE libraries on Debian
  based distributions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   CMake - Cross-Platform Makefile Generator
4
4
  Module:    $RCSfile: cmCursesLongMessageForm.cxx,v $
5
5
  Language:  C++
6
 
  Date:      $Date: 2005/05/03 18:57:32 $
7
 
  Version:   $Revision: 1.13 $
 
6
  Date:      $Date: 2006/03/16 15:44:55 $
 
7
  Version:   $Revision: 1.14 $
8
8
 
9
9
  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
10
10
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
33
33
  std::vector<std::string>::const_iterator it;
34
34
  for(it=messages.begin(); it != messages.end(); it++)
35
35
    {
36
 
    m_Messages += (*it);
 
36
    this->Messages += (*it);
37
37
    // Add one blank line after each message
38
 
    m_Messages += "\n\n";
 
38
    this->Messages += "\n\n";
39
39
    }
40
 
  m_Title = title;
41
 
  m_Fields[0] = 0;
42
 
  m_Fields[1] = 0;
 
40
  this->Title = title;
 
41
  this->Fields[0] = 0;
 
42
  this->Fields[1] = 0;
43
43
}
44
44
 
45
45
cmCursesLongMessageForm::~cmCursesLongMessageForm()
46
46
{
47
 
  if (m_Fields[0])
 
47
  if (this->Fields[0])
48
48
    {
49
 
    free_field(m_Fields[0]);
 
49
    free_field(this->Fields[0]);
50
50
    }
51
51
}
52
52
 
57
57
  getmaxyx(stdscr, y, x);
58
58
 
59
59
  char bar[cmCursesMainForm::MAX_WIDTH];
60
 
  int size = strlen(m_Title.c_str());
 
60
  int size = strlen(this->Title.c_str());
61
61
  if ( size >= cmCursesMainForm::MAX_WIDTH )
62
62
    {
63
63
    size = cmCursesMainForm::MAX_WIDTH-1;
64
64
    }
65
 
  strncpy(bar, m_Title.c_str(), size);
 
65
  strncpy(bar, this->Title.c_str(), size);
66
66
  for(int i=size-1; i<cmCursesMainForm::MAX_WIDTH; i++) bar[i] = ' ';
67
67
 
68
68
  int width;
92
92
  attroff(A_STANDOUT);  
93
93
  curses_move(y-3,0);
94
94
  printw(version);
95
 
  pos_form_cursor(m_Form);
 
95
  pos_form_cursor(this->Form);
96
96
}
97
97
 
98
98
void cmCursesLongMessageForm::PrintKeys()
109
109
 
110
110
  curses_move(y-2,0);
111
111
  printw(firstLine);
112
 
  pos_form_cursor(m_Form);
 
112
  pos_form_cursor(this->Form);
113
113
  
114
114
}
115
115
 
118
118
  int x,y;
119
119
  getmaxyx(stdscr, y, x);
120
120
 
121
 
  if (m_Form)
 
121
  if (this->Form)
122
122
    {
123
 
    unpost_form(m_Form);
124
 
    free_form(m_Form);
125
 
    m_Form = 0;
 
123
    unpost_form(this->Form);
 
124
    free_form(this->Form);
 
125
    this->Form = 0;
126
126
    }
127
127
 
128
 
  const char* msg = m_Messages.c_str();
 
128
  const char* msg = this->Messages.c_str();
129
129
 
130
130
  curses_clear();
131
131
 
132
 
  if (m_Fields[0])
 
132
  if (this->Fields[0])
133
133
    {
134
 
    free_field(m_Fields[0]);
135
 
    m_Fields[0] = 0;
 
134
    free_field(this->Fields[0]);
 
135
    this->Fields[0] = 0;
136
136
    }
137
137
 
138
 
  m_Fields[0] = new_field(y-6, x-2, 1, 1, 0, 0);
139
 
 
140
 
  field_opts_off(m_Fields[0],  O_STATIC);
141
 
 
142
 
  m_Form = new_form(m_Fields);
143
 
  post_form(m_Form);
 
138
  this->Fields[0] = new_field(y-6, x-2, 1, 1, 0, 0);
 
139
 
 
140
  field_opts_off(this->Fields[0],  O_STATIC);
 
141
 
 
142
  this->Form = new_form(this->Fields);
 
143
  post_form(this->Form);
144
144
 
145
145
  int i=0;
146
 
  form_driver(m_Form, REQ_BEG_FIELD);
 
146
  form_driver(this->Form, REQ_BEG_FIELD);
147
147
  while(msg[i] != '\0' && i < 60000)
148
148
    {
149
149
    if (msg[i] == '\n' && msg[i+1] != '\0')
150
150
      {
151
 
      form_driver(m_Form, REQ_NEW_LINE);
 
151
      form_driver(this->Form, REQ_NEW_LINE);
152
152
      }
153
153
    else
154
154
      {
155
 
      form_driver(m_Form, msg[i]);
 
155
      form_driver(this->Form, msg[i]);
156
156
      }
157
157
    i++;
158
158
    }
159
 
  form_driver(m_Form, REQ_BEG_FIELD);
 
159
  form_driver(this->Form, REQ_BEG_FIELD);
160
160
 
161
161
  this->UpdateStatusBar();
162
162
  this->PrintKeys();
167
167
 
168
168
void cmCursesLongMessageForm::HandleInput()
169
169
{
170
 
  if (!m_Form)
 
170
  if (!this->Form)
171
171
    {
172
172
    return;
173
173
    }
188
188
      }
189
189
    else if ( key == KEY_DOWN || key == ctrl('n') )
190
190
      {
191
 
      form_driver(m_Form, REQ_SCR_FLINE);
 
191
      form_driver(this->Form, REQ_SCR_FLINE);
192
192
      }
193
193
    else if ( key == KEY_UP  || key == ctrl('p') )
194
194
      {
195
 
      form_driver(m_Form, REQ_SCR_BLINE);
 
195
      form_driver(this->Form, REQ_SCR_BLINE);
196
196
      }
197
197
    else if ( key == KEY_NPAGE || key == ctrl('d') )
198
198
      {
199
 
      form_driver(m_Form, REQ_SCR_FPAGE);
 
199
      form_driver(this->Form, REQ_SCR_FPAGE);
200
200
      }
201
201
    else if ( key == KEY_PPAGE || key == ctrl('u') )
202
202
      {
203
 
      form_driver(m_Form, REQ_SCR_BPAGE);
 
203
      form_driver(this->Form, REQ_SCR_BPAGE);
204
204
      }
205
205
 
206
206
    this->UpdateStatusBar();