Skip to content

Commit

Permalink
Issue#19 Addition of the blame with git gui.
Browse files Browse the repository at this point in the history
  • Loading branch information
k10blogger committed Oct 31, 2024
1 parent c8d3b6e commit 5a28d08
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
14 changes: 14 additions & 0 deletions DockingFeature/SettingsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extern TCHAR g_GitPath[MAX_PATH];
extern TCHAR g_GitPrompt[MAX_PATH];
extern bool g_RefScnFocus;
extern bool g_DiffWordDiff;
extern bool g_runwithgitgui;

static int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM, LPARAM pData)
{
Expand All @@ -34,6 +35,7 @@ INT_PTR CALLBACK SettingsDlg( HWND hWndDlg, UINT msg, WPARAM wParam,
SendMessage( GetDlgItem( hWndDlg, IDC_EDT_GITPROMPT ), WM_SETTEXT, 0, ( LPARAM )g_GitPrompt );
SendMessage( GetDlgItem( hWndDlg, IDC_CHK_SCNFOCUS ), BM_SETCHECK, ( LPARAM )( g_RefScnFocus ? 1 : 0 ), 0 );
SendMessage( GetDlgItem( hWndDlg, IDC_CHK_WORDDIFF ), BM_SETCHECK, ( LPARAM )( g_DiffWordDiff ? 1 : 0 ), 0 );
SendMessage( GetDlgItem( hWndDlg, IDC_CHK_GITGUI), BM_SETCHECK, ( LPARAM )( g_runwithgitgui ? 1 : 0), 0);

std::string version;
version = "<a>";
Expand Down Expand Up @@ -154,6 +156,18 @@ INT_PTR CALLBACK SettingsDlg( HWND hWndDlg, UINT msg, WPARAM wParam,
return TRUE;
}

case IDC_CHK_GITGUI:
{
int check = (int)::SendMessage(GetDlgItem(hWndDlg, IDC_CHK_GITGUI),
BM_GETCHECK, 0, 0);

if (check & BST_CHECKED)
g_runwithgitgui = true;
else
g_runwithgitgui = false;
return TRUE;
}

case IDCANCEL :
{
EndDialog(hWndDlg, 0);
Expand Down
10 changes: 6 additions & 4 deletions DockingFeature/gitPanel.rc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ BEGIN
CONTROL "Go to remote",IDB_BTN_GOTOREMOTE,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,9,56,70,13
END

IDD_SETTINGS DIALOGEX 26,41,291,150
IDD_SETTINGS DIALOGEX 26,41,291,170
CAPTION "Git SCM Settings"
FONT 8,"MS Shell Dlg",0,0,0
STYLE WS_POPUP|WS_VISIBLE|WS_CAPTION|WS_SYSMENU|DS_SHELLFONT
BEGIN
CONTROL "&OK",IDB_OK,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_DEFPUSHBUTTON,120,126,50,14
CONTROL "&OK",IDB_OK,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_DEFPUSHBUTTON,120,146,50,14
CONTROL "Git Directory Path",IDC_GRP1,"Button",WS_CHILDWINDOW|WS_VISIBLE|BS_GROUPBOX,9,15,270,63
CONTROL "Git directory path is only needed if `git` cannot be found in your %PATH% environment variable.",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE,18,27,204,18
CONTROL "&git ...",IDC_BTN_GITPATH,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,15,54,40,14
Expand All @@ -36,8 +36,10 @@ BEGIN
CONTROL "",IDC_CHK_SCNFOCUS,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,10,111,10,9
CONTROL "--word-&diff (non-TortoiseGit)",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE,170,110,105,9
CONTROL "",IDC_CHK_WORDDIFF,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,155,111,10,9
CONTROL "Version",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE|WS_DISABLED|WS_GROUP,10,126,30,11
CONTROL "<a></a>",IDC_STC_VER,"SysLink",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|LWS_TRANSPARENT,40,126,40,11
CONTROL "Blame with Git GUI", IDC_STATIC, "Static", WS_CHILDWINDOW | WS_VISIBLE, 25, 126, 120, 9
CONTROL "", IDC_CHK_GITGUI, "Button", WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, 10, 127, 10, 9
CONTROL "Version",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE|WS_DISABLED|WS_GROUP,10,146,30,11
CONTROL "<a></a>",IDC_STC_VER,"SysLink",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|LWS_TRANSPARENT,40,146,40,11
END

IDI_PLUGINGITPANEL ICON DISCARDABLE "GitSCM.ico"
Expand Down
3 changes: 2 additions & 1 deletion DockingFeature/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
#define IDC_EDT_GITPROMPT (IDD_SETTINGS + 5)
#define IDC_CHK_SCNFOCUS (IDD_SETTINGS + 6)
#define IDC_CHK_WORDDIFF (IDD_SETTINGS + 7)
#define IDC_CHK_GITGUI (IDD_SETTINGS + 8)

#define IDC_STC_VER (IDD_SETTINGS + 8)
#define IDC_STC_VER (IDD_SETTINGS + 9)

#endif // DOCKINGFEATURE_RESOURCE_H
10 changes: 10 additions & 0 deletions PluginDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const TCHAR iniKeyRefScnFocus[] = TEXT( "RefreshScnFocus" );
const TCHAR iniKeyDiffWordDiff[] = TEXT( "DiffWordDiff" );
const TCHAR iniKeyDebug[] = TEXT( "Debug" );
const TCHAR iniKeyLVDelay[] = TEXT( "LVDelay" );
const TCHAR iniKeyRunWithGITGUI[] = TEXT( "RunWithGITGUI" );

DemoDlg _gitPanel;

Expand All @@ -62,6 +63,7 @@ bool g_useNppColors = false;
bool g_RaisePanel = false;
bool g_RefScnFocus = false;
bool g_DiffWordDiff = false;
bool g_runwithgitgui = false;

// g_Debug and g_LVDelay must be set manually in config file ($NPP_DIR\plugins\config\GitSCM.ini)
// ON => Debug=1
Expand Down Expand Up @@ -102,6 +104,8 @@ void pluginCleanUp()
g_RefScnFocus ? TEXT( "1" ) : TEXT( "0" ), iniFilePath );
::WritePrivateProfileString( sectionName, iniKeyDiffWordDiff,
g_DiffWordDiff ? TEXT( "1" ) : TEXT( "0" ), iniFilePath );
::WritePrivateProfileString( sectionName, iniKeyRunWithGITGUI,
g_runwithgitgui ? TEXT( "1" ) : TEXT( "0" ), iniFilePath);

if (g_TBGit.hToolbarBmp) {
::DeleteObject(g_TBGit.hToolbarBmp);
Expand Down Expand Up @@ -148,6 +152,8 @@ void commandMenuInit()
0, iniFilePath );
g_DiffWordDiff = ::GetPrivateProfileInt( sectionName, iniKeyDiffWordDiff,
0, iniFilePath );
g_runwithgitgui = ::GetPrivateProfileInt(sectionName, iniKeyRunWithGITGUI,
0, iniFilePath);

g_Debug = ::GetPrivateProfileInt( sectionName, iniKeyDebug,
0, iniFilePath );
Expand Down Expand Up @@ -399,6 +405,10 @@ void ExecGitCommand(
std::wstring command = TEXT( "cmd /d/c \"\"" );
command += getGitLocation();
command += TEXT( "git" );
if (g_runwithgitgui)
{
command += TEXT("-gui");
}
command += cmd + TEXT( " " );

if ( !ignoreFiles )
Expand Down

0 comments on commit 5a28d08

Please sign in to comment.