static int cmsg(int type, int verbosity_level, char *fmt, ...) { #ifndef WINDRV #ifndef IA_W32G_SYN va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity<verbosity_level) return 0; va_start(ap, fmt); if(type == CMSG_WARNING || type == CMSG_ERROR || type == CMSG_FATAL) dumb_error_count++; if (!ctl.opened) { vfprintf(stderr, fmt, ap); fputs(NLS, stderr); } else { vfprintf(outfp, fmt, ap); fputs(NLS, outfp); fflush(outfp); } va_end(ap); #else if ( !ConsoleWndFlag ) return 0; { char buffer[1024]; va_list ap; va_start(ap, fmt); vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity<verbosity_level) return 0; // if(type == CMSG_FATAL) // w32g_msg_box(buffer, "TiMidity Error", MB_OK); PutsConsoleWnd(buffer); PutsConsoleWnd("\n"); return 0; } #endif #endif return 0; }
static int cmsg(int type, int verbosity_level, char *fmt, ...) { char buffer[BUFSIZ]; va_list ap; va_start(ap, fmt); vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); if( type==CMSG_TEXT ) { MPanelMessageClearAll(); MPanelMessageAdd(buffer,2000,0); } if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity<verbosity_level) return 0; if(type == CMSG_FATAL) w32g_msg_box(buffer, "TiMidity Error", MB_OK); PutsConsoleWnd(buffer); PutsConsoleWnd("\n"); return 0; }
// Window Procedure static BOOL CALLBACK ConsoleWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: PutsConsoleWnd("Console Window\n"); ConsoleWndAllUpdate(); SetWindowPosSize(GetDesktopWindow(),hwnd,ConsoleWndInfo.PosX, ConsoleWndInfo.PosY ); return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateConsoleButton(); break; case IDCLEAR: ClearConsoleWnd(); break; case IDC_CHECKBOX_VALID: ConsoleWndValidApply(); break; case IDC_BUTTON_VERBOSITY: ConsoleWndVerbosityApply(); break; case IDC_BUTTON_INC: ConsoleWndVerbosityApplyIncDec(1); break; case IDC_BUTTON_DEC: ConsoleWndVerbosityApplyIncDec(-1); break; default: break; } switch (HIWORD(wParam)) { case EN_ERRSPACE: ClearConsoleWnd(); PutsConsoleWnd("### EN_ERRSPACE -> Clear! ###\n"); break; default: break; } break; case WM_SIZE: ConsoleWndAllUpdate(); return FALSE; case WM_MOVE: // ConsoleWndInfo.PosX = (int) LOWORD(lParam); // ConsoleWndInfo.PosY = (int) HIWORD(lParam); { RECT rc; GetWindowRect(hwnd,&rc); ConsoleWndInfo.PosX = rc.left; ConsoleWndInfo.PosY = rc.top; } break; // See PreDispatchMessage() in w32g2_main.c case WM_SYSKEYDOWN: case WM_KEYDOWN: { int nVirtKey = (int)wParam; switch(nVirtKey){ case VK_ESCAPE: SendMessage(hwnd,WM_CLOSE,0,0); break; } } break; case WM_DESTROY: INISaveConsoleWnd(); break; case WM_CLOSE: ShowSubWindow(hConsoleWnd,0); // ShowWindow(hConsoleWnd, SW_HIDE); MainWndUpdateConsoleButton(); break; case WM_SETFOCUS: HideCaret(hwnd); break; case WM_KILLFOCUS: ShowCaret(hwnd); break; default: return FALSE; } return FALSE; }