Convert ui to use new logging facility

This commit is contained in:
Azamat H. Hackimov 2024-08-20 04:56:01 +03:00
parent a4f00480b1
commit 0abd11f08f
6 changed files with 12 additions and 6 deletions

View File

@ -28,6 +28,7 @@ target_link_libraries(ui PRIVATE
grtext
mem
misc
plog::plog
)
target_include_directories(ui PUBLIC
$<BUILD_INTERFACE:

View File

@ -138,6 +138,7 @@
#include "UIlib.h"
#include "grtext.h"
#include "log.h"
#include "Macros.h"
#include "mem.h"
@ -387,7 +388,7 @@ void UIEdit::OnKeyDown(int key) {
for (i = len; i >= m_CurPos; i--)
m_TextBuf[i + 1] = m_TextBuf[i];
// adjust scroll region if cursor will go out of visible region.
mprintf(0, "scroll=%d, curpos=%d\n", m_ScrollThresh, m_CurPos);
LOG_DEBUG.printf("scroll=%d, curpos=%d", m_ScrollThresh, m_CurPos);
// if (m_ScrollThresh<=m_CurPos && m_ScrollThresh)
// m_StartPos++;
m_TextBuf[m_CurPos++] = (char)ascii;

View File

@ -161,6 +161,7 @@
#include <cstring>
#include "UIlib.h"
#include "log.h"
#define SCROLL_BUTTON_GAP 4
@ -422,7 +423,7 @@ void UIListBox::RemoveItem(const UIItem *item) {
}
}
if (found == -1) {
mprintf(0, "UIListBox:: Didn't find item to remove!\n");
LOG_DEBUG << "UIListBox:: Didn't find item to remove!";
return;
}
@ -486,7 +487,7 @@ void UIListBox::SelectItem(const UIItem *item) {
}
}
if (!found) {
mprintf(0, "UIListBox::SelectItem item not found!\n");
LOG_DEBUG << "UIListBox::SelectItem item not found!";
}
}

View File

@ -39,6 +39,7 @@
*/
#include "UIlib.h"
#include "log.h"
UIObject::UIObject() {
m_X = m_Y = 0;
@ -65,7 +66,7 @@ void UIObject::Move(int x, int y, int w, int h) {
m_Y = y;
m_W = w;
m_H = h;
mprintf(0, "new [%d,%d]\n", m_X, m_Y);
LOG_DEBUG.printf("new [%d,%d]", m_X, m_Y);
}
//@@

View File

@ -170,6 +170,7 @@
#include "application.h"
#include "bitmap.h"
#include "ddvid.h"
#include "log.h"
#include "renderer.h"
#include "Macros.h"
@ -376,7 +377,7 @@ void ui_RemoveAllWindows() {
ASSERT(count < 50);
}
if (count) {
mprintf(0, "%d UI windows left open. Closed them!\n", count);
LOG_DEBUG.printf("%d UI windows left open. Closed them!", count);
}
}
// removes a window from ui list.

View File

@ -151,6 +151,7 @@
#include "UIlib.h"
#include "Macros.h"
#include "log.h"
// the window font for all windows
int UIWindow::m_WindowFont = 0;
@ -576,7 +577,7 @@ void UIWindow::Render() {
gadget->OnDraw();
ui_EndDraw();
} else {
mprintf(0, "WINDOW: Gadget clipped on screen border (%d,%d,%d,%d)\n", l, t, r, b);
LOG_DEBUG.printf("WINDOW: Gadget clipped on screen border (%d,%d,%d,%d)", l, t, r, b);
// Int3();
}