Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ target_include_directories(${APP} PUBLIC external/)
target_include_directories(${APP} PRIVATE include/)


add_custom_command(TARGET ${APP} POST_BUILD
add_custom_command(TARGET ${APP} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/bin" "$<TARGET_FILE_DIR:${APP}>")
3 changes: 3 additions & 0 deletions include/MainWindow.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ namespace BrokenBytes::DualSense4Windows::UI {
LRESULT CALLBACK ProcessEvent(UINT uMsg, WPARAM wParam, LPARAM lParam) override;

private:
std::unique_ptr<ColorPicker> _picker;
std::vector<char*> _devices;
std::vector<DualSenseInfo> _info;
HWND _tabView;
HWND _listView;
std::map<std::wstring, HWND> _tabs;

void ShowColorPicker();

HWND CreateTabControl();
HWND CreateListViewControl();
Expand Down
8 changes: 6 additions & 2 deletions src/ColorPicker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ namespace BrokenBytes::DualSense4Windows::UI {
dwPos[1] = SendMessage(_gH, TBM_GETPOS, 0, 0);
dwPos[2] = SendMessage(_bH, TBM_GETPOS, 0, 0);
SetColor(dwPos[0], dwPos[1], dwPos[2]);
RedrawWindow(Handle(), nullptr, nullptr, RDW_INVALIDATE);
UpdateWindow(Handle());
RedrawWindow(
Handle(),
nullptr,
nullptr,
RDW_INVALIDATE
);
break;
default:
return DefWindowProcA(Handle(), uMsg, wParam, lParam);
Expand Down
27 changes: 22 additions & 5 deletions src/MainWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ namespace BrokenBytes::DualSense4Windows::UI {

void MainWindow::Show() {
Window::Show();
auto color = new ColorPicker(Color { 120, 120, 120});
color->ColorChanged.connect([this](Color c) {
ColorChanged(0, c);
});
}

void MainWindow::Hide() {
Expand Down Expand Up @@ -94,6 +90,7 @@ namespace BrokenBytes::DualSense4Windows::UI {
PAINTSTRUCT ps;
HDC hdc;

// TODO: Should move to switch
if(uMsg == WM_DESTROY) {
PostQuitMessage(0);
}
Expand All @@ -105,10 +102,31 @@ namespace BrokenBytes::DualSense4Windows::UI {
if (uMsg == WM_PAINT) {

}

if(uMsg == WM_NOTIFY) {
switch (reinterpret_cast<LPNMHDR>(lParam)->code) {
case LVN_ITEMACTIVATE:
ShowColorPicker();
break;
}
}

return DefWindowProc(Handle(), uMsg, wParam, lParam);
}

void MainWindow::ShowColorPicker() {
if(_picker != nullptr) {
_picker->Show();
return;
}

_picker = std::make_unique<ColorPicker>(Color{ 120, 120, 120 });
_picker->ColorChanged.connect([this](Color c) {
ColorChanged(0, c);
});
_picker->Show();
}

HWND MainWindow::CreateTabControl() {
RECT rcClient;
INITCOMMONCONTROLSEX icex;
Expand Down Expand Up @@ -149,7 +167,6 @@ namespace BrokenBytes::DualSense4Windows::UI {
}

HWND MainWindow::CreateListViewControl() {

RECT r;
GetWindowRect(_tabView, &r);

Expand Down