Skip to content

Commit

Permalink
Renamed variable and corrected typo
Browse files Browse the repository at this point in the history
  • Loading branch information
SinghRajenM committed Dec 31, 2023
1 parent 158eafa commit a765bbe
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions NppJSONViewer/NppJsonViewer/AboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include <commctrl.h>


AboutDlg::AboutDlg(HINSTANCE hIntance, HWND hParent, int nCmdId)
AboutDlg::AboutDlg(HINSTANCE hInstance, HWND hParent, int nCmdId)
: m_nCmdId(nCmdId)
, StaticDialog()
{
init(hIntance, hParent);
init(hInstance, hParent);
}


Expand Down
2 changes: 1 addition & 1 deletion NppJSONViewer/NppJsonViewer/AboutDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class AboutDlg : public StaticDialog
{
public:
AboutDlg(HINSTANCE hIntance, HWND hParent, int nCmdId);
AboutDlg(HINSTANCE hInstance, HWND hParent, int nCmdId);
~AboutDlg() = default;

bool ShowDlg(bool bShow);
Expand Down
18 changes: 9 additions & 9 deletions NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <regex>


JsonViewDlg::JsonViewDlg(HINSTANCE hIntance, const NppData &nppData, const bool &isReady, int nCmdId, std::shared_ptr<Setting> &pSetting)
JsonViewDlg::JsonViewDlg(HINSTANCE hInstance, const NppData &nppData, const bool &isReady, int nCmdId, std::shared_ptr<Setting> &pSetting)
: DockingDlgInterface(IDD_TREEDLG)
, m_NppData(nppData)
, m_IsNppReady(isReady)
Expand All @@ -19,7 +19,7 @@ JsonViewDlg::JsonViewDlg(HINSTANCE hIntance, const NppData &nppData, const bool
, m_pSetting(pSetting)
{
_hParent = nppData._nppHandle;
_hInst = hIntance;
_hInst = hInstance;
}

JsonViewDlg::~JsonViewDlg()
Expand Down Expand Up @@ -77,7 +77,7 @@ void JsonViewDlg::FormatJson()
if (res.success)
{
m_Editor->ReplaceSelection(res.response);
HightlightAsJson();
HighlightAsJson();
}
else
{
Expand All @@ -98,7 +98,7 @@ void JsonViewDlg::CompressJson()
if (res.success)
{
m_Editor->ReplaceSelection(res.response);
HightlightAsJson();
HighlightAsJson();
}
else
{
Expand Down Expand Up @@ -152,7 +152,7 @@ bool JsonViewDlg::CheckForTokenUndefined(eMethod method, std::string selectedTex
if (res.success)
{
m_Editor->ReplaceSelection((method == eMethod::ParseJson || method == eMethod::ValidateJson) ? text : res.response);
HightlightAsJson();
HighlightAsJson();
return true;
}
else
Expand Down Expand Up @@ -257,7 +257,7 @@ void JsonViewDlg::DrawJsonTree()
EnableControls(ctrls, true);
}

void JsonViewDlg::HightlightAsJson(bool bForcefully) const
void JsonViewDlg::HighlightAsJson(bool bForcefully) const
{
bool setJsonLang = bForcefully || m_pSetting->bUseJsonHighlight;
if (setJsonLang)
Expand Down Expand Up @@ -295,7 +295,7 @@ auto JsonViewDlg::PopulateTreeUsingSax(HTREEITEM tree_root, const std::string &j
}
else
{
HightlightAsJson();
HighlightAsJson();
}

return retVal;
Expand Down Expand Up @@ -338,7 +338,7 @@ void JsonViewDlg::SearchInTree()
static std::wstring previousSearch;
static HTREEITEM nextNode = m_hTreeView->NextItem(m_hTreeView->GetRoot());

// New search, hence search from begining
// New search, hence search from beginning
if (previousSearch != itemToSearch)
{
previousSearch = itemToSearch;
Expand Down Expand Up @@ -372,7 +372,7 @@ void JsonViewDlg::SearchInTree()

// Search in node value
// 1. If both key and value are not equal
// 2. If both are euaal, but not all three (key, value and keyValue)
// 2. If both are equal, but not all three (key, value and keyValue)
// 3. If all three equal, but key does not start with '[' and end with ']'

bool shouldSearch = (nodeKey != nodeVal);
Expand Down
4 changes: 2 additions & 2 deletions NppJSONViewer/NppJsonViewer/JsonViewDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class JsonViewDlg : public DockingDlgInterface
};

public:
JsonViewDlg(HINSTANCE hIntance, const NppData &nppData, const bool &isReady, int nCmdId, std::shared_ptr<Setting> &pSetting);
JsonViewDlg(HINSTANCE hInstance, const NppData &nppData, const bool &isReady, int nCmdId, std::shared_ptr<Setting> &pSetting);
virtual ~JsonViewDlg();

void ShowDlg(bool bShow);
Expand All @@ -42,7 +42,7 @@ class JsonViewDlg : public DockingDlgInterface

private:
void DrawJsonTree();
void HightlightAsJson(bool bForcefully = false) const;
void HighlightAsJson(bool bForcefully = false) const;
auto PopulateTreeUsingSax(HTREEITEM tree_root, const std::string &jsonText) -> std::optional<std::wstring>;

void ValidateJson();
Expand Down
8 changes: 4 additions & 4 deletions NppJSONViewer/NppJsonViewer/NppJsonPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void NppJsonPlugin::ProcessNotification(const SCNotification *notifyCode)

case NPPN_READY:
{
// This is work arround where dialog does not show tree on launch
// This is workaround where dialog does not show tree on launch
if (m_pJsonViewDlg && m_pJsonViewDlg->isVisible() && !m_bAboutToClose)
{
::SendMessage(m_pJsonViewDlg->getHSelf(), WM_COMMAND, IDC_BTN_REFRESH, 0);
Expand Down Expand Up @@ -132,9 +132,9 @@ void NppJsonPlugin::InitToolbarIcon()
auto dpi = GetDeviceCaps(GetWindowDC(m_NppData._nppHandle), LOGPIXELSX);
int size = 16 * dpi / 96;
m_hMenuIcon.hToolbarIcon = reinterpret_cast<HICON>(::LoadImage(static_cast<HINSTANCE>(m_hModule), MAKEINTRESOURCE(IDI_ICON_TOOLBAR), IMAGE_ICON, size, size, 0));
ICONINFO iconinfo;
GetIconInfo(m_hMenuIcon.hToolbarIcon, &iconinfo);
m_hMenuIcon.hToolbarBmp = iconinfo.hbmColor;
ICONINFO iconInfo;
GetIconInfo(m_hMenuIcon.hToolbarIcon, &iconInfo);
m_hMenuIcon.hToolbarBmp = iconInfo.hbmColor;
}

void NppJsonPlugin::InitConfigPath()
Expand Down
4 changes: 2 additions & 2 deletions NppJSONViewer/NppJsonViewer/SettingsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#include <Uxtheme.h>


SettingsDlg::SettingsDlg(HINSTANCE hIntance, HWND hParent, int nCmdId, const std::wstring &configPath, std::shared_ptr<Setting> &pSetting)
SettingsDlg::SettingsDlg(HINSTANCE hInstance, HWND hParent, int nCmdId, const std::wstring &configPath, std::shared_ptr<Setting> &pSetting)
: m_nCmdId(nCmdId)
, m_configPath(configPath)
, StaticDialog()
, m_pSetting(pSetting)
{
init(hIntance, hParent);
init(hInstance, hParent);
}


Expand Down
2 changes: 1 addition & 1 deletion NppJSONViewer/NppJsonViewer/SettingsDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class SettingsDlg : public StaticDialog
{
public:
SettingsDlg(HINSTANCE hIntance, HWND hParent, int nCmdId, const std::wstring &configPath, std::shared_ptr<Setting> &pSetting);
SettingsDlg(HINSTANCE hInstance, HWND hParent, int nCmdId, const std::wstring &configPath, std::shared_ptr<Setting> &pSetting);
~SettingsDlg() = default;

bool ShowDlg(bool bShow);
Expand Down
12 changes: 6 additions & 6 deletions NppJSONViewer/NppJsonViewer/TreeViewCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ bool TreeViewCtrl::IsThisOrAnyChildCollapsed(HTREEITEM node) const

void TreeViewCtrl::Expand(HTREEITEM node) const
{
ExpandOrCollpase(node, TVE_EXPAND);
ExpandOrCollapse(node, TVE_EXPAND);
}

void TreeViewCtrl::Collapse(HTREEITEM node) const
{
ExpandOrCollpase(node, TVE_COLLAPSE);
ExpandOrCollapse(node, TVE_COLLAPSE);
}

void TreeViewCtrl::ExpandOrCollpase(HTREEITEM node, UINT_PTR code) const
void TreeViewCtrl::ExpandOrCollapse(HTREEITEM node, UINT_PTR code) const
{
TreeView_Expand(m_hTree, node, code);
}
Expand Down Expand Up @@ -235,7 +235,7 @@ auto TreeViewCtrl::GetNodePath(HTREEITEM hti) const -> std::wstring

if (!nodeKey.empty())
{
// remove " from the beinging and end
// remove " from the beginning and end
if (nodeKey[0] == TEXT('"'))
nodeKey.erase(0, 1);
if (nodeKey[nodeKey.size() - 1] == TEXT('"'))
Expand All @@ -262,7 +262,7 @@ auto TreeViewCtrl::GetNodePath(HTREEITEM hti) const -> std::wstring
hitTravel = htiParent;
}

// remove trailling dot (.)
// remove trailing dot (.)
wstrJsonPath.pop_back();

return wstrJsonPath;
Expand Down Expand Up @@ -295,7 +295,7 @@ HTREEITEM TreeViewCtrl::GetParentItem(HTREEITEM hti) const

/*
* Get next item of current item on the TreeView.
* If current item has a child (or chidren) item, next will be the first child item.
* If current item has a child (or children) item, next will be the first child item.
* If current item has no child, next will be its sibling item.
* If current item has no child and no sibling, next will be its parent's (parent's parent's ...) sibling item.
* If current item's parent is ROOT and has no sibling item, it will return NULL.
Expand Down
2 changes: 1 addition & 1 deletion NppJSONViewer/NppJsonViewer/TreeViewCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class TreeViewCtrl
auto GetNodePath(HTREEITEM hti) const -> std::wstring;

private:
void ExpandOrCollpase(HTREEITEM node, UINT_PTR code) const;
void ExpandOrCollapse(HTREEITEM node, UINT_PTR code) const;

HTREEITEM GetParentItem(HTREEITEM hti) const;

Expand Down
6 changes: 3 additions & 3 deletions NppJSONViewer/UtilityLib/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ bool CUtility::OpenFileDlg(std::wstring &filePath, const std::wstring &dlgTitle,

if (::GetOpenFileName(&ofn) != FALSE)
{
filePath = ofn.lpstrFile; // will have the full pathand file name.
filePath = ofn.lpstrFile; // will have the full path and file name.
bRetVal = true;
}

return bRetVal;
}

bool CUtility::CopyToClipboard(const std::wstring &str2cpy, HWND hwnd)
bool CUtility::CopyToClipboard(const std::wstring &str2cpy, HWND hWnd)
{
size_t len2Allocate = (str2cpy.size() + 1) * sizeof(TCHAR);
HGLOBAL hglbCopy = ::GlobalAlloc(GMEM_MOVEABLE, len2Allocate);
Expand All @@ -236,7 +236,7 @@ bool CUtility::CopyToClipboard(const std::wstring &str2cpy, HWND hwnd)
return false;
}

if (!::OpenClipboard(hwnd))
if (!::OpenClipboard(hWnd))
{
::GlobalFree(hglbCopy);
::CloseClipboard();
Expand Down
2 changes: 1 addition & 1 deletion NppJSONViewer/UtilityLib/Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CUtility

static bool OpenFileDlg(std::wstring &filePath, const std::wstring &dlgTitle, const std::vector<wchar_t> &dlgFilter, DWORD flags = 0);

static bool CopyToClipboard(const std::wstring &str2cpy, HWND hwnd);
static bool CopyToClipboard(const std::wstring &str2cpy, HWND hWnd);

static bool IsNumber(const std::wstring &str);
static auto GetNumber(const std::wstring &str) -> std::optional<int>;
Expand Down

0 comments on commit a765bbe

Please sign in to comment.