Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tab can be selected when start application #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion DebugView++/DebugView++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine

auto args = Win32::GetCommandLineArguments();
std::wstring fileName;
std::wstring selectTabName;

for (size_t i = 1; i < args.size(); ++i)
{
Expand All @@ -143,6 +144,10 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
//wndMain.SetLogging(); // todo: implement: FileWriter needs to concurrently access m_logfile, it now causes a crash if DbgMsgSrc -1 is run
// this should be replaced by the new streaming-to-disk feature we discussed.
}
else if (boost::icontains(args[i], L"/tab:"))
{
selectTabName = args[i].substr(std::wstring(L"/tabs:").length() - 1, args[i].length());
}
else if (args[i][0] != '/')
{
if (!fileName.empty())
Expand Down Expand Up @@ -175,7 +180,10 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
{
wndMain.CapturePipe(hPipe);
}

if (!selectTabName.empty())
{
wndMain.SetSelectTabByName(selectTabName);
}
return theLoop.Run();
}

Expand Down
15 changes: 14 additions & 1 deletion DebugView++/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ std::wstring FormatDuration(double seconds)
return wstringbuilder() << FormatUnits(minutes, L"minute") << L" " << FormatUnits(FloorTo<int>(seconds), L"second");
}

static const wchar_t* units[] = {L"s", L"ms", L"�s", L"ns", nullptr};
static const wchar_t* units[] = {L"s", L"ms", L"オs", L"ns", nullptr};
const wchar_t** unit = units;
while (*unit != nullptr && seconds > 0 && seconds < 1)
{
Expand Down Expand Up @@ -1182,6 +1182,19 @@ void CMainFrame::Load(std::istream& file, const std::string& name, FILETIME file
}
}

void CMainFrame::SetSelectTabByName(const std::wstring tabName)
{
int views = GetViewCount();
for (int i = 0; i < views; ++i)
{
if (GetView(i).GetName() == tabName)
{
GetTabCtrl().SetCurSel(i);
break;
}
}
}

void CMainFrame::CapturePipe(HANDLE hPipe)
{
m_logSources.AddPipeReader(Win32::GetParentProcessId(), hPipe);
Expand Down
1 change: 1 addition & 0 deletions DebugView++/MainFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class CMainFrame : public CTabbedFrameImpl<CMainFrame, CDotNetTabCtrl<SelectedTa
void Load(const std::wstring& fileName, bool keeptailing);
void Load(HANDLE hFile);
void Load(std::istream& file, const std::string& name, FILETIME fileTime);
void SetSelectTabByName(const std::wstring tabName);
void CapturePipe(HANDLE hPipe);
void FindNext(const std::wstring& text);
void FindPrevious(const std::wstring& text);
Expand Down