Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
neatdecisions committed Dec 6, 2016
0 parents commit 49e8c78
Show file tree
Hide file tree
Showing 155 changed files with 68,652 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Microsoft Public License (MS-PL)

This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.

1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.

2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.

3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
20 changes: 20 additions & 0 deletions NeatMouse.sln
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NeatMouseWtl", "NeatMouseWtl\NeatMouseWtl.vcxproj", "{CC76D00F-9B8E-4203-BB11-D47201DCE859}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC76D00F-9B8E-4203-BB11-D47201DCE859}.Debug|Win32.ActiveCfg = Debug|Win32
{CC76D00F-9B8E-4203-BB11-D47201DCE859}.Debug|Win32.Build.0 = Debug|Win32
{CC76D00F-9B8E-4203-BB11-D47201DCE859}.Release|Win32.ActiveCfg = Release|Win32
{CC76D00F-9B8E-4203-BB11-D47201DCE859}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
184 changes: 184 additions & 0 deletions NeatMouseWtl/AboutDlg.cpp
@@ -0,0 +1,184 @@
//
// Copyright © 2016 Neat Decisions. All rights reserved.
//
// This file is part of NeatMouse.
// The use and distribution terms for this software are covered by the
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
// which can be found in the file LICENSE at the root folder.
//

#include "stdafx.h"
#include "resource.h"

#include "AboutDlg.h"

#include "logic/MainSingleton.h"
#include "neatcommon/ui/CustomizedControls.h"
#include "neatcommon/system/AutorunManager.h"

namespace neatmouse {

const TCHAR * kRegistryStartupValueName = _T("NeatMouse");


//=====================================================================================================================
// CAboutDlg
//=====================================================================================================================

//---------------------------------------------------------------------------------------------------------------------
void
CAboutDlg::localize()
{
GetDlgItem(IDC_STATIC_ITALIAN).SetWindowText(_("about.translation-contrib"));
SetWindowText(_("about.caption"));
visitLink.SetLabel(_("about.lnk-visit-site"));
someIcons.SetText(_("about.some-icons"));

CRect layoutRect;
someIcons.GetWindowRect(&layoutRect);
ScreenToClient(&layoutRect);

ykLink.SetWindowPos(HWND_BOTTOM, layoutRect.right, layoutRect.top, 0, 0, SWP_NOSIZE);

CButton btn;
btn.Attach(GetDlgItem(IDOK));
btn.Detach();

btn.Attach(GetDlgItem(IDC_CHECK_RUN_AT_STARTUP));
btn.SetWindowText(_("about.chk-run-at-startup"));
btn.Detach();
}


//---------------------------------------------------------------------------------------------------------------------
LRESULT
CAboutDlg::OnInitDialog(HWND, LRESULT)
{
CenterWindow(GetParent());

// check if registry setting says that program should run at startup
CButton cfu;
cfu.Attach(GetDlgItem(IDC_CHECK_RUN_AT_STARTUP));
cfu.SetCheck(neatcommon::system::AutorunManager().getAutostartEnabled(kRegistryStartupValueName) ? BST_CHECKED : BST_UNCHECKED);
cfu.Detach();

SetTextBackGround(0xFFFFFF);

LONG lStyle = GetWindowLong(GWL_STYLE);
lStyle &= ~(WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
SetWindowLong(GWL_STYLE, lStyle);

SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);

neatcommon::system::ProductInfo info;
neatcommon::system::GetProductVersion(info);

WTL::CString s(_T("NeatMouse"));

titleFont.CreateFont(gMetrics.PointsToPixels(24), 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, OEM_CHARSET, 0, 0, DEFAULT_QUALITY, FF_ROMAN, _T("Verdana"));
programName.Attach(GetDlgItem(IDC_STATIC_PROGRAMNAME));
programName.SetFont(titleFont);
programName.SetText(s);

s.Format(_T("v%d.%02d.%03d"),
info.major,
info.minor,
MAKELONG(info.build2, info.build1));

versionFont.CreateFont(0, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, OEM_CHARSET, 0, 0, DEFAULT_QUALITY, FF_ROMAN, _T("Verdana"));
programVersion.Attach(GetDlgItem(IDC_STATIC_VERSION));
programVersion.SetWindowText(s);


ykLink.SetHyperLinkExtendedStyle(HLINK_UNDERLINEHOVER);
ykLink.SubclassWindow(GetDlgItem(IDC_STATIC_YK));
ykLink.SetHyperLink(_T("http://p.yusukekamiyamane.com"));

visitLink.SetHyperLinkExtendedStyle(HLINK_UNDERLINEHOVER);
visitLink.SubclassWindow(GetDlgItem(IDC_STATIC_VISIT));
visitLink.SetHyperLink(WTL::CString(LINK_SITE));

link.SetHyperLinkExtendedStyle(HLINK_UNDERLINEHOVER);
link.SubclassWindow(GetDlgItem(IDC_STATIC_UPDATE));

link.SetHyperLink(WTL::CString(LINK_GITHUB));
link.SetLabel(_("about.github"));

someIcons.Attach(GetDlgItem(IDC_STATIC_SOMEICONS));

localize();
Invalidate();

return TRUE;
}


//---------------------------------------------------------------------------------------------------------------------
LRESULT
CAboutDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}


//---------------------------------------------------------------------------------------------------------------------
LRESULT
CAboutDlg::OnRunAtStartup(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CButton checkBox(GetDlgItem(IDC_CHECK_RUN_AT_STARTUP));
neatcommon::system::AutorunManager().enableAutostart(kRegistryStartupValueName, checkBox.GetCheck() == BST_CHECKED);
checkBox.Detach();
return 0;
}


//---------------------------------------------------------------------------------------------------------------------
LRESULT
CAboutDlg::OnSetCursor(CWindow /*wndTopLevel*/, UINT /*nHitTest*/, UINT /*message*/)
{
SetCursor(::LoadCursor(NULL, IDC_ARROW));
SetMsgHandled(TRUE);
return TRUE;
}


//---------------------------------------------------------------------------------------------------------------------
LRESULT
CAboutDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
titleFont.DeleteObject();
versionFont.DeleteObject();
bHandled = FALSE;
return 1;
}


//---------------------------------------------------------------------------------------------------------------------
LRESULT
CAboutDlg::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(&ps);
{
CSize sz;
CRect rc;
GetClientRect(rc);
CBitmapHandle bmp = SafeLoadPng(IDB_PNG_LOGO);
bmp.GetSize(sz);
neatcommon::ui::DrawBitmapAdvanced(hDC, bmp, rc.right - sz.cx - 10, 0, sz.cx, sz.cy);

CWindow wnd = GetDlgItem(IDC_STATIC_UPDATE);
if (wnd.GetWindowRect(&rc))
{
ScreenToClient(&rc);
rc.left -= 20;
neatcommon::ui::DrawBitmapAdvanced(hDC, SafeLoadPng(IDB_PNG_GITHUB), rc.left, rc.top, 16, 16);
}
}
EndPaint(&ps);
bHandled = FALSE;
return 1;
}

} // namespace neatmouse
59 changes: 59 additions & 0 deletions NeatMouseWtl/AboutDlg.h
@@ -0,0 +1,59 @@
//
// Copyright © 2016 Neat Decisions. All rights reserved.
//
// This file is part of NeatMouse.
// The use and distribution terms for this software are covered by the
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
// which can be found in the file LICENSE at the root folder.
//

#if !defined(AFX_ABOUTDLG_H__9FC06A67_16FB_4850_A710_A019A43266BF__INCLUDED_)
#define AFX_ABOUTDLG_H__9FC06A67_16FB_4850_A710_A019A43266BF__INCLUDED_


#include "neatcommon/ui/CCtlColor.h"
#include "neatcommon/ui/CustomizedControls.h"

namespace neatmouse {

//=====================================================================================================================
// CAboutDlg
//=====================================================================================================================
class CAboutDlg : public CDialogImpl<CAboutDlg>,
public CCtlColored<CAboutDlg>
{
public:
enum { IDD = IDD_ABOUTBOX };

BEGIN_MSG_MAP_EX(CAboutDlg)
MSG_WM_INITDIALOG(OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
COMMAND_ID_HANDLER(IDC_CHECK_RUN_AT_STARTUP, OnRunAtStartup)
MSG_WM_SETCURSOR(OnSetCursor)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
CHAIN_MSG_MAP(CCtlColored<CAboutDlg>)
END_MSG_MAP()

LRESULT OnInitDialog(HWND, LRESULT);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnSetCursor(CWindow wndTopLevel, UINT nHitTest, UINT message);
LRESULT OnRunAtStartup(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

void localize();

protected:
CHyperLink link, ykLink, visitLink;
neatcommon::ui::CAutosizeStatic programName;
CStatic programVersion;
neatcommon::ui::CAutosizeStatic someIcons;

CFont titleFont, versionFont;
};

} // namespace neatmouse

#endif // !defined(AFX_ABOUTDLG_H__9FC06A67_16FB_4850_A710_A019A43266BF__INCLUDED_)

0 comments on commit 49e8c78

Please sign in to comment.