diff --git a/DockingFeature/SettingsDlg.cpp b/DockingFeature/SettingsDlg.cpp index f309fca..ce268e5 100644 --- a/DockingFeature/SettingsDlg.cpp +++ b/DockingFeature/SettingsDlg.cpp @@ -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) { @@ -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 = ""; @@ -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); diff --git a/DockingFeature/gitPanel.rc b/DockingFeature/gitPanel.rc index d511be9..e5dd6f4 100644 --- a/DockingFeature/gitPanel.rc +++ b/DockingFeature/gitPanel.rc @@ -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 @@ -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 "",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 "",IDC_STC_VER,"SysLink",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|LWS_TRANSPARENT,40,146,40,11 END IDI_PLUGINGITPANEL ICON DISCARDABLE "GitSCM.ico" diff --git a/DockingFeature/resource.h b/DockingFeature/resource.h index c5f3829..8948556 100644 --- a/DockingFeature/resource.h +++ b/DockingFeature/resource.h @@ -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 diff --git a/PluginDefinition.cpp b/PluginDefinition.cpp index ec6376a..dbda225 100644 --- a/PluginDefinition.cpp +++ b/PluginDefinition.cpp @@ -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; @@ -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 @@ -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); @@ -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 ); @@ -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 )