Skip to content

Commit cc13a25

Browse files
committed
Clarified DecorateItemsWithHotkeys.
1 parent 91beb2d commit cc13a25

28 files changed

Lines changed: 232 additions & 223 deletions

far/changelog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
--------------------------------------------------------------------------------
2+
MZK 2026-08-15 12:52:07-04:00 - build 6728
3+
4+
1. Clarified `DecorateItemsWithHotkeys`.
5+
6+
2. Refactoring.
7+
18
--------------------------------------------------------------------------------
29
drkns 2026-08-11 21:39:09+01:00 - build 6727
310

far/codepage_selection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ void codepages::SetFavorite(bool State)
434434
DeleteFavorite(codePage);
435435

436436
// Создаём новый элемент меню
437-
menu_item_ex newItem{ CodePagesMenu->current().GetName() };
437+
menu_item_ex newItem{ CodePagesMenu->current().get_name() };
438438
newItem.SimpleUserData = codePage;
439439
// Сохраняем позицию курсора
440440
size_t position = CodePagesMenu->GetSelectPos();
@@ -614,7 +614,7 @@ void codepages::EditCodePageName()
614614
const auto Position = CodePagesMenu->GetSelectPos();
615615
if (IsPositionStandard(Position))
616616
return;
617-
string_view CodePageName = CodePagesMenu->at(Position).GetName();
617+
string_view CodePageName = CodePagesMenu->at(Position).get_name();
618618
const auto BoxPosition = CodePageName.find(BoxSymbols[BS_V1]);
619619
if (BoxPosition == string_view::npos)
620620
return;

far/config.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,17 +1167,17 @@ void Options::SetFilePanelModes()
11671167

11681168
const auto MenuCount = ViewSettings.size();
11691169
// +1 for separator
1170-
std::vector<menu_item> ModeListMenu(MenuCount > predefined_panel_modes_count? MenuCount + 1: MenuCount);
1170+
std::vector<menu_item_data> ModeListMenu(MenuCount > predefined_panel_modes_count? MenuCount + 1: MenuCount);
11711171

11721172
for (const auto i: std::views::iota(0uz, ViewSettings.size()))
11731173
{
1174-
ModeListMenu[RealModeToDisplay(i)].SetName(ViewSettings[i].Name);
1174+
ModeListMenu[RealModeToDisplay(i)].Name = ViewSettings[i].Name;
11751175
}
11761176

11771177
for (const auto i: std::views::iota(0uz, predefined_panel_modes_count))
11781178
{
1179-
if (ModeListMenu[i].GetName().empty())
1180-
ModeListMenu[i].SetName(msg(PredefinedNames[i]));
1179+
if (ModeListMenu[i].Name.empty())
1180+
ModeListMenu[i].Name = msg(PredefinedNames[i]);
11811181
}
11821182

11831183
if (MenuCount > predefined_panel_modes_count)
@@ -1190,7 +1190,7 @@ void Options::SetFilePanelModes()
11901190
bool AddNewMode = false;
11911191
bool DeleteMode = false;
11921192

1193-
ModeListMenu[CurMode].SetSelect(true);
1193+
ModeListMenu[CurMode].set_select(true);
11941194
{
11951195
const auto ModeList = VMenu2::create(msg(lng::MEditPanelModes), ModeListMenu, ScrY - 4);
11961196
ModeList->SetPosition({ -1, -1, 0, 0 });
@@ -1310,7 +1310,7 @@ void Options::SetFilePanelModes()
13101310

13111311
auto ModeDlg = MakeDialogItems<MD_COUNT>(
13121312
{
1313-
{ DI_DOUBLEBOX, {{3, 1 }, {72, 17}}, DIF_NONE, AddNewMode ? L""sv : ModeListMenu[CurMode].GetName(), },
1313+
{ DI_DOUBLEBOX, {{3, 1 }, {72, 17}}, DIF_NONE, AddNewMode ? L""sv : ModeListMenu[CurMode].Name, },
13141314
{ DI_TEXT, {{5, 2 }, {0, 2 }}, DIF_NONE, msg(lng::MEditPanelModeName), },
13151315
{ DI_EDIT, {{5, 3 }, {70, 3 }}, DIF_FOCUS, },
13161316
{ DI_TEXT, {{5, 4 }, {0, 4 }}, DIF_NONE, msg(lng::MEditPanelModeTypes), },
@@ -3055,46 +3055,46 @@ enum enumOptionsMenu
30553055
MENU_OPTIONS_SAVESETUP
30563056
};
30573057

3058-
static void SetLeftRightMenuChecks(menu_item* pMenu, bool bLeft)
3058+
static void SetLeftRightMenuChecks(menu_item_data* pMenu, bool bLeft)
30593059
{
30603060
const auto pPanel = bLeft? Global->CtrlObject->Cp()->LeftPanel() : Global->CtrlObject->Cp()->RightPanel();
30613061

30623062
switch (pPanel->GetType())
30633063
{
30643064
case panel_type::FILE_PANEL:
3065-
pMenu[RealModeToDisplay(pPanel->GetViewMode())].SetCheck();
3065+
pMenu[RealModeToDisplay(pPanel->GetViewMode())].set_check(true);
30663066
break;
30673067

30683068
case panel_type::INFO_PANEL:
3069-
pMenu[MENU_PANEL_INFOPANEL].SetCheck();
3069+
pMenu[MENU_PANEL_INFOPANEL].set_check(true);
30703070
break;
30713071

30723072
case panel_type::TREE_PANEL:
3073-
pMenu[MENU_PANEL_TREEPANEL].SetCheck();
3073+
pMenu[MENU_PANEL_TREEPANEL].set_check(true);
30743074
break;
30753075

30763076
case panel_type::QVIEW_PANEL:
3077-
pMenu[MENU_PANEL_QUICKVIEW].SetCheck();
3077+
pMenu[MENU_PANEL_QUICKVIEW].set_check(true);
30783078
break;
30793079
}
30803080

3081-
pPanel->GetShowShortNamesMode()? pMenu[MENU_PANEL_LONGNAMES].ClearCheck() : pMenu[MENU_PANEL_LONGNAMES].SetCheck();
3081+
pMenu[MENU_PANEL_LONGNAMES].set_check(!pPanel->GetShowShortNamesMode());
30823082
}
30833083

30843084
void Options::ShellOptions(bool LastCommand, const MOUSE_EVENT_RECORD *MouseEvent)
30853085
{
3086-
const auto ApplyViewModesNames = [this](menu_item* Menu)
3086+
const auto ApplyViewModesNames = [this](menu_item_data* Menu)
30873087
{
30883088
for (const auto i: std::views::iota(0uz, predefined_panel_modes_count))
30893089
{
30903090
if (!ViewSettings[i].Name.empty())
3091-
Menu[RealModeToDisplay(i)].SetName(ViewSettings[i].Name);
3091+
Menu[RealModeToDisplay(i)].Name = ViewSettings[i].Name;
30923092
}
30933093
};
30943094

30953095
const auto no_tree = Tree.TurnOffCompletely? LIF_HIDDEN : LIF_NONE;
30963096

3097-
menu_item LeftMenu[]
3097+
menu_item_data LeftMenu[]
30983098
{
30993099
{ msg(lng::MMenuBriefView), LIF_SELECTED, KEY_CTRL1 },
31003100
{ msg(lng::MMenuMediumView), 0, KEY_CTRL2 },
@@ -3120,7 +3120,7 @@ void Options::ShellOptions(bool LastCommand, const MOUSE_EVENT_RECORD *MouseEven
31203120
ApplyViewModesNames(LeftMenu);
31213121
VMenu::DecorateItemsWithHotkeys(LeftMenu);
31223122

3123-
menu_item FilesMenu[]
3123+
menu_item_data FilesMenu[]
31243124
{
31253125
{ msg(lng::MMenuView), LIF_SELECTED, KEY_F3 },
31263126
{ msg(lng::MMenuEdit), 0, KEY_F4 },
@@ -3146,7 +3146,7 @@ void Options::ShellOptions(bool LastCommand, const MOUSE_EVENT_RECORD *MouseEven
31463146
};
31473147
VMenu::DecorateItemsWithHotkeys(FilesMenu);
31483148

3149-
menu_item CmdMenu[]
3149+
menu_item_data CmdMenu[]
31503150
{
31513151
{ msg(lng::MMenuFindFile), LIF_SELECTED, KEY_ALTF7 },
31523152
{ msg(lng::MMenuHistory), 0, KEY_ALTF8 },
@@ -3171,7 +3171,7 @@ void Options::ShellOptions(bool LastCommand, const MOUSE_EVENT_RECORD *MouseEven
31713171
};
31723172
VMenu::DecorateItemsWithHotkeys(CmdMenu);
31733173

3174-
menu_item OptionsMenu[]
3174+
menu_item_data OptionsMenu[]
31753175
{
31763176
{ msg(lng::MMenuSystemSettings), LIF_SELECTED },
31773177
{ msg(lng::MMenuPanelSettings), 0 },
@@ -3203,7 +3203,7 @@ void Options::ShellOptions(bool LastCommand, const MOUSE_EVENT_RECORD *MouseEven
32033203
};
32043204
VMenu::DecorateItemsWithHotkeys(OptionsMenu);
32053205

3206-
menu_item RightMenu[]
3206+
menu_item_data RightMenu[]
32073207
{
32083208
{ msg(lng::MMenuBriefView), LIF_SELECTED, KEY_CTRL1 },
32093209
{ msg(lng::MMenuMediumView), 0, KEY_CTRL2 },
@@ -3262,8 +3262,8 @@ void Options::ShellOptions(bool LastCommand, const MOUSE_EVENT_RECORD *MouseEven
32623262

32633263
MainMenu[0].Selected = false;
32643264
MainMenu[HItemToShow].Selected = true;
3265-
MainMenu[HItemToShow].SubMenu[0].SetSelect(false);
3266-
MainMenu[HItemToShow].SubMenu[LastVItem].SetSelect(true);
3265+
MainMenu[HItemToShow].SubMenu[0].set_select(false);
3266+
MainMenu[HItemToShow].SubMenu[LastVItem].set_select(true);
32673267
Global->WindowManager->CallbackWindow([&HOptMenu](){HOptMenu->ProcessKey(Manager::Key(KEY_DOWN));});
32683268
}
32693269
else

far/dialog.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static size_t ConvertItemEx2(const DialogItemEx& ItemEx, FarGetDialogItem *Item,
214214
size+=ListBoxSize*sizeof(FarListItem);
215215
for (const auto i: std::views::iota(0uz, ListBoxSize))
216216
{
217-
size += (ListBox->at(i).GetName().size() + 1) * sizeof(wchar_t);
217+
size += (ListBox->at(i).get_name().size() + 1) * sizeof(wchar_t);
218218
}
219219
}
220220
}
@@ -246,7 +246,7 @@ static size_t ConvertItemEx2(const DialogItemEx& ItemEx, FarGetDialogItem *Item,
246246
auto& item = ListBox->at(ii);
247247
listItems[ii].Flags = item.Flags;
248248
listItems[ii].Text = text;
249-
text += item.GetName().copy(text, item.GetName().npos);
249+
text += item.get_name().copy(text, item.get_name().npos);
250250
*text++ = {};
251251
listItems[ii].UserData = item.SimpleUserData;
252252
listItems[ii].Reserved = 0;
@@ -3894,11 +3894,11 @@ int Dialog::SelectFromComboBox(DialogItemEx& CurItem, DlgEdit& EditLine)
38943894

38953895
if (CurItem.Flags & DIF_LISTNOAMPERSAND)
38963896
{
3897-
strStr = remove_highlight(ItemPtr.GetName());
3897+
strStr = remove_highlight(ItemPtr.get_name());
38983898
EditLine.SetString(strStr);
38993899
}
39003900
else
3901-
EditLine.SetString(ItemPtr.GetName());
3901+
EditLine.SetString(ItemPtr.get_name());
39023902

39033903
EditLine.SetLeftPos(0);
39043904
Redraw();
@@ -4903,7 +4903,7 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
49034903
auto& Item = ListItems->Item;
49044904
Item = {};
49054905
Item.Flags=ListMenuItem.Flags;
4906-
Item.Text=ListMenuItem.GetName().c_str();
4906+
Item.Text=ListMenuItem.get_name().c_str();
49074907
Item.UserData = ListMenuItem.SimpleUserData;
49084908
Item.Reserved = 0;
49094909

@@ -5050,9 +5050,9 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
50505050
const auto& ListMenuItem = ListBox->at(ListBox->GetSelectPos());
50515051
const auto Edit = static_cast<DlgEdit*>(CurItem.ObjPtr);
50525052
if (CurItem.Flags & DIF_LISTNOAMPERSAND)
5053-
Edit->SetHiString(ListMenuItem.GetName());
5053+
Edit->SetHiString(ListMenuItem.get_name());
50545054
else
5055-
Edit->SetString(ListMenuItem.GetName());
5055+
Edit->SetString(ListMenuItem.get_name());
50565056
Edit->RemoveSelection();
50575057
}
50585058
}
@@ -5529,8 +5529,8 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
55295529
if (CurItem.ListPtr->GetShowItemCount())
55305530
{
55315531
const auto& ListMenuItem = CurItem.ListPtr->current();
5532-
Ptr = ListMenuItem.GetName().data();
5533-
Len = ListMenuItem.GetName().size();
5532+
Ptr = ListMenuItem.get_name().data();
5533+
Len = ListMenuItem.get_name().size();
55345534
}
55355535
InitItemData();
55365536
break;
@@ -5579,7 +5579,7 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
55795579
Len=0;
55805580
if (CurItem.ListPtr->GetShowItemCount())
55815581
{
5582-
Len = CurItem.ListPtr->current().GetName().size();
5582+
Len = CurItem.ListPtr->current().get_name().size();
55835583
}
55845584
break;
55855585

far/diskmenu.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static void AddPluginItems(VMenu2 &ChDisk, int Pos, int DiskCount, bool SetSelec
218218
if (Pos > DiskCount && !SetSelected && DiskCount + static_cast<int>(index) + 1 == Pos)
219219
{
220220
SetSelected = true;
221-
MenuItem.SetSelect(true);
221+
MenuItem.set_select(true);
222222
}
223223

224224
ChDisk.AddItem(MenuItem);
@@ -714,7 +714,7 @@ static int ChangeDiskMenu(panel_ptr Owner, int Pos, bool FirstCall)
714714
{
715715
const auto DiskNumber = os::fs::drive::get_number(i.RootDirectory[L"\\\\?\\"sv.size()]);
716716

717-
ChDiskItem.SetSelect(static_cast<int>(DiskNumber) == Pos);
717+
ChDiskItem.set_select(static_cast<int>(DiskNumber) == Pos);
718718

719719
if (!SetSelected)
720720
SetSelected = (static_cast<int>(DiskNumber) == Pos);
@@ -724,7 +724,7 @@ static int ChangeDiskMenu(panel_ptr Owner, int Pos, bool FirstCall)
724724
{
725725
if (Pos < static_cast<int>(Items.size()))
726726
{
727-
ChDiskItem.SetSelect(MenuLine == Pos);
727+
ChDiskItem.set_select(MenuLine == Pos);
728728

729729
if (!SetSelected)
730730
SetSelected = (MenuLine == Pos);
@@ -762,7 +762,7 @@ static int ChangeDiskMenu(panel_ptr Owner, int Pos, bool FirstCall)
762762
inplace::escape_ampersands(ItemName);
763763
ItemName.insert(0, 1, L'&');
764764

765-
ChDiskItem.SetName(std::move(ItemName));
765+
ChDiskItem.set_name(std::move(ItemName));
766766
ChDiskItem.ComplexUserData = item;
767767
ChDisk->AddItem(ChDiskItem);
768768

@@ -927,7 +927,7 @@ static int ChangeDiskMenu(panel_ptr Owner, int Pos, bool FirstCall)
927927
{
928928
[&](plugin_item const& item)
929929
{
930-
if (Global->CtrlObject->Plugins->SetHotKeyDialog(item.pPlugin, item.Uuid, hotkey_type::drive_menu, trim(string_view{ ChDisk->at(SelPos).GetName() }.substr(3))))
930+
if (Global->CtrlObject->Plugins->SetHotKeyDialog(item.pPlugin, item.Uuid, hotkey_type::drive_menu, trim(string_view{ ChDisk->at(SelPos).get_name() }.substr(3))))
931931
RetCode = SelPos;
932932
},
933933
[](disk_item const& item)

far/editcontrol.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe
444444
{
445445
for (const auto i: std::views::iota(0uz, pList->size()))
446446
{
447-
const auto& Text = pList->at(i).GetName();
447+
const auto& Text = pList->at(i).get_name();
448448

449449
if (!starts_with_icase(Text, Str))
450450
continue;
@@ -486,7 +486,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe
486486
{
487487
int SelStart = GetLength();
488488

489-
const auto& FirstItem = ComplMenu->at(0).GetName();
489+
const auto& FirstItem = ComplMenu->at(0).get_name();
490490
const auto Data = ComplMenu->GetComplexUserDataPtr<cmp_user_data>(0);
491491

492492
// magic
@@ -516,7 +516,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe
516516
}
517517
};
518518

519-
if(ComplMenu->size() > 1 || (ComplMenu->size() == 1 && !equal_icase(CurrentInput, ComplMenu->at(0).GetName())))
519+
if(ComplMenu->size() > 1 || (ComplMenu->size() == 1 && !equal_icase(CurrentInput, ComplMenu->at(0).get_name())))
520520
{
521521
ComplMenu->SetMenuFlags(VMENU_WRAPMODE | VMENU_SHOWAMPERSAND);
522522
if(!DelBlock && Global->Opt->AutoComplete.AppendCompletion && (!m_Flags.Check(FEDITLINE_PERSISTENTBLOCKS) || Global->Opt->AutoComplete.ShowList))
@@ -555,7 +555,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe
555555
{
556556
PrevPos=CurPos;
557557
IsChanged = false;
558-
SetString(CurPos? ComplMenu->at(CurPos).GetName() : CurrentInput);
558+
SetString(CurPos? ComplMenu->at(CurPos).get_name() : CurrentInput);
559559
Show();
560560
}
561561

@@ -604,7 +604,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe
604604

605605
Complete(*ComplMenu, CurrentInput);
606606

607-
if (ComplMenu->size() > 1 || (ComplMenu->size() == 1 && !equal_icase(CurrentInput, ComplMenu->at(0).GetName())))
607+
if (ComplMenu->size() > 1 || (ComplMenu->size() == 1 && !equal_icase(CurrentInput, ComplMenu->at(0).get_name())))
608608
{
609609
if(none_of(MenuKey, KEY_BS, KEY_DEL, KEY_NUMDEL) && Global->Opt->AutoComplete.AppendCompletion)
610610
{
@@ -757,7 +757,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe
757757
{
758758
if(Global->Opt->AutoComplete.ModalList)
759759
{
760-
SetString(ComplMenu->at(ExitCode).GetName());
760+
SetString(ComplMenu->at(ExitCode).get_name());
761761
Show();
762762
}
763763
else

0 commit comments

Comments
 (0)