# Path: vii/view/Window.py
# class Window:
# 
#     def __init__(self):
#         slot("cursorMoved", self)
#         self.firstLine = 1
# 
#     def makeLines(self):
#         width = self.port.width() - 1 - numberBarWidth
#         string = str(self.buffer)
#         self.lines.splitLines(string, width)
#         self.lines.makeNumbers(numberBarWidth)
# 
#     def firstWindowLine(self):
#         y = self.firstLine
#         y, x = self.lines.mapPositionToWindowLines(y,1)
#         return y
# 
#     def linesAbovePort(self, nr):
#         return self.firstLine - nr
# 
#     def linesBelowPort(self, nr):
#         """ The number of lines the top lines needs to move down, if
#         position is below the botton line of port """
#         y, x = nr, self.buffer.lengthOfLine(nr)
#         yTarget, xTarget = self.lines.mapPositionToWindowLines(y, x)
#         yTop = yTarget - self.port.height()
# 
#         topLineY, topLineX = self.lines.mapPositionFromWindowLines(yTop, 1)
#         return topLineY - self.firstLine + 1
# 
#     def mapWindowLineToPort(self, y):
#         top = self.firstWindowLine()
#         return y - top + 1
# 
#     def draw(self):
#         string = self.lines.subStringWithNumbers(
#                 self.firstWindowLine(), self.port.height())
#         self.port.draw(string)
# 
#     def move(self):
#         y, x = self.cursor.position().toPositionTuple()
#         if y == 0: y = 1
#         if x == 0: x = 1
#         above = self.linesAbovePort(y)
#         if above > 0:
#             self.firstLine -= above
#         else:
#             down = self.linesBelowPort(y)
#             if down > 0: self.firstLine += down
#         self.draw()
#         y, x = self.lines.mapPositionToWindowLines(y,x)
#         y = self.mapWindowLineToPort(y)
#         x += numberBarWidth
#         self.port.move(y, x)
# 
#     def focus(self):
#         self.cursor.move(self.cursor.position())
# 
#     def receive(self, signal, sender, *args):
#         # Every buffer update triggers a move of the cursor.
#         # A cursor move signal is received here.
#         # Move implies draw because the view port needs to
#         # draw the section containing the cursor before.
#         if sender == self.cursor:
#             self.makeLines()
#             self.move()


from .Window import Window

class CommandLine(Window):

    def layout(self, parentWindow):
        height, width = 1, parentWindow.getmaxyx()[1]
        x, y = 0, parentWindow.getmaxyx()[0] - 1

# Path: vii/view/Window.py
# class Window:
# 
#     def __init__(self):
#         slot("cursorMoved", self)
#         self.firstLine = 1
# 
#     def makeLines(self):
#         width = self.port.width() - 1 - numberBarWidth
#         string = str(self.buffer)
#         self.lines.splitLines(string, width)
#         self.lines.makeNumbers(numberBarWidth)
# 
#     def firstWindowLine(self):
#         y = self.firstLine
#         y, x = self.lines.mapPositionToWindowLines(y,1)
#         return y
# 
#     def linesAbovePort(self, nr):
#         return self.firstLine - nr
# 
#     def linesBelowPort(self, nr):
#         """ The number of lines the top lines needs to move down, if
#         position is below the botton line of port """
#         y, x = nr, self.buffer.lengthOfLine(nr)
#         yTarget, xTarget = self.lines.mapPositionToWindowLines(y, x)
#         yTop = yTarget - self.port.height()
# 
#         topLineY, topLineX = self.lines.mapPositionFromWindowLines(yTop, 1)
#         return topLineY - self.firstLine + 1
# 
#     def mapWindowLineToPort(self, y):
#         top = self.firstWindowLine()
#         return y - top + 1
# 
#     def draw(self):
#         string = self.lines.subStringWithNumbers(
#                 self.firstWindowLine(), self.port.height())
#         self.port.draw(string)
# 
#     def move(self):
#         y, x = self.cursor.position().toPositionTuple()
#         if y == 0: y = 1
#         if x == 0: x = 1
#         above = self.linesAbovePort(y)
#         if above > 0:
#             self.firstLine -= above
#         else:
#             down = self.linesBelowPort(y)
#             if down > 0: self.firstLine += down
#         self.draw()
#         y, x = self.lines.mapPositionToWindowLines(y,x)
#         y = self.mapWindowLineToPort(y)
#         x += numberBarWidth
#         self.port.move(y, x)
# 
#     def focus(self):
#         self.cursor.move(self.cursor.position())
# 
#     def receive(self, signal, sender, *args):
#         # Every buffer update triggers a move of the cursor.
#         # A cursor move signal is received here.
#         # Move implies draw because the view port needs to
#         # draw the section containing the cursor before.
#         if sender == self.cursor:
#             self.makeLines()
#             self.move()


# Path: vii/view/CommandLine.py
from .Window import Window


class CommandLine(Window):

    def layout(self, parentWindow):
        height, width = 1, parentWindow.getmaxyx()[1]
        x, y = 0, parentWindow.getmaxyx()[0] - 1

        return (height, width, y, x)