Skip to content

Commit

Permalink
Merge pull request #2 from chcg/appveyor
Browse files Browse the repository at this point in the history
x64 and appveyor CI
  • Loading branch information
blumu authored Jul 4, 2017
2 parents 75feab0 + 04bf338 commit d870698
Show file tree
Hide file tree
Showing 23 changed files with 1,400 additions and 858 deletions.
17 changes: 13 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
# Compiled Dynamic libraries
*.so
*.dylib
*.dll

*.dll

# Symbol files
*.pdb
*.pdb

# Fortran module files
*.mod
Expand All @@ -29,4 +29,13 @@
*.exe
*.out
*.app



*.sdf
*.sln
*.suo
*.opensdf
*.exp
*.vcxproj.user
*.aps
*.zip
Binary file removed NppPlugin/ColumnSort.aps
Binary file not shown.
2 changes: 1 addition & 1 deletion NppPlugin/DockingFeature/DockingDlgInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DockingDlgInterface : public StaticDialog
};

protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM /*wParam*/, LPARAM lParam)
{
switch (message)
{
Expand Down
4 changes: 2 additions & 2 deletions NppPlugin/DockingFeature/GoToLineDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#include "GoToLineDlg.h"
#include "PluginDefinition.h"
#include "../PluginDefinition.h"

extern NppData nppData;

BOOL CALLBACK DemoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK DemoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
Expand Down
2 changes: 1 addition & 1 deletion NppPlugin/DockingFeature/GoToLineDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public :
};

protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

private :

Expand Down
126 changes: 73 additions & 53 deletions NppPlugin/DockingFeature/StaticDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#include <stdio.h>
#include "StaticDialog.h"

void StaticDialog::goToCenter()
{
RECT rc;
::GetClientRect(_hParent, &rc);
POINT center;
center.x = rc.left + (rc.right - rc.left)/2;
center.y = rc.top + (rc.bottom - rc.top)/2;
::ClientToScreen(_hParent, &center);
RECT rc;
::GetClientRect(_hParent, &rc);
POINT center;
center.x = rc.left + (rc.right - rc.left)/2;
center.y = rc.top + (rc.bottom - rc.top)/2;
::ClientToScreen(_hParent, &center);

int x = center.x - (_rc.right - _rc.left)/2;
int y = center.y - (_rc.bottom - _rc.top)/2;
Expand All @@ -36,17 +37,25 @@ HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplat
{
// Get Dlg Template resource
HRSRC hDialogRC = ::FindResource(_hInst, MAKEINTRESOURCE(dialogID), RT_DIALOG);
if (!hDialogRC)
return NULL;

HGLOBAL hDlgTemplate = ::LoadResource(_hInst, hDialogRC);
DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);

if (!hDlgTemplate)
return NULL;

DLGTEMPLATE *pDlgTemplate = reinterpret_cast<DLGTEMPLATE *>(::LockResource(hDlgTemplate));
if (!pDlgTemplate)
return NULL;

// Duplicate Dlg Template resource
unsigned long sizeDlg = ::SizeofResource(_hInst, hDialogRC);
HGLOBAL hMyDlgTemplate = ::GlobalAlloc(GPTR, sizeDlg);
*ppMyDlgTemplate = (DLGTEMPLATE *)::GlobalLock(hMyDlgTemplate);
*ppMyDlgTemplate = reinterpret_cast<DLGTEMPLATE *>(::GlobalLock(hMyDlgTemplate));

::memcpy(*ppMyDlgTemplate, pDlgTemplate, sizeDlg);
DLGTEMPLATEEX *pMyDlgTemplateEx = (DLGTEMPLATEEX *)*ppMyDlgTemplate;

DLGTEMPLATEEX *pMyDlgTemplateEx = reinterpret_cast<DLGTEMPLATEEX *>(*ppMyDlgTemplate);
if (pMyDlgTemplateEx->signature == 0xFFFF)
pMyDlgTemplateEx->exStyle |= WS_EX_LAYOUTRTL;
else
Expand All @@ -61,38 +70,43 @@ void StaticDialog::create(int dialogID, bool isRTL)
{
DLGTEMPLATE *pMyDlgTemplate = NULL;
HGLOBAL hMyDlgTemplate = makeRTLResource(dialogID, &pMyDlgTemplate);
_hSelf = ::CreateDialogIndirectParam(_hInst, pMyDlgTemplate, _hParent, (DLGPROC)dlgProc, (LPARAM)this);
_hSelf = ::CreateDialogIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
::GlobalFree(hMyDlgTemplate);
}
else
_hSelf = ::CreateDialogParam(_hInst, MAKEINTRESOURCE(dialogID), _hParent, (DLGPROC)dlgProc, (LPARAM)this);
_hSelf = ::CreateDialogParam(_hInst, MAKEINTRESOURCE(dialogID), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));

if (!_hSelf)
{
DWORD err = ::GetLastError();
char errMsg[256];
sprintf(errMsg, "CreateDialogParam() return NULL.\rGetLastError() == %u", err);
::MessageBoxA(NULL, errMsg, "In StaticDialog::create()", MB_OK);
return;
}

::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGADD, (WPARAM)_hSelf);
// if the destination of message NPPM_MODELESSDIALOG is not its parent, then it's the grand-parent
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<WPARAM>(_hSelf));
}

BOOL CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
switch (message)
{
case WM_INITDIALOG :
case WM_INITDIALOG:
{
StaticDialog *pStaticDlg = (StaticDialog *)(lParam);
StaticDialog *pStaticDlg = reinterpret_cast<StaticDialog *>(lParam);
pStaticDlg->_hSelf = hwnd;
::SetWindowLongPtr(hwnd, GWL_USERDATA, (long)lParam);
::SetWindowLongPtr(hwnd, GWLP_USERDATA, static_cast<LONG_PTR>(lParam));
::GetWindowRect(hwnd, &(pStaticDlg->_rc));
pStaticDlg->run_dlgProc(message, wParam, lParam);
pStaticDlg->run_dlgProc(message, wParam, lParam);

return TRUE;
}

default :
default:
{
StaticDialog *pStaticDlg = (StaticDialog *)(::GetWindowLongPtr(hwnd, GWL_USERDATA));
StaticDialog *pStaticDlg = reinterpret_cast<StaticDialog *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (!pStaticDlg)
return FALSE;
return pStaticDlg->run_dlgProc(message, wParam, lParam);
Expand All @@ -102,34 +116,40 @@ BOOL CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR

void StaticDialog::alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT & point)
{
RECT rc, rc2;
::GetWindowRect(handle, &rc);

point.x = rc.left;
point.y = rc.top;

switch (pos)
{
case ALIGNPOS_LEFT :
::GetWindowRect(handle2Align, &rc2);
point.x -= rc2.right - rc2.left;
break;

case ALIGNPOS_RIGHT :
::GetWindowRect(handle, &rc2);
point.x += rc2.right - rc2.left;
break;

case ALIGNPOS_TOP :
::GetWindowRect(handle2Align, &rc2);
point.y -= rc2.bottom - rc2.top;
break;

default : //ALIGNPOS_BOTTOM
::GetWindowRect(handle, &rc2);
point.y += rc2.bottom - rc2.top;
break;
}

::ScreenToClient(_hSelf, &point);
RECT rc, rc2;
::GetWindowRect(handle, &rc);

point.x = rc.left;
point.y = rc.top;

switch (pos)
{
case PosAlign::left:
{
::GetWindowRect(handle2Align, &rc2);
point.x -= rc2.right - rc2.left;
break;
}
case PosAlign::right:
{
::GetWindowRect(handle, &rc2);
point.x += rc2.right - rc2.left;
break;
}
case PosAlign::top:
{
::GetWindowRect(handle2Align, &rc2);
point.y -= rc2.bottom - rc2.top;
break;
}
case PosAlign::bottom:
{
::GetWindowRect(handle, &rc2);
point.y += rc2.bottom - rc2.top;
break;
}
}

::ScreenToClient(_hSelf, &point);
}

15 changes: 6 additions & 9 deletions NppPlugin/DockingFeature/StaticDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef STATIC_DIALOG_H
#define STATIC_DIALOG_H
#pragma once

//#include "resource.h"
#include "Window.h"
#include "Notepad_plus_msgs.h"
#include "..\Notepad_plus_msgs.h"

enum PosAlign{ALIGNPOS_LEFT, ALIGNPOS_RIGHT, ALIGNPOS_TOP, ALIGNPOS_BOTTOM};
enum class PosAlign { left, right, top, bottom };

struct DLGTEMPLATEEX {
WORD dlgVer;
Expand All @@ -44,7 +42,7 @@ public :
StaticDialog() : Window() {};
~StaticDialog(){
if (isCreated()) {
::SetWindowLongPtr(_hSelf, GWL_USERDATA, (long)NULL); //Prevent run_dlgProc from doing anything, since its virtual
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (long)NULL); //Prevent run_dlgProc from doing anything, since its virtual
destroy();
}
};
Expand All @@ -62,11 +60,10 @@ public :

protected :
RECT _rc;
static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0;
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0;

void alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT & point);
HGLOBAL makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate);
};

#endif //STATIC_DIALOG_H
Loading

1 comment on commit d870698

@SGmuwa
Copy link

@SGmuwa SGmuwa commented on d870698 Jun 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray! Thank you!

Please sign in to comment.