Skip to content

Commit

Permalink
[#37] Introductory guidepost for new users (Part 16: Added suggestion…
Browse files Browse the repository at this point in the history
… for newbies on how to start)
  • Loading branch information
tomas-nestorovic committed Aug 29, 2020
1 parent 4cac6b5 commit ac060f2
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions Main/src/TdiView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class CIntroductoryGuidePost sealed:public Utils::CRideDialog{
const Utils::CRideFont sectionTitleFont;
const Utils::CRideFont buttonCaptionFont;
const int singleLineButtonHeight;
BYTE nCategories;
struct{
LONG posY;
Expand All @@ -34,6 +35,7 @@
: Utils::CRideDialog(IDR_GUIDEPOST)
, sectionTitleFont( FONT_MS_SANS_SERIF, 90, true, true )
, buttonCaptionFont( FONT_MS_SANS_SERIF, 80, false, true )
, singleLineButtonHeight( buttonCaptionFont.charHeight+2*(1+::GetSystemMetrics(SM_CYBORDER)) )
, nCategories(0) {
}

Expand Down Expand Up @@ -62,11 +64,10 @@
void __addButton__(LPCTSTR caption,UINT id,WCHAR wingdingsGlyphBeforeText='\0',COLORREF glyphColor=COLOR_BLACK){
// adds a new button under currently open category
ASSERT(nCategories>0); // a category must currently be open
const int height=buttonCaptionFont.charHeight+2*(1+::GetSystemMetrics(SM_CYBORDER));
Utils::ConvertToCommandLikeButton(
::CreateWindow(
WC_BUTTON, caption, WS_VISIBLE|WS_CHILD,
rcCurrContent.left,rcCurrContent.top, rcCurrContent.Width(),height,
rcCurrContent.left,rcCurrContent.top, rcCurrContent.Width(),singleLineButtonHeight,
m_hWnd, (HMENU)id, app.m_hInstance, nullptr
),
wingdingsGlyphBeforeText,
Expand All @@ -75,7 +76,20 @@
glyphColor
);
SendDlgItemMessage( id, WM_SETFONT, (WPARAM)buttonCaptionFont.m_hObject );
rcCurrContent.top+=height;
rcCurrContent.top+=singleLineButtonHeight;
}

void __addHyperlinkText__(LPCWSTR hyperlinkText){
// adds a new static text under currently open category
::SendMessage(
::CreateWindowW(
WC_LINK, hyperlinkText, WS_VISIBLE|WS_CHILD|SS_CENTERIMAGE,
rcCurrContent.left,rcCurrContent.top, rcCurrContent.Width(),singleLineButtonHeight,
m_hWnd, 0, app.m_hInstance, nullptr
),
WM_SETFONT, (WPARAM)buttonCaptionFont.m_hObject, 0
);
rcCurrContent.top+=singleLineButtonHeight;
}

void PreInitDialog() override{
Expand Down Expand Up @@ -104,8 +118,10 @@
::PathCompactPath( CClientDC(this), buf, rcCurrContent.Width() );
__addButton__( buf, ID_FILE_MRU_FILE1+i, 0xf030, 0x47bbbb );
}
if (!i)
__addStaticText__( _T("Currently none. Files you open or drives you access will be shown here."), buttonCaptionFont );
if (!i){
//__addStaticText__( _T("Currently none. Files you open or drives you access will be shown here."), buttonCaptionFont );
__addHyperlinkText__( L"Currently none. Begin by <a id=\"OPENIMG\">opening an image</a> or <a id=\"ACCSDRV\">accessing a drive</a>." );
}
// - composing the "FAQ" section
__addCategory__( _T("Frequent questions (network connection needed)"), 0xf0a8 );
#define HELP_GLYPH_COLOR 0x585858
Expand All @@ -123,6 +139,11 @@
SetWindowPos( nullptr, 0,0, rc.Width(), rcCurrContent.top+20, SWP_NOZORDER|SWP_NOMOVE|SWP_FRAMECHANGED );
}

void OnCancel() override{
// the Dialog is about the be closed
//nop (user can't close the Guidepost)
}

LRESULT WindowProc(UINT msg,WPARAM wParam,LPARAM lParam) override{
// window procedure
switch (msg){
Expand Down Expand Up @@ -175,6 +196,16 @@
return 0;
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code==NM_CLICK){ // some hyperlink clicked
const PNMLINK pNmLink=(PNMLINK)lParam;
if (!::lstrcmpW(pNmLink->item.szID,L"OPENIMG"))
app.__openImage__();
else if (!::lstrcmpW(pNmLink->item.szID,L"ACCSDRV"))
app.__openDevice__();
return 0;
}
break;
case WM_NCDESTROY:
// window is about to be destroyed
__super::WindowProc(msg,wParam,lParam);
Expand Down

0 comments on commit ac060f2

Please sign in to comment.