/* * meli - ui module. * * Copyright 2017 Manos Pitsidianakis * * This file is part of meli. * * meli is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * meli is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with meli. If not, see . */ extern crate ncurses; pub mod index; pub mod pager; /* Color pairs; foreground && background. */ pub static COLOR_PAIR_DEFAULT: i16 = 1; pub static COLOR_PAIR_CURSOR: i16 = 2; pub static COLOR_PAIR_HEADERS: i16 = 3; pub static COLOR_PAIR_THREAD_INDENT: i16 = 4; pub fn initialize() { /* start ncurses */ ncurses::initscr(); ncurses::keypad(ncurses::stdscr(), true); ncurses::noecho(); ncurses::curs_set(ncurses::CURSOR_VISIBILITY::CURSOR_INVISIBLE); /* Start colors. */ ncurses::start_color(); ncurses::init_pair(COLOR_PAIR_DEFAULT, 15, 0); ncurses::init_pair(COLOR_PAIR_CURSOR, 251, 235); ncurses::init_pair(COLOR_PAIR_HEADERS, 33, 0); ncurses::init_pair(COLOR_PAIR_THREAD_INDENT, 5, 0); /* Set the window's background color. */ ncurses::bkgd( ' ' as ncurses::chtype | ncurses::COLOR_PAIR(COLOR_PAIR_DEFAULT) as ncurses::chtype, ); }