Skip to content

Commit 793963a

Browse files
author
Jan Wilmans
committed
merged Commit 9d79f53 from KirisameMarisa to add /tab:<name> commandline option
1 parent 0de5b98 commit 793963a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

application/DebugViewpp/DebugView++.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
151151

152152
auto args = Win32::GetCommandLineArguments();
153153
std::wstring fileName;
154+
std::wstring selectTabName;
154155

155156
for (size_t i = 1; i < args.size(); ++i)
156157
{
@@ -163,6 +164,10 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
163164
//wndMain.SetLogging(); // todo: implement: FileWriter needs to concurrently access m_logfile, it now causes a crash if DbgMsgSrc -1 is run
164165
// this should be replaced by the new streaming-to-disk feature we discussed.
165166
}
167+
else if (boost::icontains(args[i], L"/tab:"))
168+
{
169+
selectTabName = args[i].substr(5);
170+
}
166171
else if (args[i][0] != '/')
167172
{
168173
if (!fileName.empty())
@@ -196,6 +201,11 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
196201
wndMain.CapturePipe(hPipe);
197202
}
198203

204+
if (!selectTabName.empty())
205+
{
206+
wndMain.SetSelectTabByName(selectTabName);
207+
}
208+
199209
return theLoop.Run();
200210
}
201211

application/DebugViewpp/MainFrame.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,19 @@ void CMainFrame::Load(std::istream& file, const std::string& name, FILETIME file
12321232
}
12331233
}
12341234

1235+
void CMainFrame::SetSelectTabByName(const std::wstring& tabName)
1236+
{
1237+
const int views = GetViewCount();
1238+
for (int i = 0; i < views; ++i)
1239+
{
1240+
if (GetView(i).GetName() == tabName)
1241+
{
1242+
GetTabCtrl().SetCurSel(i);
1243+
break;
1244+
}
1245+
}
1246+
}
1247+
12351248
void CMainFrame::CapturePipe(HANDLE hPipe)
12361249
{
12371250
m_logSources.AddPipeReader(Win32::GetParentProcessId(), hPipe);

application/DebugViewpp/MainFrame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class CMainFrame : public CTabbedFrameImpl<CMainFrame, CDotNetTabCtrl<SelectedTa
9494
void Load(const std::wstring& fileName, bool keeptailing);
9595
void Load(HANDLE hFile);
9696
void Load(std::istream& file, const std::string& name, FILETIME fileTime);
97+
void SetSelectTabByName(const std::wstring& tabName);
9798
void CapturePipe(HANDLE hPipe);
9899
void FindNext(const std::wstring& text);
99100
void FindPrevious(const std::wstring& text);

0 commit comments

Comments
 (0)