Skip to content

Commit acbfa72

Browse files
author
Adrian
committed
- Fix signature decoder
- Update google login button appearance - Update langs - Update youtube-dl
1 parent 513bd97 commit acbfa72

14 files changed

+48
-30
lines changed

AIMPYouTube.rc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
1414
IDR_CONNECTRES1 CONNECTRESP "Resources\\connect_status.html"
1515

1616
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
17-
IDB_WHITELOGO PNG "Resources\\white_logo.png"
17+
IDB_GOOGLEBTN PNG "Resources\\google_btn.png"
1818

1919
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
20-
IDB_ORANGELOGO PNG "Resources\\orange_logo.png"
20+
IDB_GOOGLEFONT TTF "Resources\\Roboto-Medium.ttf"
2121

2222
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
2323
IDB_ICON PNG "Resources\\icon.png"
@@ -73,7 +73,7 @@ FONT 8, "Tahoma", 400, 0, 0
7373
CONTROL "", IDC_YTDLTIMEOUTSPIN, UPDOWN_CLASS, UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 87, 212, 11, 15, WS_EX_LEFT | WS_TABSTOP
7474
AUTOCHECKBOX "Always use youtube-dl", IDC_YTDLFORCE, 15, 183, 250, 8, 0, WS_EX_LEFT | WS_TABSTOP
7575
EDITTEXT IDC_YTDLPARAMS, 58, 195, 137, 14, ES_AUTOHSCROLL, WS_EX_LEFT
76-
LTEXT "aimp_YouTube v1.3", IDC_VERSION, 30, 244, 285, 8, SS_LEFT | SS_NOTIFY, WS_EX_LEFT
76+
LTEXT "aimp_YouTube v1.4", IDC_VERSION, 30, 244, 285, 8, SS_LEFT | SS_NOTIFY, WS_EX_LEFT
7777
}
7878

7979

Langs/english.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PlaylistName=Playlist name (optional)
3131
[YouTube.Options]
3232
Title=YouTube
3333
Account=YouTube account
34-
ConnectButton=Connect|Disconnect
34+
ConnectButton=Sign in with Google|Sign out
3535
General=General
3636
MonitorURLs=Monitor added URLs
3737
MonitorUserPlaylists=Monitor user's playlists

Langs/polish.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PlaylistName=Nazwa playlisty (opcjonalnie)
3131
[YouTube.Options]
3232
Title=YouTube
3333
Account=Konto YouTube
34-
ConnectButton=Zaloguj się|Wyloguj się
34+
ConnectButton=Zaloguj się z Google|Wyloguj się
3535
General=Ogólne
3636
MonitorURLs=Monitoruj dodane adresy
3737
MonitorUserPlaylists=Monitoruj playlisty użytkownika

Langs/ukrainian.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[FILE]
1+
[FILE]
22
Author=Олександр (6c6c6) [http://localize.org.ua/]
33
Name=Ukrainian (UK)
44
VersionID=0

OptionsDialog.cpp

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -307,30 +307,30 @@ void GetRoundRectPath(Gdiplus::GraphicsPath *pPath, Gdiplus::Rect r, int dia) {
307307
LRESULT CALLBACK OptionsDialog::ButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
308308
using namespace Gdiplus;
309309
struct PaintData {
310-
GdiPlusImageLoader Logo;
311310
std::wstring Text;
312311
Font Font;
313-
Pen BorderPen;
314-
ARGB Gradient[2];
315312
SolidBrush TextColor;
316-
Pen LinePen;
317313
int LogoOffset;
318314
int Margin;
319315
int Height;
320316
};
321317

322-
static PaintData connect { { IDB_WHITELOGO, L"PNG" }, {}, { L"Tahoma", 10, FontStyleBold }, 0xffd05300, { 0xffdc4a33, 0xffcd4127 }, 0xffffffff, 0xffc83f27, 39, 66, 35 };
323-
static PaintData disconnect { { IDB_ORANGELOGO, L"PNG" }, {}, { L"Tahoma", 10 }, 0xffbfbfbf, { 0xffffffff, 0xfff1f1f1 }, 0xff333333, 0xffe4e4e4, 33, 56, 27 };
318+
static PrivateFontCollection pfc;
319+
320+
static PaintData connect { {}, { L"Roboto Medium", 14, FontStyleBold, UnitPixel, &pfc }, 0x8a000000, 33, 72, 46 };
321+
static PaintData disconnect { {}, { L"Roboto Medium", 14, FontStyleBold, UnitPixel, &pfc }, 0x8a000000, 33, 72, 46 };
322+
323+
static GdiPlusImageLoader BtnBackground { IDB_GOOGLEBTN, L"PNG" };
324324

325325
static PaintData *currentBtn = nullptr;
326326
static OptionsDialog *dialog = nullptr;
327327
static bool mouseOver = false;
328328
static bool customFocus = false;
329329
static bool connected = false;
330330

331-
static Rect r;
331+
static Rect r, outer;
332332
static RectF layoutRect;
333-
static SolidBrush focusBrush(0x11000000);
333+
static SolidBrush focusBrush(0x0A000000);
334334
static Gdiplus::GraphicsPath borderPath;
335335
static Gdiplus::StringFormat format;
336336

@@ -339,6 +339,13 @@ LRESULT CALLBACK OptionsDialog::ButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam,
339339
dialog = (OptionsDialog *)dwRefData;
340340
format.SetAlignment(StringAlignmentCenter);
341341
format.SetLineAlignment(StringAlignmentCenter);
342+
if (HRSRC hResource = ::FindResource(g_hInst, MAKEINTRESOURCE(IDB_GOOGLEFONT), L"TTF")) {
343+
if (DWORD dataSize = ::SizeofResource(g_hInst, hResource)) {
344+
if (void *pResourceData = ::LockResource(::LoadResource(g_hInst, hResource))) {
345+
pfc.AddMemoryFont(pResourceData, dataSize);
346+
}
347+
}
348+
}
342349
} break;
343350
case WM_MOUSELEAVE: mouseOver = false; break;
344351
case WM_MOUSEMOVE: mouseOver = true; break;
@@ -362,35 +369,42 @@ LRESULT CALLBACK OptionsDialog::ButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam,
362369
currentBtn = &connect;
363370
}
364371
Gdiplus::Graphics(hWnd).MeasureString(currentBtn->Text.c_str(), currentBtn->Text.size(), &currentBtn->Font, PointF(0, 0), &textRect);
365-
r.Width = textRect.Width + currentBtn->Margin;
366-
r.Height = currentBtn->Height;
372+
outer.Width = textRect.Width + currentBtn->Margin;
373+
outer.Height = currentBtn->Height;
374+
r.X = 3;
375+
r.Y = 3;
376+
r.Width = outer.Width - 6;
377+
r.Height = outer.Height - 6;
367378
if (connected) {
368-
SetWindowPos(hWnd, NULL, rc.right - r.Width - 10, rc.bottom - r.Height - 10, r.Width, r.Height, SWP_NOZORDER);
379+
SetWindowPos(hWnd, NULL, rc.right - outer.Width - 10, rc.bottom - outer.Height - 10, outer.Width, outer.Height, SWP_NOZORDER);
369380
} else {
370-
SetWindowPos(hWnd, NULL, rc.left + ((rc.right - rc.left) - r.Width) / 2, rc.top + ((rc.bottom - rc.top) - r.Height) / 2, r.Width, r.Height, SWP_NOZORDER);
381+
SetWindowPos(hWnd, NULL, rc.left + ((rc.right - rc.left) - outer.Width) / 2, rc.top + ((rc.bottom - rc.top) - outer.Height) / 2, outer.Width, outer.Height, SWP_NOZORDER);
371382
}
372383

373-
GetRoundRectPath(&borderPath, r, 4);
374-
layoutRect = RectF(currentBtn->LogoOffset, 0, r.Width - currentBtn->LogoOffset, r.Height);
384+
layoutRect = RectF(currentBtn->LogoOffset, 3, r.Width - currentBtn->LogoOffset, r.Height);
385+
GetRoundRectPath(&borderPath, r, 6);
375386
} break;
376387
case WM_PAINT: {
377388
PAINTSTRUCT ps;
378389
HDC hdc = BeginPaint(hWnd, &ps);
379390
Gdiplus::Graphics g(hdc);
391+
g.Clear(0xfff0f0f0);
392+
393+
g.DrawImage(BtnBackground, Gdiplus::RectF(0, 0, 54, outer.Height), 0, 0, 108, 92, Gdiplus::UnitPixel); // left side
394+
g.DrawImage(BtnBackground, Gdiplus::RectF(54, 0, outer.Width - 54 - 8, outer.Height), 108, 0, 5, 92, Gdiplus::UnitPixel); // middle stretch
395+
g.DrawImage(BtnBackground, Gdiplus::RectF(outer.Width - 8, 0, 8, outer.Height), 108, 0, 16, 92, Gdiplus::UnitPixel); // right side
380396

381-
LinearGradientBrush linGrBrush(Point(0, 0), Point(0, r.Height), currentBtn->Gradient[mouseOver ? 1 : 0], currentBtn->Gradient[mouseOver ? 0 : 1]);
382-
g.FillPath(&linGrBrush, &borderPath);
383-
if (customFocus)
397+
if (customFocus || mouseOver)
384398
g.FillPath(&focusBrush, &borderPath);
385399

386-
g.DrawImage(currentBtn->Logo, 10, 7, currentBtn->Logo->GetWidth(), currentBtn->Logo->GetHeight());
387-
g.DrawLine(&currentBtn->LinePen, currentBtn->LogoOffset, 0, currentBtn->LogoOffset, r.Height);
400+
g.SetTextRenderingHint(TextRenderingHintAntiAlias);
388401
g.DrawString(currentBtn->Text.c_str(), currentBtn->Text.size(), &currentBtn->Font, layoutRect, &format, &currentBtn->TextColor);
389-
g.DrawPath(&currentBtn->BorderPen, &borderPath);
390402

391403
EndPaint(hWnd, &ps);
392404
return TRUE;
393405
}
406+
case WM_ERASEBKGND:
407+
return TRUE;
394408
case WM_SETCURSOR:
395409
SetCursor(LoadCursor(NULL, IDC_HAND));
396410
return TRUE;

Resources/Roboto-Medium.ttf

168 KB
Binary file not shown.

Resources/google-official.png

-27.1 KB
Binary file not shown.

Resources/google_btn.png

1.9 KB
Loading

Resources/orange_logo.png

-525 Bytes
Binary file not shown.

Resources/white_logo.png

-607 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)