From 375716f7d464c2e301f54b2db6d40ce3dba7151e Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 16 Nov 2014 19:37:48 +0000 Subject: [PATCH] ide: Directory compare dblclick now goes to the line in editor #857 git-svn-id: svn://ultimatepp.org/upp/trunk@7904 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/TextDiffCtrl/TextDiffCtrl.h | 6 +++++- uppsrc/ide/ide.cpp | 1 + uppsrc/ide/ide.h | 2 ++ uppsrc/ide/idetool.cpp | 16 ++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/uppsrc/TextDiffCtrl/TextDiffCtrl.h b/uppsrc/TextDiffCtrl/TextDiffCtrl.h index ba08645b7..2c5b088ef 100644 --- a/uppsrc/TextDiffCtrl/TextDiffCtrl.h +++ b/uppsrc/TextDiffCtrl/TextDiffCtrl.h @@ -188,7 +188,6 @@ struct PatchDiff : FileDiff { class DirDiffDlg : public TopWindow { Splitter files_diff; - TextDiffCtrl diff; ParentCtrl files_pane; FileList files; @@ -210,6 +209,8 @@ class DirDiffDlg : public TopWindow { void Copy(bool left); public: + TextDiffCtrl diff; + typedef DirDiffDlg CLASSNAME; void SetFont(Font fnt) { diff.SetFont(fnt); } @@ -218,6 +219,9 @@ public: void Dir1AddList(const String& dir) { dir1.AddList(dir); } void Dir2AddList(const String& dir) { dir2.AddList(dir); } + String GetLeftFile() const { return ~lfile; } + String GetRightFile() const { return ~rfile; } + DirDiffDlg(); }; diff --git a/uppsrc/ide/ide.cpp b/uppsrc/ide/ide.cpp index 4c98b5f43..e4379afcc 100644 --- a/uppsrc/ide/ide.cpp +++ b/uppsrc/ide/ide.cpp @@ -585,6 +585,7 @@ void Ide::GotoDiffLeft(int line, DiffDlg *df) { EditFile(df->editfile); editor.SetCursor(editor.GetPos(line)); + editor.SetFocus(); } void Ide::GotoDiffRight(int line, FileDiff *df) diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index 2df0b1540..ba82de40a 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -1103,6 +1103,8 @@ public: void Qtf(); void Xml(); void Json(); + void GotoDirDiffLeft(int line, DirDiffDlg *df); + void GotoDirDiffRight(int line, DirDiffDlg *df); void DoDirDiff(); diff --git a/uppsrc/ide/idetool.cpp b/uppsrc/ide/idetool.cpp index df8717196..388f13de1 100644 --- a/uppsrc/ide/idetool.cpp +++ b/uppsrc/ide/idetool.cpp @@ -416,6 +416,20 @@ void Ide::SyncSvnDir(const String& working) SyncSvnDirs(Vector() << working); } +void Ide::GotoDirDiffLeft(int line, DirDiffDlg *df) +{ + EditFile(df->GetLeftFile()); + editor.SetCursor(editor.GetPos(line)); + editor.SetFocus(); +} + +void Ide::GotoDirDiffRight(int line, DirDiffDlg *df) +{ + EditFile(df->GetRightFile()); + editor.SetCursor(editor.GetPos(line)); + editor.SetFocus(); +} + void Ide::DoDirDiff() { Index dir; @@ -437,6 +451,8 @@ void Ide::DoDirDiff() SortIndex(dir); static DirDiffDlg dlg; + dlg.diff.WhenLeftLine = THISBACK1(GotoDirDiffLeft, &dlg); + dlg.diff.WhenRightLine = THISBACK1(GotoDirDiffRight, &dlg); for(int i = 0; i < dir.GetCount(); i++) { dlg.Dir1AddList(dir[i]); dlg.Dir2AddList(dir[i]);