Skip to content

Commit

Permalink
Merge pull request FarGroup#767 from MKadaner/mzk/VMenu-ShowMenu-refa…
Browse files Browse the repository at this point in the history
…ctoring

Refactored `VMenu::ShowMenu` and its vicinity.
  • Loading branch information
alabuzhev authored Dec 30, 2023
2 parents e740940 + 2bbb515 commit 98c87ee
Show file tree
Hide file tree
Showing 6 changed files with 591 additions and 419 deletions.
5 changes: 5 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
--------------------------------------------------------------------------------
MZK 2023-12-29 16:07:42-08:00 - build 6240

1. Refactored `VMenu::ShowMenu` and its vicinity.

--------------------------------------------------------------------------------
drkns 2023-12-29 22:04:10+00:00 - build 6239

Expand Down
10 changes: 4 additions & 6 deletions far/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,6 @@ void Dialog::InitDialogObjects(size_t ID)
static_cast<int>(m_Where.left + Item.X2),
static_cast<int>(m_Where.top + Item.Y2)
});
ListPtr->SetBoxType(SHORT_SINGLE_BOX);

// поле FarDialogItem.Data для DI_LISTBOX используется как верхний заголовок листа
if (!(Item.Flags & DIF_LISTNOBOX) && !DialogMode.Check(DMODE_OBJECTS_CREATED))
Expand Down Expand Up @@ -812,7 +811,6 @@ void Dialog::InitDialogObjects(size_t ID)
{
if (const auto& ListPtr = Item.ListPtr)
{
ListPtr->SetBoxType(SHORT_SINGLE_BOX);
DialogEdit->SetDropDownBox((Item.Flags& DIF_DROPDOWNLIST) != 0);
ListPtr->ChangeFlags(VMENU_WRAPMODE, (Item.Flags& DIF_LISTWRAPMODE) != 0);
ListPtr->ChangeFlags(VMENU_DISABLED, (Item.Flags& DIF_DISABLE) != 0);
Expand Down Expand Up @@ -2034,8 +2032,8 @@ void Dialog::ShowDialog(size_t ID)
if (Item.ListPtr)
{
// Перед отрисовкой спросим об изменении цветовых атрибутов
FarColor RealColors[VMENU_COLOR_COUNT]{};
FarDialogItemColors ListColors{ sizeof(ListColors), 0, VMENU_COLOR_COUNT, RealColors };
vmenu_colors_t RealColors{};
FarDialogItemColors ListColors{ sizeof(ListColors), 0, RealColors.size(), RealColors.data()};
Item.ListPtr->GetColors(&ListColors);

if (DlgProc(DN_CTLCOLORDLGLIST,I,&ListColors))
Expand Down Expand Up @@ -3867,8 +3865,8 @@ int Dialog::SelectFromComboBox(DialogItemEx& CurItem, DlgEdit& EditLine)
DlgProc(DN_DROPDOWNOPENED, m_FocusPos, ToPtr(1));
SetComboBoxPos(&CurItem);
// Перед отрисовкой спросим об изменении цветовых атрибутов
FarColor RealColors[VMENU_COLOR_COUNT]{};
FarDialogItemColors ListColors{ sizeof(ListColors), 0, VMENU_COLOR_COUNT, RealColors };
vmenu_colors_t RealColors{};
FarDialogItemColors ListColors{ sizeof(ListColors), 0, RealColors.size(), RealColors.data()};
ComboBox->SetColors(nullptr);
ComboBox->GetColors(&ListColors);

Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6239
6240
Loading

0 comments on commit 98c87ee

Please sign in to comment.