📄 introductionwizard.cpp
字号:
msg = kMsg1;
else if (ctrlId == IDC_RELATABLE_TEXT2)
msg = kMsg2;
DrawText(dis->hDC,
msg,
strlen(msg),
&clientRect,
DT_LEFT|DT_WORDBREAK);
SelectObject(dis->hDC, oldFont);
DeleteObject(font);
break;
}
//case IDC_RELATABLE_CAPTION1:
case IDC_RELATABLE_CAPTION2:
{
HFONT font, oldFont;
LOGFONT lf;
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
font = CreateFontIndirect(&lf);
oldFont = (HFONT)SelectObject(dis->hDC, font);
RECT clientRect;
GetClientRect(dis->hwndItem, &clientRect);
const char* caption;
if(ctrlId == IDC_RELATABLE_CAPTION1)
caption = kCaption1;
else if(ctrlId == IDC_RELATABLE_CAPTION2)
caption = kCaption2;
DrawText(dis->hDC,
caption,
strlen(caption),
&clientRect,
DT_LEFT|DT_WORDBREAK);
SelectObject(dis->hDC, oldFont);
DeleteObject(font);
break;
}
}
break;
}
case WM_NOTIFY:
{
switch(((NMHDR*)lParam)->code)
{
case PSN_KILLACTIVE:
{
SetWindowLong(hwnd, DWL_MSGRESULT, FALSE);
result = TRUE;
break;
}
case PSN_RESET:
{
SetWindowLong(hwnd, DWL_MSGRESULT, FALSE);
break;
}
case PSN_SETACTIVE:
{
PropSheet_SetWizButtons(GetParent(hwnd), PSWIZB_BACK | PSWIZB_NEXT);
break;
}
case PSN_WIZNEXT:
{
if (Button_GetCheck(hwndOptOut) == BST_CHECKED)
{
PropSheet_RemovePage(GetParent(hwnd), 2, NULL);
}
break;
}
case PSN_WIZBACK:
{
break;
}
}
break;
}
}
return result;
}
static BOOL CALLBACK IntroWizardRelatableTwo(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
BOOL result = FALSE;
static APSInterface *pInterface;
switch(msg)
{
case WM_INITDIALOG:
{
PROPSHEETPAGE *psp = (PROPSHEETPAGE*)lParam;
pInterface = (APSInterface *)psp->lParam;
break;
}
case WM_DRAWITEM:
{
DRAWITEMSTRUCT* dis = (DRAWITEMSTRUCT*)lParam;
UINT ctrlId = wParam;
const char* kCaption3 = "Here's how to enjoy Relatable Features";
const char* kMsg1 = "Relatable automatically generates personalized playlists that are\n"
"based on the files located on your computer and the music you\n"
"listen to on the Web. The more you use the player, the better it\n"
"works! Enter a profile name in the window below. Then start\n"
"listening to music. After you have listened to a few songs, hit\n"
"'Recommend Playlist' on the Relatable menu to hear a personalized\n"
"playlist. If you'd like to find music streams that are playing\n"
"songs you like, check out the 'Recommended Streams' item in the\n"
"'My Music' tree.\n\n"
"Note: You can create additional music profiles by selecting\n"
"'Profiles' under the 'Options' menu in the My Music window. Check\n"
"out the Help menu for details on all the Relatable features,\n"
"or drop us a note with questions to info@relatable.com\n";
const char* kCaption1 = "Profile Name: ";
switch(ctrlId)
{
case IDC_RELATABLE_TEXT1:
{
HFONT font, oldFont;
font = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
oldFont = (HFONT)SelectObject(dis->hDC, font);
RECT clientRect;
GetClientRect(dis->hwndItem, &clientRect);
DrawText(dis->hDC,
kMsg1,
strlen(kMsg1),
&clientRect,
DT_LEFT|DT_WORDBREAK);
SelectObject(dis->hDC, oldFont);
DeleteObject(font);
break;
}
case IDC_RELATABLE_CAPTION1:
{
HFONT font, oldFont;
font = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
oldFont = (HFONT)SelectObject(dis->hDC, font);
RECT clientRect;
GetClientRect(dis->hwndItem, &clientRect);
RECT halfHeightRect = clientRect;
int halfHeight = DrawText(
dis->hDC,
kCaption1,
strlen(kCaption1),
&halfHeightRect,
DT_LEFT|DT_SINGLELINE|DT_CALCRECT)/2;
int height;
height = DrawText(
dis->hDC,
kCaption1,
strlen(kCaption1),
&clientRect,
DT_LEFT|DT_WORDBREAK);
clientRect.top += height + halfHeight;
SelectObject(dis->hDC, oldFont);
DeleteObject(font);
break;
}
case IDC_RELATABLE_CAPTION3:
{
HFONT font, oldFont;
LOGFONT lf;
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
font = CreateFontIndirect(&lf);
oldFont = (HFONT)SelectObject(dis->hDC, font);
RECT clientRect;
GetClientRect(dis->hwndItem, &clientRect);
DrawText(dis->hDC,
kCaption3,
strlen(kCaption3),
&clientRect,
DT_LEFT|DT_WORDBREAK);
SelectObject(dis->hDC, oldFont);
DeleteObject(font);
break;
}
case IDC_RELATABLE_EDIT1:
{
break;
}
}
break;
}
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDC_RELATABLE_WEB:
{
ShellExecute(hwnd, "open", "http://beta.relatable.com", NULL,
NULL, SW_SHOWNORMAL);
break;
}
}
break;
}
case WM_NOTIFY:
{
switch(((NMHDR*)lParam)->code)
{
case PSN_KILLACTIVE:
{
SetWindowLong(hwnd, DWL_MSGRESULT, FALSE);
result = TRUE;
break;
}
case PSN_RESET:
{
SetWindowLong(hwnd, DWL_MSGRESULT, FALSE);
break;
}
case PSN_SETACTIVE:
{
PropSheet_SetWizButtons(GetParent(hwnd), PSWIZB_BACK | PSWIZB_NEXT);
break;
}
case PSN_WIZNEXT:
{
HWND hwndProfileEdit = GetDlgItem(hwnd, IDC_RELATABLE_EDIT1);
char temp[MAX_PATH];
Edit_GetText( hwndProfileEdit,
temp,
MAX_PATH);
//MessageBox(NULL, temp, "Value", MB_OK | MB_SYSTEMMODAL);
if (!string(temp).empty())
{
pInterface->CreateProfile(temp);
}
break;
}
case PSN_WIZBACK:
{
break;
}
}
break;
}
}
return result;
}
bool MusicBrowserUI::IntroductionWizard(vector<string>* searchPaths,
APSInterface *pInterface)
{
PROPSHEETPAGE psp[4];
PROPSHEETHEADER psh;
HINSTANCE hinst = (HINSTANCE)GetWindowLong(m_hWnd, GWL_HINSTANCE);
psp[0].dwSize = sizeof(PROPSHEETPAGE);
psp[0].dwFlags = 0;
psp[0].hInstance = hinst;
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_INTROWIZARD_HELLO);
psp[0].pszIcon = NULL;
psp[0].pfnDlgProc = IntroWizardHello;
psp[0].pszTitle = NULL;
psp[0].lParam = (LPARAM)0;
psp[1].dwSize = sizeof(PROPSHEETPAGE);
psp[1].dwFlags = 0;
psp[1].hInstance = hinst;
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_INTROWIZARD_RELATABLE);
psp[1].pszIcon = NULL;
psp[1].pfnDlgProc = IntroWizardRelatable;
psp[1].pszTitle = NULL;
psp[1].lParam = (LPARAM)0 ;
psp[2].dwSize = sizeof(PROPSHEETPAGE);
psp[2].dwFlags = 0;
psp[2].hInstance = hinst;
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_INTROWIZARD_RELATABLETWO);
psp[2].pszIcon = NULL;
psp[2].pfnDlgProc = IntroWizardRelatableTwo;
psp[2].pszTitle = NULL;
psp[2].lParam = (LPARAM)pInterface;
psp[3].dwSize = sizeof(PROPSHEETPAGE);
psp[3].dwFlags = 0;
psp[3].hInstance = hinst;
psp[3].pszTemplate = MAKEINTRESOURCE(IDD_INTROWIZARD_SEARCH);
psp[3].pszIcon = NULL;
psp[3].pfnDlgProc = IntroWizardSearch;
psp[3].pszTitle = NULL;
psp[3].lParam = (LPARAM)searchPaths;
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_WIZARD | PSH_NOAPPLYNOW;
psh.hwndParent = m_hWnd;
psh.hInstance = hinst;
psh.pszIcon = NULL;
psh.pszCaption = "Welcome to "the_BRANDING;
psh.nPages = sizeof(psp)/sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
psh.pfnCallback = NULL;
return (PropertySheet(&psh) > 0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -