Make focus on edit field in Project panel File relocalizer dialog

- tab focus reorder
- optimize dark mod
- fix override warnings
- add initializer

Fix #13575, close #13576
This commit is contained in:
ozone10 2023-04-23 17:12:27 +02:00 committed by Don Ho
parent 5b5c30b0d3
commit 61d2d36821
3 changed files with 19 additions and 29 deletions

View File

@ -18,7 +18,7 @@
#include "ProjectPanel.h"
#include "resource.h"
#include "tinyxml.h"
//#include "tinyxml.h"
#include "CustomFileDialog.h"
#include "localization.h"
#include "Parameters.h"
@ -125,7 +125,7 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{
int width = LOWORD(lParam);
int height = HIWORD(lParam);
RECT toolbarMenuRect;
RECT toolbarMenuRect{};
::GetClientRect(_hToolbarMenu, &toolbarMenuRect);
::MoveWindow(_hToolbarMenu, 0, 0, width, toolbarMenuRect.bottom, TRUE);
@ -1335,11 +1335,13 @@ intptr_t CALLBACK FileRelocalizerDlg::run_dlgProc(UINT Message, WPARAM wParam, L
{
switch (Message)
{
case WM_INITDIALOG :
case WM_INITDIALOG:
{
goToCenter();
::SetDlgItemText(_hSelf, IDC_EDIT_FILEFULLPATHNAME, _fullFilePath.c_str());
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
return TRUE;
}
@ -1357,11 +1359,7 @@ intptr_t CALLBACK FileRelocalizerDlg::run_dlgProc(UINT Message, WPARAM wParam, L
case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
case WM_PRINTCLIENT:
@ -1373,7 +1371,7 @@ intptr_t CALLBACK FileRelocalizerDlg::run_dlgProc(UINT Message, WPARAM wParam, L
break;
}
case WM_COMMAND :
case WM_COMMAND:
{
switch (wParam)
{
@ -1400,7 +1398,7 @@ intptr_t CALLBACK FileRelocalizerDlg::run_dlgProc(UINT Message, WPARAM wParam, L
return FALSE;
}
int FileRelocalizerDlg::doDialog(const TCHAR *fn, bool isRTL)
int FileRelocalizerDlg::doDialog(const TCHAR *fn, bool isRTL)
{
_fullFilePath = fn;

View File

@ -65,10 +65,6 @@ public:
_panelID = panelID;
}
virtual void display(bool toShow = true) const {
DockingDlgInterface::display(toShow);
};
void setParent(HWND parent2set){
_hParent = parent2set;
};
@ -96,10 +92,10 @@ public:
};
bool checkIfNeedSave();
virtual void setBackgroundColor(COLORREF bgColour) {
void setBackgroundColor(COLORREF bgColour) override {
TreeView_SetBkColor(_treeView.getHSelf(), bgColour);
};
virtual void setForegroundColor(COLORREF fgColour) {
void setForegroundColor(COLORREF fgColour) override {
TreeView_SetTextColor(_treeView.getHSelf(), fgColour);
};
bool enumWorkSpaceFiles(HTREEITEM tvFrom, const std::vector<generic_string> & patterns, std::vector<generic_string> & fileNames);
@ -132,7 +128,7 @@ protected:
void setWorkSpaceDirty(bool isDirty);
void popupMenuCmd(int cmdID);
POINT getMenuDisplayPoint(int iButton);
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
bool buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem);
void notified(LPNMHDR notification);
void showContextMenu(int x, int y);
@ -148,21 +144,17 @@ class FileRelocalizerDlg : public StaticDialog
{
public :
FileRelocalizerDlg() = default;
void init(HINSTANCE hInst, HWND parent) {
Window::init(hInst, parent);
};
int doDialog(const TCHAR *fn, bool isRTL = false);
virtual void destroy() {
};
void destroy() override {};
generic_string getFullFilePath() {
return _fullFilePath;
};
protected :
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
private :
generic_string _fullFilePath;

View File

@ -18,7 +18,7 @@
#include <windows.h>
#include "ProjectPanel_rc.h"
IDD_PROJECTPANEL DIALOGEX 26, 41, 142, 324
IDD_PROJECTPANEL DIALOGEX 0, 0, 142, 324
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
CAPTION "Project"
@ -27,13 +27,13 @@ BEGIN
END
IDD_FILERELOCALIZER_DIALOG DIALOGEX 0, 0, 350, 48
IDD_FILERELOCALIZER_DIALOG DIALOGEX 0, 0, 350, 45
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
CAPTION "Change file full path name"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,235,27,50,14
PUSHBUTTON "Cancel",IDCANCEL,290,27,50,14
EDITTEXT IDC_EDIT_FILEFULLPATHNAME,7,7,335,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_FILEFULLPATHNAME,7,7,336,12,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,124,25,50,14
PUSHBUTTON "Cancel",IDCANCEL,177,25,50,14
END