Skip to content

Commit

Permalink
automatic routing functionality disabled, licensing disabled, version…
Browse files Browse the repository at this point in the history
… updated to 0.10.2
  • Loading branch information
asasd committed May 30, 2016
1 parent 5dfe140 commit 81516a2
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 130 deletions.
Binary file modified audio-router-gui/audio-router-gui.rc
Binary file not shown.
4 changes: 2 additions & 2 deletions audio-router-gui/dialog_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ void dialog_array::choose_array_and_create_control(IAudioSessionControl* pSessio
{
dialog_control* control;
dialog_array* arr = this->parent.find_control(pid, &control, 0);
bootstrapper& bootstrap = *this->parent.parent.bootstrap;
/*bootstrapper& bootstrap = *this->parent.parent.bootstrap;*/

// check if control is found on default: add session if found;
// if not found on default: add to this if found in general; add to default if not found in general
Expand All @@ -625,7 +625,7 @@ void dialog_array::choose_array_and_create_control(IAudioSessionControl* pSessio
control->add_audio_session(pSessionControl2);
return;
}
else if(arr != NULL || bootstrap.is_managed_app(pid))
else if(arr != NULL/* || bootstrap.is_managed_app(pid)*/)
{
this->create_control(pid, pSessionControl2);
return;
Expand Down
208 changes: 104 additions & 104 deletions audio-router-gui/dialog_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ LRESULT dialog_control::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BO
this->img.reset(new Bitmap(rc.bottom - rc.top, rc.right - rc.left));

// check if the application is implicitly routed, aka managed
bootstrapper& bootstrap = *this->parent.parent.parent.bootstrap;
this->managed = bootstrap.is_saved_routing(this->pid, this->parent.get_device());
/*bootstrapper& bootstrap = *this->parent.parent.parent.bootstrap;*/
this->managed = false;//bootstrap.is_saved_routing(this->pid, this->parent.get_device());

return 0;
}
Expand Down Expand Up @@ -781,105 +781,105 @@ LRESULT dialog_control::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b
return 0;
}

LRESULT dialog_control::OnPopUpSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if(this->MessageBoxW(
L"This will add a new saved routing for this application. It will not " \
L"replace the old saved routings for this application. Do you wish to continue?",
L"Confirmation for Save", MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
return 0;

bootstrapper& bootstrap = *this->parent.parent.parent.bootstrap;

input_dialog input_dlg(2);
input_dlg.DoModal(*this);
if(IsBadReadPtr(this, sizeof(dialog_control)))
return 0;
const int sel_index = input_dlg.selected_index;
if(sel_index > 0)
{
app_inject::devices_t devices;
app_inject::get_devices(devices);
try
{
bootstrap.save_routing(this->pid, devices[sel_index - 1]);
}
catch(std::wstring err)
{
app_inject::clear_devices(devices);
this->MessageBoxW(err.c_str(), NULL, MB_ICONERROR);
return 0;
}
app_inject::clear_devices(devices);

dialog_main& main = this->parent.parent;
for(dialog_main::dialog_arrays_t::iterator it = main.dialog_arrays.begin();
it != main.dialog_arrays.end();
it++)
{
for(dialog_array::dialog_controls_t::iterator jt = (*it)->dialog_controls.begin();
jt != (*it)->dialog_controls.end();
jt++)
{
(*jt)->managed = bootstrap.is_saved_routing((*jt)->pid, (*jt)->parent.get_device());
(*jt)->update_attributes();
}
}

this->MessageBoxW(L"Routing saved. Restart the application for the new settings " \
L"to take effect.",
L"Success", MB_ICONINFORMATION);
}
else if(sel_index == 0)
this->MessageBoxW(L"You cannot save routing to the default device!",
NULL, MB_ICONERROR);

return 0;
}


LRESULT dialog_control::OnPopUpDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
bootstrapper& bootstrap = *this->parent.parent.parent.bootstrap;

if(this->MessageBoxW(
L"This will delete all the saved routings for this application. It won't " \
L"delete the routings for any other application. Proceed?",
L"Confirmation for Delete All", MB_OKCANCEL | MB_ICONWARNING) != IDOK)
return 0;

try
{
if(!bootstrap.delete_all(this->pid))
{
this->MessageBoxW(
L"This application doesn't have any saved routings.", NULL, MB_ICONERROR);
return 0;
}
}
catch(std::wstring err)
{
this->MessageBoxW(err.c_str(), NULL, MB_ICONERROR);
return 0;
}

dialog_main& main = this->parent.parent;
for(dialog_main::dialog_arrays_t::iterator it = main.dialog_arrays.begin();
it != main.dialog_arrays.end();
it++)
{
for(dialog_array::dialog_controls_t::iterator jt = (*it)->dialog_controls.begin();
jt != (*it)->dialog_controls.end();
jt++)
{
(*jt)->managed = bootstrap.is_saved_routing((*jt)->pid, (*jt)->parent.get_device());
(*jt)->update_attributes();
}
}

this->MessageBoxW(L"Saved routings for this application deleted. Restart " \
L"the application for the new settings to take effect.",
L"Success", MB_ICONINFORMATION);

return 0;
}
//LRESULT dialog_control::OnPopUpSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
//{
// if(this->MessageBoxW(
// L"This will add a new saved routing for this application. It will not " \
// L"replace the old saved routings for this application. Do you wish to continue?",
// L"Confirmation for Save", MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
// return 0;
//
// bootstrapper& bootstrap = *this->parent.parent.parent.bootstrap;
//
// input_dialog input_dlg(2);
// input_dlg.DoModal(*this);
// if(IsBadReadPtr(this, sizeof(dialog_control)))
// return 0;
// const int sel_index = input_dlg.selected_index;
// if(sel_index > 0)
// {
// app_inject::devices_t devices;
// app_inject::get_devices(devices);
// try
// {
// bootstrap.save_routing(this->pid, devices[sel_index - 1]);
// }
// catch(std::wstring err)
// {
// app_inject::clear_devices(devices);
// this->MessageBoxW(err.c_str(), NULL, MB_ICONERROR);
// return 0;
// }
// app_inject::clear_devices(devices);
//
// dialog_main& main = this->parent.parent;
// for(dialog_main::dialog_arrays_t::iterator it = main.dialog_arrays.begin();
// it != main.dialog_arrays.end();
// it++)
// {
// for(dialog_array::dialog_controls_t::iterator jt = (*it)->dialog_controls.begin();
// jt != (*it)->dialog_controls.end();
// jt++)
// {
// (*jt)->managed = bootstrap.is_saved_routing((*jt)->pid, (*jt)->parent.get_device());
// (*jt)->update_attributes();
// }
// }
//
// this->MessageBoxW(L"Routing saved. Restart the application for the new settings " \
// L"to take effect.",
// L"Success", MB_ICONINFORMATION);
// }
// else if(sel_index == 0)
// this->MessageBoxW(L"You cannot save routing to the default device!",
// NULL, MB_ICONERROR);
//
// return 0;
//}


//LRESULT dialog_control::OnPopUpDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
//{
// bootstrapper& bootstrap = *this->parent.parent.parent.bootstrap;
//
// if(this->MessageBoxW(
// L"This will delete all the saved routings for this application. It won't " \
// L"delete the routings for any other application. Proceed?",
// L"Confirmation for Delete All", MB_OKCANCEL | MB_ICONWARNING) != IDOK)
// return 0;
//
// try
// {
// if(!bootstrap.delete_all(this->pid))
// {
// this->MessageBoxW(
// L"This application doesn't have any saved routings.", NULL, MB_ICONERROR);
// return 0;
// }
// }
// catch(std::wstring err)
// {
// this->MessageBoxW(err.c_str(), NULL, MB_ICONERROR);
// return 0;
// }
//
// dialog_main& main = this->parent.parent;
// for(dialog_main::dialog_arrays_t::iterator it = main.dialog_arrays.begin();
// it != main.dialog_arrays.end();
// it++)
// {
// for(dialog_array::dialog_controls_t::iterator jt = (*it)->dialog_controls.begin();
// jt != (*it)->dialog_controls.end();
// jt++)
// {
// (*jt)->managed = bootstrap.is_saved_routing((*jt)->pid, (*jt)->parent.get_device());
// (*jt)->update_attributes();
// }
// }
//
// this->MessageBoxW(L"Saved routings for this application deleted. Restart " \
// L"the application for the new settings to take effect.",
// L"Success", MB_ICONINFORMATION);
//
// return 0;
//}
8 changes: 4 additions & 4 deletions audio-router-gui/dialog_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ class dialog_control : public CDialogImpl<dialog_control>, public COwnerDraw<dia
COMMAND_ID_HANDLER(ID_POPUP_DUPLICATE, OnPopupDuplicate)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
CHAIN_MSG_MAP_MEMBER(ctrl_slider)
COMMAND_ID_HANDLER(ID_SAVEDROUTINGS_SAVEROUTINGFORTHISAPP, OnPopUpSave)
COMMAND_ID_HANDLER(ID_SAVEDROUTINGS_DELETEALLROUTINGSFORTHISAPP, OnPopUpDelete)
/*COMMAND_ID_HANDLER(ID_SAVEDROUTINGS_SAVEROUTINGFORTHISAPP, OnPopUpSave)
COMMAND_ID_HANDLER(ID_SAVEDROUTINGS_DELETEALLROUTINGSFORTHISAPP, OnPopUpDelete)*/
END_MSG_MAP()

LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
Expand All @@ -131,6 +131,6 @@ class dialog_control : public CDialogImpl<dialog_control>, public COwnerDraw<dia
void DrawItem(LPDRAWITEMSTRUCT);
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPopUpSaveRouting(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnPopUpSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnPopUpDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
//LRESULT OnPopUpSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
//LRESULT OnPopUpDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
26 changes: 13 additions & 13 deletions audio-router-gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,20 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
}

MSG msg = {0};
std::unique_ptr<bootstrapper> bootstrap;
try
//std::unique_ptr<bootstrapper> bootstrap;
//try
//{
// // TODO: decide if create a dummy bootstapper in case if the initialization fails
// bootstrap.reset(new bootstrapper);
//}
//catch(std::wstring err)
//{
// err += L"Audio Router will close.";
// MessageBox(NULL, err.c_str(), NULL, MB_ICONERROR);
// goto cleanup;
//}
{
// TODO: decide if create a dummy bootstapper in case if the initialization fails
bootstrap.reset(new bootstrapper);
}
catch(std::wstring err)
{
err += L"Audio Router will close.";
MessageBox(NULL, err.c_str(), NULL, MB_ICONERROR);
goto cleanup;
}
{
window win(bootstrap.get());
window win/*(bootstrap.get())*/;
RECT r = {CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT + WIN_WIDTH, CW_USEDEFAULT + WIN_HEIGHT};
if(win.CreateEx(NULL, &r) == NULL)
{
Expand Down
7 changes: 3 additions & 4 deletions audio-router-gui/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

telemetry* telemetry_m = NULL;

window::window(bootstrapper* bootstrap) : dlg_main_b(true), license(NULL), bootstrap(bootstrap)
window::window(/*bootstrapper* bootstrap*/) : dlg_main_b(true)/*, license(NULL)*//*, bootstrap(bootstrap)*/
{
this->dlg_main = new dialog_main(*this);
this->form_view = new formview(*this);
Expand All @@ -22,7 +22,7 @@ int window::OnCreate(LPCREATESTRUCT lpcs)
{
telemetry_m = new telemetry;

this->license = new dialog_licensing(*this);
/*this->license = new dialog_licensing(*this);*/

this->m_hWndClient = this->dlg_main->Create(this->m_hWnd);
this->dlg_main->ShowWindow(SW_SHOW);
Expand Down Expand Up @@ -78,8 +78,7 @@ LRESULT window::OnFileRefreshlist(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWn
LRESULT window::OnAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
this->MessageBoxW(
L"Audio Router test version 0.10.1.\n" \
L"The testing license will expire after 1 June 16 in your local time.\n" \
L"Audio Router version 0.10.2.\n" \
L"\nIf you come across any bugs(especially relating to routing or duplicating), " \
L"or just have an idea for a new feature, " \
L"please send a PM to the developer on reddit: reddit.com/user/audiorouterdev/",
Expand Down
6 changes: 3 additions & 3 deletions audio-router-gui/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class window : public CFrameWindowImpl<window>
public:
dialog_main* dlg_main;
formview* form_view;
dialog_licensing* license;
bootstrapper* bootstrap;
/*dialog_licensing* license;*/
/*bootstrapper* bootstrap;*/

explicit window(bootstrapper*);
explicit window(/*bootstrapper**/);
~window();

DECLARE_FRAME_WND_CLASS(L"Audio Router", IDR_MAINFRAME);
Expand Down

0 comments on commit 81516a2

Please sign in to comment.