Compare commits

...
4 changed files with 150 additions and 15 deletions

No files matched your search

+8
View File
@@ -858,6 +858,14 @@ Warning і початковий фокус на No.
- F8 переміщує підтверджені елементи в кошик Windows. Shift+Delete видаляє підтверджене дерево від вкладених елементів до батьківської папки. Прогрес і підсумок окремо показують успішні, пропущені й невдалі дії.
- Cancel і Esc у вікні прогресу відкривають спільне червоне підтвердження скасування. Yes зупиняє операцію, а No або Esc у підтвердженні повертає до прогресу. Початковий фокус стоїть на No.
## Обмін і компонування панелей
- **Commands → Swap panels** або **Ctrl+U** міняє панелі місцями. Активна панель, шлях, курсор, прокручування, позначки, поточний режим і Quick View переходять разом.
- **Options → File panel modes → Panel layout** містить незалежні параметри для правої кнопки, кнопок дисків і компактного компонування. За замовчуванням ці параметри вимкнені.
- **Mark items with the right mouse button** перемикає позначку рядка. **Shift+права кнопка**, **Shift+F10** і клавіша **Menu** відкривають контекстне меню. Права кнопка на порожньому місці також відкриває контекстне меню панелі.
- **Show drive buttons** додає наявні локальні диски над панелями. Кнопка відкриває корінь диска в активній панелі. Якщо всі диски не поміщаються, **…** відкриває Change drive.
- **Compact commander layout** скорочує проміжки між шляхом, рядками та станом, зберігаючи розмір шрифту, командний рядок і клавіші дій.
## Перевірка змін
Відкрий Copy і Warning в одній збірці та порівняй висоту нижніх секцій, центрування, повноту підписів і видимість фокуса. Перевір Tab, стрілки й Esc. Після узгодження нового правила онови відповідний розділ цього документа.
+4
View File
@@ -169,6 +169,10 @@ BEGIN
COMBOBOX 273, 132, 40, 108, 74, CBS_DROPDOWNLIST | WS_TABSTOP
LTEXT "&Right panel", 507, 251, 27, 117, 11
COMBOBOX 274, 251, 40, 117, 74, CBS_DROPDOWNLIST | WS_TABSTOP
AUTOCHECKBOX "Mark items with the right mouse button", 520, 132, 64, 245, 13
AUTOCHECKBOX "Show drive buttons", 521, 132, 81, 245, 13
AUTOCHECKBOX "Compact commander layout", 522, 132, 98, 245, 13
LTEXT "Shift+right-click opens the Windows context menu.", 523, 132, 115, 245, 13
GROUPBOX "Wide panel columns", 275, 129, 27, 259, 59
LTEXT "Size column &width (6–16 characters)", 276, 138, 44, 175, 10
EDITTEXT 201, 335, 41, 43, 14, ES_NUMBER | ES_AUTOHSCROLL
+119 -13
View File
@@ -834,6 +834,11 @@ constexpr DWORD defaultStatusFields=15;
int sizeWidth=defaultSizeWidth;
bool alignExtensions=defaultAlignExtensions, showDetails=defaultShowDetails;
bool alignFolders=defaultAlignFolders;
bool rightClickMarks{}, showDriveButtons{}, compactLayout{};
constexpr wchar_t rightClickMarksKey[]=L"RightClickMarks", driveButtonsKey[]=L"ShowDriveButtons",
compactLayoutKey[]=L"CompactPanelLayout";
constexpr int firstDriveButton=660, moreDriveButton=firstDriveButton+26;
std::array<HWND,27> driveButtons{};
DWORD statusFields=defaultStatusFields;
std::vector<fs::path> drivePaths;
bool lanDrivePicker{};
@@ -1594,6 +1599,8 @@ void swapPanels(HWND window)
}
notifyFilesPreferences(window);
layout(window);
showFileDetails(panels[active]);
RedrawWindow(window,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
}
bool hasSelectionSummary()
@@ -1631,7 +1638,12 @@ void layout(HWND window,bool activeOnly)
const bool gitMode=showingGitChanges();
const int terminalBottom=std::max(4,inputTop);
const int summaryHeight=!terminalVisible && hasSelectionSummary()?textHeight:0;
const int detailsHeight=terminalVisible?0:textHeight+12+summaryHeight;
const int detailsInset=compactLayout?2:4;
const int detailsHeight=terminalVisible?0:textHeight+(compactLayout?4:12)+summaryHeight;
const DWORD driveMask=showDriveButtons && !terminalVisible && !gitMode?GetLogicalDrives():0;
const int driveHeight=driveMask?textHeight+2:0;
const int panelMargin=compactLayout?4:5;
const int pathTop=driveHeight+(compactLayout?1:4);
const int terminalTop=terminalVisible?4:std::max(4,terminalBottom-
std::min(terminalRows,std::max(0,(terminalBottom-detailsHeight)/textHeight-4))*textHeight);
const int panelBottom=terminalTop-detailsHeight;
@@ -1645,21 +1657,41 @@ void layout(HWND window,bool activeOnly)
};
if(!activeOnly)
{
const int buttonWidth=std::max(4*cellWidth,32);
const int maxButtons=std::max(1,(width-8)/buttonWidth);
int drives=0;
for(int letter=0;letter<26;++letter) if(driveMask&(1UL<<letter)) ++drives;
const int visibleDrives=drives>maxButtons?maxButtons-1:drives;
int slot=0;
for(int letter=0;letter<26;++letter)
{
const auto button=driveButtons[letter];
if(!button) continue;
const bool visible=(driveMask&(1UL<<letter)) && slot<visibleDrives;
if(visible) place(button,4+slot++*buttonWidth,0,buttonWidth,textHeight);
ShowWindow(button,visible?SW_SHOWNA:SW_HIDE);
}
if(const auto more=driveButtons.back())
{
place(more,4+slot*buttonWidth,0,buttonWidth,textHeight);
ShowWindow(more,drives>maxButtons?SW_SHOWNA:SW_HIDE);
}
const int headingTop=pathTop+textHeight+(compactLayout?2:6);
for (int i = 0; i < 2; ++i)
{
int x = i ? middle + 2 : 0;
int end = i ? width : middle - 2;
place(panels[i].path, x + 5, 4, std::max(0, end - x - 10), textHeight);
place(panels[i].path, x+panelMargin,pathTop,std::max(0,end-x-2*panelMargin),textHeight);
int headingHeight=detailedPanel(panels[i])?textHeight:0;
const int listWidth=std::max(0,end-x-8-scrollBarWidth(panels[i].list));
const int listWidth=std::max(0,end-x-panelMargin-3-scrollBarWidth(panels[i].list));
const bool panelVisible=!gitMode && !terminalVisible && (!quickViewWindow || i==quickViewSource);
ShowWindow(panels[i].path,panelVisible?SW_SHOWNA:SW_HIDE);
ShowWindow(panels[i].list,panelVisible?SW_SHOWNA:SW_HIDE);
place(panels[i].heading,x+5,textHeight+10,listWidth,headingHeight);
place(panels[i].heading,x+panelMargin,headingTop,listWidth,headingHeight);
ShowWindow(panels[i].heading,panelVisible && detailedPanel(panels[i])?SW_SHOWNA:SW_HIDE);
place(panels[i].list, x + 5, textHeight+10+headingHeight,listWidth,
std::max(0, panelBottom-textHeight-10-headingHeight));
place(panels[i].selectionSummary,x+8,panelBottom+4,std::max(0,end-x-16),summaryHeight);
place(panels[i].list,x+panelMargin,headingTop+headingHeight,listWidth,
std::max(0,panelBottom-headingTop-headingHeight));
place(panels[i].selectionSummary,x+8,panelBottom+detailsInset,std::max(0,end-x-16),summaryHeight);
ShowWindow(panels[i].selectionSummary,panelVisible && summaryHeight?SW_SHOWNA:SW_HIDE);
}
place(menuBar,0,0,width,textHeight+4);
@@ -1669,7 +1701,7 @@ void layout(HWND window,bool activeOnly)
}
const int detailsLeft=active?middle+2:0;
const int detailsRight=active?width:middle-2;
place(status,detailsLeft+8,panelBottom+4+summaryHeight,std::max(0,detailsRight-detailsLeft-16),textHeight);
place(status,detailsLeft+8,panelBottom+detailsInset+summaryHeight,std::max(0,detailsRight-detailsLeft-16),textHeight);
const auto &current=panels[active];
const auto prompt=panelLocation(current)+(terminalVisible?L"> ":L">");
SetWindowTextW(terminalPrompt,prompt.c_str());
@@ -1686,7 +1718,13 @@ void layout(HWND window,bool activeOnly)
place(terminalInput,4+promptWidth,inputTop,std::max(0,width-8-promptWidth),textHeight);
if(activeOnly)
{
const RECT details{0,panelBottom+4+summaryHeight,width,panelBottom+4+summaryHeight+textHeight};
const RECT details{0,panelBottom+detailsInset+summaryHeight,width,
panelBottom+detailsInset+summaryHeight+textHeight};
if(driveHeight)
{
const RECT drives{0,0,width,driveHeight};
RedrawWindow(window,&drives,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
}
const RECT commandLine{0,inputTop,width,inputTop+textHeight};
if(!terminalVisible) RedrawWindow(window,&details,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
RedrawWindow(window,&commandLine,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
@@ -1723,8 +1761,9 @@ void layout(HWND window,bool activeOnly)
for(const auto preview:{quickViewWindow,quickImageWindow})
{
if(!preview) continue;
SetWindowPos(preview,nullptr,left+5,4,std::max(0,right-left-10),
std::max(0,panelBottom+summaryHeight+textHeight),SWP_NOZORDER|SWP_NOACTIVATE);
const int bottom=panelBottom+summaryHeight+textHeight+detailsInset;
SetWindowPos(preview,nullptr,left+panelMargin,pathTop,std::max(0,right-left-2*panelMargin),
std::max(0,bottom-pathTop),SWP_NOZORDER|SWP_NOACTIVATE);
const bool current=quickViewDisplaysImage==(preview==quickImageWindow);
ShowWindow(preview,!gitMode && !terminalVisible && current?SW_SHOWNA:SW_HIDE);
}
@@ -3900,6 +3939,7 @@ void selectDrive()
else if(menuIndex==2 && row==15) showProcesses(owner);
else if(menuIndex==2 && row==16) openGitChanges(owner,panels[active]);
else if(menuIndex==2 && row==17) showEnvironmentPanel(owner);
else if(menuIndex==2 && row==18) swapPanels(owner);
else if(menuIndex==1 && row==4) createArchive(owner,panels[active]);
else if(menuIndex==1 && row==5) showPanelItemProperties(owner,panels[active]);
else if(menuIndex==1 && row==6) showPanelLockProcesses(owner,panels[active]);
@@ -7876,6 +7916,27 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
if(message==WM_RBUTTONUP)
{
POINT screen{GET_X_LPARAM(lp),GET_Y_LPARAM(lp)};
if(rightClickMarks && !(wp&MK_SHIFT) && commandLineAvailable(GetParent(window)))
{
auto &panel=panels[index];
const auto row=panelRowAt(window,screen,SendMessageW(window,LB_GETTOPINDEX,0,0),panel.rows.size());
if(row!=LB_ERR && panel.sizes[row]!=L"Up" && !transferProfileList(panel))
{
closePanelSearch();
SetFocus(window);
activatePanel(index);
panelClipboardContext=true;
clearTerminalSelection();
const auto previous=currentPanelRow(panel);
SendMessageW(window,LB_SETCURSEL,row,0);
markPanelRow(panel,row,!panel.marked[row]);
invalidatePanelRow(window,row);
if(previous!=row) invalidatePanelRow(window,previous);
updateSelectionSummary(panel);
showFileDetails(panel);
return 0;
}
}
ClientToScreen(window,&screen);
showPanelContextMenu(window,MAKELPARAM(screen.x,screen.y));
return 0;
@@ -8098,6 +8159,9 @@ bool loadFilesPreferences(HWND window)
alignExtensions=preference(L"AlignExtensions",defaultAlignExtensions)!=0;
showDetails=preference(L"ShowDetails",defaultShowDetails)!=0;
alignFolders=preference(L"AlignFolders",defaultAlignFolders)!=0;
rightClickMarks=preference(rightClickMarksKey,0)!=0;
showDriveButtons=preference(driveButtonsKey,0)!=0;
compactLayout=preference(compactLayoutKey,0)!=0;
statusFields=preference(L"StatusFields",defaultStatusFields)&15;
loadCommandHistoryKeys();
loadComparisonShortcut();
@@ -8163,7 +8227,7 @@ void openMenu(HWND window, int index)
L"Hibernate remote PC",L"Update remote KSwitcher",L"Compare files\t"+comparisonShortcutLabel(),
L"Find files\tAlt+F7",quickViewWindow?L"Close Quick View\tCtrl+Q":L"Quick View\tCtrl+Q",
L"Copy full path\tCtrl+Shift+C",L"Space Analyzer",L"View as hex\tShift+F3",L"Viewer bookmarks…",L"Processes…",
L"Git Changes…",L"Environment Variables…"};
L"Git Changes…",L"Environment Variables…",L"Swap panels\tCtrl+U"};
}
const auto &panel=panels[active];
const bool remoteResults=remoteSearchResults(panel);
@@ -8189,6 +8253,7 @@ void openMenu(HWND window, int index)
else if(index==2)
{
commandActions={0,3,11,-1,1,13,14,2,4,5,8};
if(!terminalVisible) commandActions.insert(commandActions.begin()+1,18);
if(!terminalVisible) commandActions.push_back(15);
if(gitChangesAvailable(panel)) commandActions.push_back(16);
if(!terminalVisible) commandActions.push_back(17);
@@ -8567,6 +8632,13 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
for (int i = 0; i < static_cast<int>(std::size(commands)); ++i)
commands[i] = CreateWindowW(L"BUTTON", keyBar[i].label, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
0, 0, 0, 0, window, reinterpret_cast<HMENU>(static_cast<INT_PTR>(keyBar[i].id)), instance, nullptr);
for(int i=0;i<static_cast<int>(driveButtons.size());++i)
{
const wchar_t letter[]{static_cast<wchar_t>(L'A'+i),L':',0};
driveButtons[i]=CreateWindowW(L"BUTTON",i==26?L"…":letter,WS_CHILD|BS_OWNERDRAW|WS_CLIPSIBLINGS,
0,0,0,0,window,reinterpret_cast<HMENU>(static_cast<INT_PTR>(firstDriveButton+i)),instance,nullptr);
if(!driveButtons[i]) return -1;
}
for (int i = 0; i < 2; ++i)
{
auto &panel = panels[i];
@@ -8610,6 +8682,13 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
RedrawWindow(window,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
return 0;
}
case WM_DEVICECHANGE:
if(showDriveButtons)
{
layout(window);
RedrawWindow(window,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);
}
break;
case WM_SIZE:
hideCompletion();
hidePicker();
@@ -8690,7 +8769,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
GetWindowRect(status,&details);
MapWindowPoints(nullptr,window,reinterpret_cast<POINT*>(&details),2);
const RECT divider{box.left+1,box.bottom-2,box.right-1,box.bottom-1};
box.bottom=std::max(box.bottom,details.bottom+6);
box.bottom=std::max(box.bottom,details.bottom+(compactLayout?2:6));
FrameRect(dc,&box,border);
if(IsWindowVisible(panel.list)) paintScrollPosition(window,dc,panel.list,colors[PanelBlue]);
InflateRect(&box,-3,-3);
@@ -8862,6 +8941,21 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
GetWindowTextW(item.hwndItem,label,64);
text=label;
}
if(item.CtlID>=firstDriveButton && item.CtlID<=moreDriveButton)
{
const auto &panel=panels[active];
const auto drive=panel.directory.root_name().native();
const bool selected=item.CtlID!=moreDriveButton && !panel.peer && !panel.ftp && !panel.archive &&
drive.size()==2 && towupper(drive.front())==L'A'+item.CtlID-firstDriveButton;
auto bounds=item.rcItem;
FillRect(item.hDC,&bounds,selected?teal:blue);
SelectObject(item.hDC,mono);
SetBkMode(item.hDC,TRANSPARENT);
SetTextColor(item.hDC,colors[selected?Text:Frame]);
DrawTextW(item.hDC,text.c_str(),-1,&bounds,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX);
if(item.itemState&ODS_FOCUS) DrawFocusRect(item.hDC,&bounds);
return TRUE;
}
if(std::find(std::begin(commands),std::end(commands),item.hwndItem)!=std::end(commands))
{
if(item.CtlID==114 && remoteSearchResults(panels[active]) && panels[active].ftp)
@@ -9151,6 +9245,18 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
}
return 0;
}
if(HIWORD(wp)==BN_CLICKED && LOWORD(wp)>=firstDriveButton && LOWORD(wp)<=moreDriveButton)
{
const auto id=LOWORD(wp);
if(id==moreDriveButton) chooseDrive(active);
else
{
const wchar_t root[]{static_cast<wchar_t>(L'A'+id-firstDriveButton),L':',L'\\',0};
openOn(panels[active],root,false,{});
restoreCommandFocus();
}
return 0;
}
if(LOWORD(wp)==121 && HIWORD(wp)==LBN_DBLCLK) selectDrive();
if(LOWORD(wp)>=130 && LOWORD(wp)<=134 && HIWORD(wp)==BN_CLICKED)
{
+19 -2
View File
@@ -11,7 +11,8 @@ constexpr const wchar_t *colorNames[]{L"Panel background",L"Text",L"Frame",L"Pop
L"Menu selection",L"Command bar",L"File cursor"};
enum PanelSection { PanelLayout, WideColumns, StatusColumns };
constexpr const wchar_t *panelSectionNames[]{L"Panel layout",L"Wide panel columns",L"Status line columns"};
constexpr int panelLayoutControls[]{506,273,507,274};
constexpr int rightClickMarksControl=520, driveButtonsControl=521, compactLayoutControl=522;
constexpr int panelLayoutControls[]{506,273,507,274,rightClickMarksControl,driveButtonsControl,compactLayoutControl,523};
constexpr int wideColumnControls[]{275,276,201,202,204};
constexpr int statusColumnControls[]{277,203,205,206,207,208};
constexpr int colorOptionControls[]{279,280};
@@ -67,6 +68,9 @@ struct PanelProperty
};
constexpr PanelProperty panelProperties[]{
{PanelLayout,273,L"Left panel mode",defaultWide?1u:0u},{PanelLayout,274,L"Right panel mode",defaultWide?1u:0u},
{PanelLayout,rightClickMarksControl,L"Mark items with the right mouse button",0},
{PanelLayout,driveButtonsControl,L"Show drive buttons",0},
{PanelLayout,compactLayoutControl,L"Compact commander layout",0},
{WideColumns,201,L"Size column width",defaultSizeWidth},
{WideColumns,202,L"Align file extensions",defaultAlignExtensions},
{WideColumns,204,L"Align folder extensions",defaultAlignFolders},
@@ -107,6 +111,7 @@ struct OptionsBaseline
bool remoteUpdate=ks::lan::remoteUpdateAllowed();
DWORD width=static_cast<DWORD>(sizeWidth), fields=statusFields;
bool extensions=alignExtensions, folders=alignFolders, details=showDetails;
bool mouseMarks=rightClickMarks, drives=showDriveButtons, compact=compactLayout;
std::array<PanelMode,2> modes{panels[0].mode,panels[1].mode};
ks::files::TextSettings text=ks::files::loadTextPreferences();
ComparisonAppearance comparison=readComparisonAppearance();
@@ -181,6 +186,8 @@ void updateOptionsApply(HWND dialog,const OptionsDraft &draft)
const bool dirty=!valid || draft.markdownError || width!=base.width ||
panelModeOption(dialog,0)!=base.modes[0] || panelModeOption(dialog,1)!=base.modes[1] ||
checked(202)!=base.extensions || checked(204)!=base.folders || checked(203)!=base.details ||
checked(rightClickMarksControl)!=base.mouseMarks || checked(driveButtonsControl)!=base.drives ||
checked(compactLayoutControl)!=base.compact ||
fields!=base.fields || draft.palette!=base.palette || draft.styles!=base.styles ||
draft.framePadding!=base.padding || optionsFontChanged(draft) ||
optionHistoryKeys(dialog)!=base.keys || checked(optionsRemoteTerminal)!=base.remoteTerminal ||
@@ -679,6 +686,9 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
CheckDlgButton(dialog,202,alignExtensions);
CheckDlgButton(dialog,203,showDetails);
CheckDlgButton(dialog,204,alignFolders);
CheckDlgButton(dialog,rightClickMarksControl,rightClickMarks);
CheckDlgButton(dialog,driveButtonsControl,showDriveButtons);
CheckDlgButton(dialog,compactLayoutControl,compactLayout);
showPanelModeOptions(dialog);
for(int i=0;i<4;++i) CheckDlgButton(dialog,205+i,(statusFields>>i)&1u);
setOptionHistoryKeys(dialog,commandHistoryKeys);
@@ -898,7 +908,8 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
}
case 201:
case 202: case 203: case 204: case 205: case 206: case 207: case 208:
case 273: case 274: case optionsRemoteTerminal: case optionsRemoteHibernate: case optionsRemoteUpdate:
case 273: case 274: case rightClickMarksControl: case driveButtonsControl: case compactLayoutControl:
case optionsRemoteTerminal: case optionsRemoteHibernate: case optionsRemoteUpdate:
updateOptionsApply(dialog,*draft);
return TRUE;
case 321: case 323: case comparisonShortcutControl:
@@ -1050,6 +1061,9 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
saveChanged(L"AlignExtensions",checked(202),base.extensions);
saveChanged(L"AlignFolders",checked(204),base.folders);
saveChanged(L"ShowDetails",checked(203),base.details);
saveChanged(rightClickMarksKey,checked(rightClickMarksControl),base.mouseMarks);
saveChanged(driveButtonsKey,checked(driveButtonsControl),base.drives);
saveChanged(compactLayoutKey,checked(compactLayoutControl),base.compact);
DWORD fields=preference(L"StatusFields",defaultStatusFields)&15;
const auto initialFields=fields;
for(int i=0;i<4;++i)
@@ -1092,6 +1106,9 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
CheckDlgButton(dialog,202,alignExtensions);
CheckDlgButton(dialog,203,showDetails);
CheckDlgButton(dialog,204,alignFolders);
CheckDlgButton(dialog,rightClickMarksControl,rightClickMarks);
CheckDlgButton(dialog,driveButtonsControl,showDriveButtons);
CheckDlgButton(dialog,compactLayoutControl,compactLayout);
showPanelModeOptions(dialog);
for(int i=0;i<4;++i) CheckDlgButton(dialog,205+i,(statusFields>>i)&1u);
setOptionHistoryKeys(dialog,commandHistoryKeys);