-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Preparing for v2.0 * Show context menu using handling right click * Removed commented code * 1. Disable few controls which are not yet implemented 2. Added callback for compress * Make json viewer working as before * Rename class `JsonTreeViewDlg` to `JsonViewDlg` * Make compress function working * Fix x64 compilation error * Added context menu functionality * Implement node path * Minor code reformatting * Handle tree view item changed event * Implement validate functionality * Implement format functionality * Fix x64 compilation * Capture pdbs too * Check artifacts * Remove unused files * Correct version as 2.0 * Minor correction * Disable "option" temporarily * Minor error message correction * Capture symbols * Fix codacy issue
- Loading branch information
1 parent
6552601
commit 3bd06eb
Showing
51 changed files
with
3,620 additions
and
1,621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#include "AboutDlg.h" | ||
#include "resource.h" | ||
#include "Utility.h" | ||
#include "StringHelper.h" | ||
#include "Define.h" | ||
#include <string> | ||
#include <commctrl.h> | ||
|
||
|
||
AboutDlg::AboutDlg(HINSTANCE hIntance, HWND hParent, int nCmdId) : m_nCmdId(nCmdId), StaticDialog() | ||
{ | ||
init(hIntance, hParent); | ||
} | ||
|
||
|
||
bool AboutDlg::ShowDlg(bool bShow) | ||
{ | ||
bool bShouldShow = bShow && !isVisible(); | ||
if (bShouldShow) | ||
{ | ||
if (!isCreated()) | ||
create(IDD_ABOUTDLG); | ||
|
||
// Adjust the position of AboutBox | ||
goToCenter(); | ||
} | ||
else | ||
{ | ||
SendMessage(_hSelf, WM_COMMAND, IDCANCEL, NULL); | ||
} | ||
return bShouldShow; | ||
} | ||
|
||
|
||
INT_PTR AboutDlg::run_dlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
AboutDlg* pSelf = nullptr; | ||
switch (uMsg) | ||
{ | ||
case WM_INITDIALOG: | ||
{ | ||
::SetWindowLongPtr(_hSelf, DWLP_USER, lParam); | ||
|
||
pSelf = reinterpret_cast<AboutDlg*>(static_cast<LONG_PTR> (::GetWindowLongPtr(_hSelf, DWLP_USER))); | ||
if (pSelf) | ||
{ | ||
pSelf->SetVersion(_hSelf); | ||
} | ||
SetFocus(GetDlgItem(_hSelf, IDOK)); | ||
|
||
// Set links | ||
std::wstring urlIssue(TEXT("<a href=\"__URL__\">__URL__</a>")); | ||
std::wstring urlRepo = urlIssue; | ||
|
||
urlIssue = StringHelper::ReplaceAll(urlIssue, TEXT("__URL__"), URL_REPORT_ISSUE); | ||
urlRepo = StringHelper::ReplaceAll(urlRepo, TEXT("__URL__"), URL_SOURCE_CODE); | ||
|
||
SetWindowText(::GetDlgItem(_hSelf, IDC_WEB_ISSUE), urlIssue.c_str()); | ||
SetWindowText(::GetDlgItem(_hSelf, IDC_WEB_SOURCE), urlRepo.c_str()); | ||
|
||
return TRUE; | ||
} | ||
|
||
case WM_NOTIFY: | ||
{ | ||
switch (reinterpret_cast<LPNMHDR>(lParam)->code) | ||
{ | ||
case NM_CLICK: | ||
case NM_RETURN: | ||
{ | ||
auto nmLink = reinterpret_cast<PNMLINK>(lParam); | ||
LITEM item = nmLink->item; | ||
|
||
ShellExecute(nullptr, L"open", item.szUrl, nullptr, nullptr, SW_SHOW); | ||
return TRUE; | ||
} | ||
} | ||
return FALSE; | ||
} | ||
|
||
case WM_COMMAND: | ||
{ | ||
pSelf = reinterpret_cast<AboutDlg*>(static_cast<LONG_PTR> (::GetWindowLongPtr(_hSelf, DWLP_USER))); | ||
switch (LOWORD(wParam)) | ||
{ | ||
case IDCANCEL: // Close this dialog when clicking to close button | ||
case IDOK: | ||
if (pSelf) | ||
::SendMessage(pSelf->_hParent, NPPM_SETMENUITEMCHECK, static_cast<WPARAM>(pSelf->m_nCmdId), false); | ||
EndDialog(_hSelf, wParam); | ||
_hSelf = nullptr; | ||
return TRUE; | ||
} | ||
} | ||
} | ||
return FALSE; | ||
} | ||
|
||
void AboutDlg::SetVersion(HWND hWnd) | ||
{ | ||
std::wstring version; | ||
|
||
// Get module path | ||
wchar_t moduleFileName[MAX_PATH + 1] = {}; | ||
::GetModuleFileName(static_cast<HMODULE>(getHinst()), moduleFileName, _MAX_PATH); | ||
|
||
version = CUtility::GetVersion(moduleFileName); | ||
if (!version.empty()) | ||
{ | ||
std::wstring text(PLUGIN_NAME); | ||
text += TEXT(" ("); | ||
text += STR_VERSION; | ||
text += version; | ||
text += TEXT(") "); | ||
::SetWindowText(::GetDlgItem(hWnd, IDC_GB_TITLE), text.c_str()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
#include "StaticDialog.h" | ||
|
||
class AboutDlg :public StaticDialog | ||
{ | ||
public: | ||
AboutDlg(HINSTANCE hIntance, HWND hParent, int nCmdId); | ||
~AboutDlg() = default; | ||
|
||
bool ShowDlg(bool bShow); | ||
|
||
protected: | ||
virtual INT_PTR CALLBACK run_dlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override; | ||
|
||
void SetVersion(HWND hWnd); | ||
|
||
private: | ||
int m_nCmdId = -1; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#pragma once | ||
#include "PluginInterface.h" | ||
|
||
// Define the number of plugin commands here | ||
enum class CallBackID :int { SHOW_DOC_PANEL = 0, FORMAT, COMPRESS, SEP_1, /*OPTION,*/ ABOUT }; | ||
const int nTotalCommandCount = static_cast<int>(CallBackID::ABOUT) + 1; | ||
|
||
// Define plugin name here | ||
const TCHAR PLUGIN_NAME[] = TEXT("JSON Viewer"); | ||
|
||
// Text which can be considered for localization | ||
const TCHAR TITLE_JSON_PANEL[] = TEXT("JSON Viewer Panel"); | ||
const TCHAR MENU_SHOW_JSON_PANEL[] = TEXT("Show &JSON Viewer"); | ||
const TCHAR MENU_FORMAT_JSON[] = TEXT("&Format JSON"); | ||
const TCHAR MENU_COMPRESS_JSON[] = TEXT("&Compress JSON"); | ||
const TCHAR MENU_OPTION[] = TEXT("&Option"); | ||
const TCHAR MENU_ABOUT[] = TEXT("&About"); | ||
const TCHAR MENU_SEPERATOR[] = TEXT("-SEPARATOR-"); | ||
|
||
const TCHAR TOOLTIP_REFRESH[] = TEXT("Refresh JSON tree"); | ||
const TCHAR TOOLTIP_VALIDATE[] = TEXT("Validate JSON to detect any error"); | ||
const TCHAR TOOLTIP_FORMAT[] = TEXT("Format JSON to beautify it"); | ||
const TCHAR TOOLTIP_SEARCH[] = TEXT("Search in JSON"); | ||
|
||
const TCHAR URL_SOURCE_CODE[] = TEXT("https://github.com/kapilratnani/JSON-Viewer"); | ||
const TCHAR URL_REPORT_ISSUE[] = TEXT("https://github.com/kapilratnani/JSON-Viewer/issues/new"); | ||
|
||
|
||
const TCHAR JSON_ROOT[] = TEXT("JSON"); | ||
|
||
const TCHAR JSON_ERROR_TITLE[] = TEXT("JSON Viewer: Error"); | ||
const TCHAR JSON_WARNING_TITLE[] = TEXT("JSON Viewer: Warning"); | ||
const TCHAR JSON_INFO_TITLE[] = TEXT("JSON Viewer: Information"); | ||
|
||
const TCHAR JSON_ERR_PARSE[] = TEXT("Cannot parse JSON. Please select a JSON String."); | ||
const TCHAR JSON_ERR_VALIDATE[] = TEXT("There was an error while parsing JSON. Refer the current selection for possible problematic area."); | ||
const TCHAR JSON_ERR_VALIDATE_SUCCESS[] = TEXT("JSON looks good. No error found while validating it."); | ||
|
||
const TCHAR STR_VERSION[] = TEXT("Version: "); | ||
const TCHAR STR_COPY[] = TEXT("Copy"); | ||
const TCHAR STR_COPYNAME[] = TEXT("Copy name"); | ||
const TCHAR STR_COPYVALUE[] = TEXT("Copy value"); | ||
const TCHAR STR_COPYPATH[] = TEXT("Copy path"); | ||
const TCHAR STR_EXPANDALL[] = TEXT("Expand all"); | ||
const TCHAR STR_COLLAPSEALL[] = TEXT("Collapse all"); | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.