From 0447b4e881e537a4984d4c15c7ff9efc2923f4b1 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 30 Aug 2012 06:21:21 +0200 Subject: [PATCH] window: remove GetXY --- src/status.cpp | 4 ++-- src/window.cpp | 19 ++----------------- src/window.h | 15 +-------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/status.cpp b/src/status.cpp index e56b8ad5..0c821bc0 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -215,8 +215,8 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *) static std::string player_state; static MPD::Song np; - int sx, sy; - wFooter->GetXY(sx, sy); + int sx = wFooter->X(); + int sy = wFooter->Y(); myPlaylist->NowPlaying = Mpd.GetCurrentlyPlayingSongPos(); diff --git a/src/window.cpp b/src/window.cpp index a379dbc7..1cedaa56 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -91,8 +91,6 @@ Window::Window(size_t startx, itsBaseBgColor(clDefault), itsBorder(border), itsGetStringHelper(0), - itsX(0), - itsY(0), itsTitle(title), itsHistory(0), itsBoldCounter(0), @@ -141,8 +139,6 @@ Window::Window(const Window &w) : itsWindow(dupwin(w.itsWindow)), itsBaseBgColor(w.itsBaseBgColor), itsBorder(w.itsBorder), itsGetStringHelper(w.itsGetStringHelper), - itsX(w.itsX), - itsY(w.itsY), itsTitle(w.itsTitle), itsColors(w.itsColors), itsHistory(w.itsHistory), @@ -653,30 +649,19 @@ std::string Window::GetString(const std::string &base, size_t length, size_t wid return ToString(*tmp); } -void Window::GetXY(int &x, int &y) -{ - getyx(itsWindow, itsY, itsX); - x = itsX; - y = itsY; -} - void Window::GotoXY(int x, int y) { wmove(itsWindow, y, x); - itsX = x; - itsY = y; } int Window::X() { - getyx(itsWindow, itsY, itsX); - return itsX; + return getcurx(itsWindow); } int Window::Y() { - getyx(itsWindow, itsY, itsX); - return itsY; + return getcury(itsWindow); } bool Window::hasCoords(int &x, int &y) diff --git a/src/window.h b/src/window.h index 93d1e3ea..d6ddd0b7 100644 --- a/src/window.h +++ b/src/window.h @@ -264,7 +264,7 @@ namespace NCurses /// @see CreateHistory() /// std::string GetString(const std::string &base, size_t length = -1, - size_t width = 0, bool encrypted = 0); + size_t width = 0, bool encrypted = 0); /// Wrapper for above function that doesn't take base string (it will be empty). /// Taken parameters are the same as for above. @@ -274,12 +274,6 @@ namespace NCurses return GetString("", length, width, encrypted); } - /// Gets present position of cursor's coordinates - /// @param x variable that will be set to current X position - /// @param y variable that will be set to current Y position - /// - void GetXY(int &x, int &y); - /// Moves cursor to given coordinates /// @param x given X position /// @param y given Y position @@ -593,13 +587,6 @@ namespace NCurses /// GetStringHelper itsGetStringHelper; - /// temporary coordinates - /// @see X() - /// @see Y() - /// - int itsX; - int itsY; - /// window title std::string itsTitle;