/* Dialog procedure for the new credentials panel for our credentials type. We just dispatch messages here to other functions here. Note that this procedure runs under the UI thread. */ INT_PTR CALLBACK nc_dlg_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: return handle_wm_initdialog(hwnd, wParam, lParam); case WM_COMMAND: return handle_wm_command(hwnd, wParam, lParam); case KHUI_WM_NC_NOTIFY: return handle_khui_wm_nc_notify(hwnd, wParam, lParam); case WM_DESTROY: return handle_wm_destroy(hwnd, wParam, lParam); /* TODO: add code for handling other windows messages here. */ } return FALSE; }
/* Window procedure. All messages are handled here. */ static LRESULT CALLBACK window_proc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) { HDC hdc; PAINTSTRUCT ps; int i; switch (msg) { case WM_CREATE: songs = psid_tunes(&default_song); current_song = default_song; #if 0 if (songs == 0) { log_message(LOG_DEFAULT, "Vsid: no file specified, quitting"); return -1; } #endif DragAcceptFiles(window, TRUE); return 0; case WM_KEYDOWN: switch(wparam) { case 'I': /* infoline on request, just press I */ vsid_disp( 0, VSID_S_LASTLINE, "%s", vsidstrings[VSID_S_LASTLINE]); break; case VK_LEFT: case VK_DOWN: if (current_song > 1) { current_song--; psid_ui_set_tune(uint_to_void_ptr(current_song), NULL); vsid_ui_display_tune_nr(current_song); vsid_ui_set_default_tune(default_song); vsid_ui_display_nr_of_tunes(songs); InvalidateRect(window, NULL, 0); } break; case VK_RIGHT: case VK_UP: if (current_song < songs) { current_song++; psid_ui_set_tune(uint_to_void_ptr(current_song), NULL); vsid_ui_display_tune_nr(current_song); vsid_ui_set_default_tune(default_song); vsid_ui_display_nr_of_tunes(songs); InvalidateRect(window, NULL, 0); } break; } return 0; case WM_KEYUP: switch(wparam) { case 'I': /* infoline on request, just press I */ vsid_disp( 0, VSID_S_LASTLINE, "%79s", " "); break; } return 0; case WM_SIZE: return 0; case WM_COMMAND: vsync_suspend_speed_eval(); handle_wm_command(wparam, lparam, window); return 0; case WM_ENTERMENULOOP: vsync_suspend_speed_eval(); update_menus(window); break; case WM_MOVE: break; case WM_CLOSE: vsync_suspend_speed_eval(); vsid_ui_close(); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; case WM_DROPFILES: { char dummy[MAX_PATH]; DragQueryFile((HDROP)wparam, 0, dummy, sizeof(dummy) ); if (machine_autodetect_psid(dummy) >= 0) { vsid_disp(0, 0, NULL, NULL); psid_init_driver(); vsid_ui_init(); machine_play_psid(0); for (i = 0; i < VSID_S_LASTLINE; i++) { *vsidstrings[i] = 0; } machine_trigger_reset(MACHINE_RESET_MODE_SOFT); songs = psid_tunes(&default_song); current_song = default_song; psid_ui_set_tune(uint_to_void_ptr(current_song), NULL); vsid_ui_display_tune_nr(current_song); vsid_ui_set_default_tune(default_song); vsid_ui_display_nr_of_tunes(songs); InvalidateRect(window, NULL, TRUE); } } return 0; case WM_PAINT: { hdc = BeginPaint(window, &ps); if (*vsidstrings[VSID_S_TIMER]) { /* start only when timer string has been filled */ for (i = 0; i < VSID_S_LASTLINE; i++) { vsid_disp(0, i, "%s", vsidstrings[i]); } } EndPaint(window, &ps); return 0; } } return DefWindowProc(window, msg, wparam, lparam); }