File: guideuiconsoleinfo.cpp

package info (click to toggle)
gambc 4.9.3-1.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 85,424 kB
  • sloc: ansic: 1,047,649; lisp: 243,942; perl: 19,018; sh: 6,385; makefile: 6,303; objc: 3,757; cpp: 2,143; sed: 498; java: 305; awk: 198
file content (60 lines) | stat: -rw-r--r-- 1,517 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* File: "guideuiconsoleinfo.cpp", Time-stamp: <2005-04-12 14:29:32 feeley> */

/* Copyright (C) 1994-2005 by Marc Feeley, All Rights Reserved. */

/*---------------------------------------------------------------------------*/

#include "guideuiconsoleinfo.h"

/*---------------------------------------------------------------------------*/

GuideUiConsoleInfo::GuideUiConsoleInfo ()
{
  nbReadOnlyParas = 0;
  nbReadOnlyChars = 0;
}

// Add a line relation between repl and console
void GuideUiConsoleInfo::addLine (int typedLineNb, int paraNb, int startCol)
{
  struct LineInfo info;
  info.typedLineNb = typedLineNb;
  info.paraNb = paraNb;
  info.startCol = startCol;
  lines.append(info);
}

// Get the paragraph number related to the typed line number
void GuideUiConsoleInfo::getParaNb (int typedLineNb, int &paraNb, int &startCol)
{
  for (uint i=0; i<lines.size(); i++)
    {
      struct LineInfo info = lines[i];
      if (typedLineNb == info.typedLineNb)
        {
          paraNb = info.paraNb;
          startCol = info.startCol;
          return;
        }
    }
  paraNb = -1;
  return;
}

// Get the starting column related to the paragraph number
int GuideUiConsoleInfo::getStartCol (int paraNb)
{
  for (uint i=0; i<lines.size(); i++)
    {
      struct LineInfo info = lines[i];
      if (paraNb == info.paraNb)
        return info.startCol;
    }
  return -1;
}

/*---------------------------------------------------------------------------*/

/* Local Variables: */
/* mode: C++ */
/* End: */