aboutsummaryrefslogtreecommitdiff
path: root/RadTerminal.cpp
diff options
context:
space:
mode:
authorRadAd <adamgates84+github@gmail.com>2019-07-16 12:05:52 +1000
committerRadAd <adamgates84+github@gmail.com>2019-07-16 12:05:52 +1000
commitb40b190dfdb50acd2cbb2108e92c3d4b0d7f3bfe (patch)
tree863869d3a959b5fed0e430da9dc75a184f9e491f /RadTerminal.cpp
parenta1dd103887ff7e6b6881716da495b4e57ed754c0 (diff)
downloadRadTerminal-b40b190dfdb50acd2cbb2108e92c3d4b0d7f3bfe.tar.gz
RadTerminal-b40b190dfdb50acd2cbb2108e92c3d4b0d7f3bfe.zip
Support multiple profiles
Diffstat (limited to 'RadTerminal.cpp')
-rw-r--r--RadTerminal.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/RadTerminal.cpp b/RadTerminal.cpp
index be590a9..7121dfc 100644
--- a/RadTerminal.cpp
+++ b/RadTerminal.cpp
@@ -68,7 +68,7 @@ void ShowError(HWND hWnd, LPCTSTR msg, HRESULT hr)
HWND CreateRadTerminalFrame(HINSTANCE hInstance);
LRESULT CALLBACK RadTerminalWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-HWND ActionNewWindow(HWND hWnd, bool bParseCmdLine);
+HWND ActionNewWindow(HWND hWnd, bool bParseCmdLine, const std::tstring& profile);
ATOM RegisterRadTerminal(HINSTANCE hInstance)
{
@@ -154,9 +154,10 @@ void ParseCommandLine(RadTerminalCreate& rtc)
}
}
-RadTerminalCreate GetDefaultTerminalCreate(bool bParseCmdLine)
+RadTerminalCreate GetTerminalCreate(bool bParseCmdLine, std::tstring profile)
{
- std::tstring profile = RegGetString(HKEY_CURRENT_USER, _T("Software\\RadSoft\\" PROJ_CODE), _T("Profile"), _T("Cmd"));
+ if (profile.empty())
+ profile = RegGetString(HKEY_CURRENT_USER, _T("Software\\RadSoft\\" PROJ_CODE), _T("Profile"), _T("Cmd"));
RadTerminalCreate rtc = {};
rtc.iFontHeight = 16;
@@ -194,7 +195,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho
hWndMDIClient = GetMDIClient(hWnd);
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
- HWND hChildWnd = ActionNewWindow(hWnd, true);
+ HWND hChildWnd = ActionNewWindow(hWnd, true, TEXT(""));
if (true && hChildWnd != NULL)
{
@@ -208,7 +209,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho
}
else
{
- RadTerminalCreate rtc = GetDefaultTerminalCreate(true);
+ RadTerminalCreate rtc = GetTerminalCreate(true, TEXT(""));
hWnd = CreateWindowEx(
WS_EX_ACCEPTFILES,
@@ -683,14 +684,14 @@ int ActionScrollbackDown(HWND hWnd)
return 0;
}
-HWND ActionNewWindow(HWND hWnd, bool bParseCmdLine)
+HWND ActionNewWindow(HWND hWnd, bool bParseCmdLine, const std::tstring& profile)
{
const HINSTANCE hInstance = GetWindowInstance(hWnd);
const HWND hWndMDIClient = GetMDIClient(hWnd);
BOOL bMaximized = FALSE;
GetMDIActive(hWndMDIClient, &bMaximized);
- const RadTerminalCreate rtc = GetDefaultTerminalCreate(bParseCmdLine);
+ const RadTerminalCreate rtc = GetTerminalCreate(bParseCmdLine, profile);
HWND hChildWnd = CreateMDIWindow(
MAKEINTATOM(GetRadTerminalAtom(hInstance)),