BOOL WINPROC EXPORT DlgTextProc( /***********************************************************************/ HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int i; WORD wKey; HFONT hFont; STRING szString; switch (msg) { case WM_INITDIALOG: RibbonInit( hDlg ); ColorInit( hDlg ); GetFonts( hDlg ); CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, Text.nFont+IDC_TEXT_T1 ); Text.Size = 48; InitSlide( hDlg, IDC_TEXT_SIZE, Text.Size, 24, 200 ); Text.Angle = 0; InitSlide( hDlg, IDC_TEXT_ANGLE, 0, -2, 2 ); ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont)); for ( i=0; i<max(10,Text.nFont); i++ ) { hFont = CreateFont( /* Height */ 45, /* Width */ 0, /* Escapement */ 0, /* Orientation */ 0, /* Weight */ FW_NORMAL, /* Italic */ FALSE, /* UnderLine */ FALSE, /* StrikeOut */ FALSE, /* CharSet */ Text.lpFontList[i].fdCharSet, /* Output Precis */ OUT_CHARACTER_PRECIS, /* Clip Precis */ CLIP_DEFAULT_PRECIS, /* Quality */ PROOF_QUALITY, /* PitchAndFamily */ Text.lpFontList[i].fdPitchAndFamily, /* Face */ Text.lpFontList[i].fdFaceName ); if ( hFont ) SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_SETFONT, (WPARAM)hFont, 0L ); } if ( lpImage ) { bTextBegun = TextBegin( lpImage->hWnd, 10/*x*/, 40/*y*/ ); Tool.bActive = YES; SetFocus( lpImage->hWnd ); } else bTextBegun = NO; // fall thru case WM_CONTROLENABLE: case WM_DOCACTIVATED: break; case WM_DESTROY: if ( bTextBegun ) { if ( lpImage ) { TextEnd( lpImage->hWnd, NO/*fCancel*/ ); Tool.bActive = NO; AstralUpdateWindow( lpImage->hWnd ); } bTextBegun = NO; } for ( i=0; i<max(10,Text.nFont); i++ ) { if ( hFont = (HFONT)SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_GETFONT, (WPARAM)0, 0L ) ) DeleteObject( hFont ); } if ( Text.lpFontList ) { FreeUp((LPTR)Text.lpFontList); Text.lpFontList = NULL; } break; case WM_CHAR: if ( !lpImage || !bTextBegun ) return( FALSE ); TextSetFocus(); wKey = (WORD)lParam; TextKeystroke( lpImage->hWnd, wKey ); if ( wKey == VK_RETURN ) { TextAnchor( lpImage->hWnd ); RandomizeActiveColor(); break; } szString[0] = '_'; szString[1] = wKey; szString[2] = '\0'; Lowercase( szString ); SoundStartResource( szString, NO/*bLoop*/, NULL/*hInstance*/ ); break; case WM_KEYDOWN: if ( !lpImage || !bTextBegun ) return( FALSE ); wKey = lParam; switch (wKey) { case VK_UP: TextRMove( lpImage->hWnd, 0, -1 ); break; case VK_DOWN: TextRMove( lpImage->hWnd, 0, 1); break; case VK_LEFT: TextRMove( lpImage->hWnd, -1, 0); break; case VK_RIGHT: TextRMove( lpImage->hWnd, 1, 0); break; default: break; } break; case WM_SETCURSOR: return( SetupCursor( wParam, lParam, IDD_TEXT ) ); case WM_ERASEBKGND: break; // handle ERASEBKGND and do nothing; PAINT covers everything case WM_PAINT: LayoutPaint( hDlg ); break; case WM_CLOSE: AstralDlgEnd( hDlg, FALSE ); break; case WM_MEASUREITEM: case WM_DRAWITEM: return( OwnerDraw( hDlg, msg, lParam, NO ) ); case WM_CTLCOLOR: // We don't get this message // Print( "%u", HIWORD(lParam) ); // if ( HIWORD(lParam) == CTLCOLOR_BTN ) // { // SetTextColor( (HDC)wParam, RGB(0,0,255) ); // Blue text... // SetBkColor( (HDC)wParam, RGB(255,255,255) ); // on a white background // return( GetStockObject(WHITE_BRUSH) ); // } return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam), HIWORD(lParam) ) ); case WM_COMMAND: switch (wParam) { case IDC_ACTIVECOLOR: case IDC_COLORS_TEXT: ColorCommand( hDlg, wParam, lParam ); TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; case IDC_TEXT_T1: case IDC_TEXT_T2: case IDC_TEXT_T3: case IDC_TEXT_T4: case IDC_TEXT_T5: case IDC_TEXT_T6: case IDC_TEXT_T7: case IDC_TEXT_T8: case IDC_TEXT_T9: case IDC_TEXT_T10: CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, wParam ); Text.nFont = wParam - IDC_TEXT_T1; ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont)); TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; case IDC_TEXT_SIZE: Text.Size = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL ); Text.Size = bound( Text.Size, 16, 216 ); if ( !LBUTTON ) TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; case IDC_TEXT_ANGLE: i = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL ); // -2 to 2 Text.Angle = (i * 45); if ( Text.Angle < 0 ) Text.Angle += 360; i = (Text.Angle + 22) / 45; // down to 0-8 if ( i > 4 ) i = bound( i - 8, -2, 0 ); else i = bound( i, 0, 2 ); SetSlide( hDlg, wParam, i ); if ( !LBUTTON ) TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; default: return( FALSE ); } default: return( FALSE ); } return( TRUE ); }
// main dialog constructor MusikFrame::MusikFrame() : wxFrame( (wxFrame*)NULL, -1, MUSIKAPPNAME_VERSION, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL | wxCLIP_CHILDREN ) { //--- pointer to main dialog, defined in MusikGlobals ---// g_MusikFrame = this; //--- prevent destroying saved placement info while constructing the frame ---// g_DisablePlacement = true; //--- icon ---// #ifdef __WXMSW__ SetIcon( wxICON( musicbox ) ); #endif #ifdef __WXGTK__ SetIcon( wxIcon(tray_xpm) ); #endif #ifdef wxHAS_TASK_BAR_ICON if(wxGetApp().Prefs.bDisableTrayIcon) m_pTaskBarIcon = NULL; else m_pTaskBarIcon = new MusikTaskBarIcon(this); #endif #ifdef __WXMAC__ MacSetMetalAppearance(true); #endif //--- colours ---// // this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) ); //--- load image lists and fonts ---// LoadImageLists(); GetFonts(); //-------------------------// //--- initialize sizers ---// //-------------------------// m_pBottomPanel = new BottomPanel(this); m_pBottomPanel->SetDefaultSize(wxSize(1000,70)); m_pBottomPanel->SetAlignment(wxGetApp().Prefs.bShowNowPlayingControlOnTop == true ? wxLAYOUT_TOP : wxLAYOUT_BOTTOM); m_pBottomPanel->SetOrientation(wxLAYOUT_HORIZONTAL); //----------------// //--- playlist ---// //----------------// g_PlaylistBox = new CPlaylistBox( this ); GetListCtrlFont(); //---------------// //--- sources ---// //---------------// g_SourcesCtrl = new CSourcesBox( this ); g_SourcesCtrl->SetSashVisible(wxSASH_RIGHT, true); g_SourcesCtrl->SetDefaultSize(wxSize(wxGetApp().Prefs.nSourceBoxWidth,1000)); g_SourcesCtrl->SetAlignment(wxLAYOUT_LEFT); g_SourcesCtrl->SetOrientation(wxLAYOUT_VERTICAL); g_SourcesCtrl->SetSashBorder(wxSASH_RIGHT, true); g_SourcesCtrl->SetSashBorder(wxSASH_RIGHT, true); g_SourcesCtrl->SetDefaultBorderSize(3); g_SourcesCtrl->SetExtraBorderSize(1); //---------------------// //--- activity area ---// //---------------------// g_ActivityAreaCtrl = new CActivityAreaCtrl( this ); g_ActivityAreaCtrl->SetSashVisible(wxSASH_BOTTOM, true); g_ActivityAreaCtrl->SetDefaultSize(wxSize(1000,wxGetApp().Prefs.nActivityCtrlHeight)); g_ActivityAreaCtrl->SetAlignment(wxLAYOUT_TOP); g_ActivityAreaCtrl->SetOrientation(wxLAYOUT_HORIZONTAL); g_ActivityAreaCtrl->SetSashBorder(wxSASH_BOTTOM, true); g_ActivityAreaCtrl->SetDefaultBorderSize(3); g_ActivityAreaCtrl->SetExtraBorderSize(1); //--- taylor ui ---// ShowPlaylistInfo(); ShowSources(); ShowAlbumArt(); SetStayOnTop(( bool )wxGetApp().Prefs.bStayOnTop); CreateMainMenu(); //--- restore placement or use defaults ---// g_DisablePlacement = false; wxGetApp().Player.SetPlaymode(wxGetApp().Prefs.ePlaymode); //--- update database information, then set sound volume ---// wxGetApp().Player.SetVolume(); wxGetApp().Player.Connect(wxEVT_MUSIKPLAYER_SONG_CHANGED,MusikPlayerEventHandler(MusikFrame::OnSongChanged),NULL,this); wxGetApp().Player.Connect(wxEVT_MUSIKPLAYER_PLAY_STOP,MusikPlayerEventHandler(MusikFrame::OnPlayStop),NULL,this); SetTitle(); SetSongInfoText(MUSIKAPPNAME); SetActiveThread( NULL ); #ifdef __WXMSW__ SetMMShellHook((HWND)GetHWND()); #endif #ifdef __WXGTK__ XF86AudioKeyGrab_init(); #endif }