fn draw_outer_panel(&self, printer: &Printer) {
        match self.bar_placement {
            Placement::HorizontalTop => {
                // Side bars
                printer.print_vline((0, 0), printer.size.y, "│");
                printer.print_vline((printer.size.x - 1, 0), printer.size.y, "│");
                // Bottom line
                printer.print_hline((0, printer.size.y - 1), printer.size.x, "─");

                printer.print((0, self.bar_size.y - 1), "┌");
                printer.print((printer.size.x - 1, self.bar_size.y - 1), "┐");
                printer.print((0, printer.size.y - 1), "└");
                printer.print((printer.size.x - 1, printer.size.y - 1), "┘");
            }
            Placement::HorizontalBottom => {
                // Side bars
                printer.print_vline((0, 0), printer.size.y, "│");
                printer.print_vline((printer.size.x - 1, 0), printer.size.y, "│");
                // Top line
                let lowest = clamp(printer.size.y - self.bar_size.y, 0, printer.size.y - 1);
                printer.print_hline((0, 0), printer.size.x, "─");
                printer.print((0, 0), "┌");
                printer.print((printer.size.x - 1, 0), "┐");
                printer.print((0, lowest), "└");
                printer.print((printer.size.x - 1, lowest), "┘");
            }
            Placement::VerticalLeft => {
                // Side bar
                printer.print_vline((printer.size.x - 1, 0), printer.size.y, "│");
                // Top lines
                printer.print_hline((self.bar_size.x - 1, 0), printer.size.x, "─");
                printer.print_hline(
                    (self.bar_size.x - 1, printer.size.y - 1),
                    printer.size.x,
                    "─",
                );
                printer.print((self.bar_size.x - 1, 0), "┌");
                printer.print((printer.size.x - 1, 0), "┐");
                printer.print((self.bar_size.x - 1, printer.size.y - 1), "└");
                printer.print((printer.size.x - 1, printer.size.y - 1), "┘");
            }
            Placement::VerticalRight => {
                // Side bar
                printer.print_vline((0, 0), printer.size.y, "│");
                // Top lines
                printer.print_hline((0, 0), printer.size.x, "─");
                // Line draws too far here, needs to be overwritten with blanks
                printer.print_hline((0, printer.size.y - 1), printer.size.x, "─");

                let right = clamp(printer.size.x - self.bar_size.x, 0, printer.size.x - 1);
                printer.print((0, 0), "┌");
                printer.print((right, 0), "┐");
                printer.print_hline((right + 1, 0), printer.size.x, " ");
                printer.print((0, printer.size.y - 1), "└");
                printer.print((right, printer.size.y - 1), "┘");
                printer.print_hline((right + 1, printer.size.y - 1), printer.size.x, " ");
            }
        }
    }
// Print lines corresponding to the current placement
Print lines corresponding to the current placement
Print lines corresponding to the current placement
fn draw_outer_panel(&self, printer: &Printer) {
        match self.bar_placement {
            Placement::HorizontalTop => {
                // Side bars
                printer.print_vline((0, 0), printer.size.y, "│");
                printer.print_vline((printer.size.x - 1, 0), printer.size.y, "│");
                // Bottom line
                printer.print_hline((0, printer.size.y - 1), printer.size.x, "─");
                printer.print((0, self.bar_size.y - 1), "┌");
                printer.print((printer.size.x - 1, self.bar_size.y - 1), "┐");
                printer.print((0, printer.size.y - 1), "└");
                printer.print((printer.size.x - 1, printer.size.y - 1), "┘");
            }
            Placement::HorizontalBottom => {
                // Side bars
                printer.print_vline((0, 0), printer.size.y, "│");
                printer.print_vline((printer.size.x - 1, 0), printer.size.y, "│");
                // Top line
                let lowest = clamp(printer.size.y - self.bar_size.y, 0, printer.size.y - 1);
                printer.print_hline((0, 0), printer.size.x, "─");
                printer.print((0, 0), "┌");
                printer.print((printer.size.x - 1, 0), "┐");
                printer.print((0, lowest), "└");
                printer.print((printer.size.x - 1, lowest), "┘");
            }
            Placement::VerticalLeft => {
                // Side bar
                printer.print_vline((printer.size.x - 1, 0), printer.size.y, "│");
                // Top lines
                printer.print_hline((self.bar_size.x - 1, 0), printer.size.x, "─");
                printer.print_hline(
                    (self.bar_size.x - 1, printer.size.y - 1),
                    printer.size.x,
                    "─",
                );
                printer.print((self.bar_size.x - 1, 0), "┌");
                printer.print((printer.size.x - 1, 0), "┐");
                printer.print((self.bar_size.x - 1, printer.size.y - 1), "└");
                printer.print((printer.size.x - 1, printer.size.y - 1), "┘");
            }
            Placement::VerticalRight => {
                // Side bar
                printer.print_vline((0, 0), printer.size.y, "│");
                // Top lines
                printer.print_hline((0, 0), printer.size.x, "─");
                // Line draws too far here, needs to be overwritten with blanks
                printer.print_hline((0, printer.size.y - 1), printer.size.x, "─");
                let right = clamp(printer.size.x - self.bar_size.x, 0, printer.size.x - 1);
                printer.print((0, 0), "┌");
                printer.print((right, 0), "┐");
                printer.print_hline((right + 1, 0), printer.size.x, " ");
                printer.print((0, printer.size.y - 1), "└");
                printer.print((right, printer.size.y - 1), "┘");
                printer.print_hline((right + 1, printer.size.y - 1), printer.size.x, " ");
            }
        }
    }
fn draw_outer_panel ( & self , printer : & Printer ) { match self . bar_placement { Placement :: HorizontalTop => { // Side bars printer . print_vline ( ( 0 , 0 ) , printer . size . y , " ; printer . print_vline ( ( printer . size . x - 1 , 0 ) , printer . size . y , " ; // Bottom line printer . print_hline ( ( 0 , printer . size . y - 1 ) , printer . size . x , " ; printer . print ( ( 0 , self . bar_size . y - 1 ) , " ; printer . print ( ( printer . size . x - 1 , self . bar_size . y - 1 ) , " ; printer . print ( ( 0 , printer . size . y - 1 ) , " ; printer . print ( ( printer . size . x - 1 , printer . size . y - 1 ) , " ; } Placement :: HorizontalBottom => { // Side bars printer . print_vline ( ( 0 , 0 ) , printer . size . y , " ; printer . print_vline ( ( printer . size . x - 1 , 0 ) , printer . size . y , " ; // Top line let lowest = clamp ( printer . size . y - self . bar_size . y , 0 , printer . size . y - 1 ) ; printer . print_hline ( ( 0 , 0 ) , printer . size . x , " ; printer . print ( ( 0 , 0 ) , " ; printer . print ( ( printer . size . x - 1 , 0 ) , " ; printer . print ( ( 0 , lowest ) , " ; printer . print ( ( printer . size . x - 1 , lowest ) , " ; } Placement :: VerticalLeft => { // Side bar printer . print_vline ( ( printer . size . x - 1 , 0 ) , printer . size . y , " ; // Top lines printer . print_hline ( ( self . bar_size . x - 1 , 0 ) , printer . size . x , " ; printer . print_hline ( ( self . bar_size . x - 1 , printer . size . y - 1 ) , printer . size . x , " ) ; printer . print ( ( self . bar_size . x - 1 , 0 ) , " ; printer . print ( ( printer . size . x - 1 , 0 ) , " ; printer . print ( ( self . bar_size . x - 1 , printer . size . y - 1 ) , " ; printer . print ( ( printer . size . x - 1 , printer . size . y - 1 ) , " ; } Placement :: VerticalRight => { // Side bar printer . print_vline ( ( 0 , 0 ) , printer . size . y , " ; // Top lines printer . print_hline ( ( 0 , 0 ) , printer . size . x , " ; // Line draws too far here, needs to be overwritten with blanks printer . print_hline ( ( 0 , printer . size . y - 1 ) , printer . size . x , " ; let right = clamp ( printer . size . x - self . bar_size . x , 0 , printer . size . x - 1 ) ; printer . print ( ( 0 , 0 ) , " ; printer . print ( ( right , 0 ) , " ; printer . print_hline ( ( right + 1 , 0 ) , printer . size . x , " " ) ; printer . print ( ( 0 , printer . size . y - 1 ) , " ; printer . print ( ( right , printer . size . y - 1 ) , " ; printer . print_hline ( ( right + 1 , printer . size . y - 1 ) , printer . size . x , " " ) ; } } }
Print lines corresponding to the current placement
Print lines corresponding to the current placement
&self
printer
&Printer