// _110313_054719 Now works for passive, too. void ShelveInfoNative::Pop(bool active) { HANDLE handle = active ? PANEL_ACTIVE : PANEL_PASSIVE; if (Path) ::SetPanelDirectory(handle, Path); array<String^>^ selectedNames = GetSelectedNames(); if (!Current && !selectedNames && !_modes) return; PanelInfo pi; GetPanelInfo(handle, pi); if (0 != (pi.Flags & PFLAGS_PLUGIN) || pi.PanelType != PTYPE_FILEPANEL) //! do not throw, sometimes a panel just cannot close return; Panel1 native(active); if (Current) native.GoToName(Current); native.SelectNames(selectedNames); // restore modes if (_modes) { if (_viewMode != (PanelViewMode)pi.ViewMode) native.ViewMode = _viewMode; bool reversed = (pi.Flags & PFLAGS_REVERSESORTORDER) != 0; PanelSortMode sortMode = (PanelSortMode)(reversed ? -pi.SortMode : pi.SortMode); if (_sortMode != sortMode) native.SortMode = _sortMode; } }
bool Panel1::IsPlugin::get() { PanelInfo pi; GetPanelInfo(_handle, pi); return 0 != (pi.Flags & PFLAGS_PLUGIN); }
int Panel1::CurrentIndex::get() { PanelInfo pi; GetPanelInfo(_handle, pi); return pi.ItemsNumber ? (int)pi.CurrentItem : -1; }
PanelViewMode Panel1::ViewMode::get() { PanelInfo pi; GetPanelInfo(_handle, pi); return (PanelViewMode)pi.ViewMode; }
Point Panel1::Frame::get() { PanelInfo pi; GetPanelInfo(_handle, pi); return pi.ItemsNumber ? Point((int)pi.CurrentItem, (int)pi.TopPanelItem) : Point(-1, -1); }
int Panel1::TopIndex::get() { PanelInfo pi; GetPanelInfo(_handle, pi); return pi.ItemsNumber ? (int)pi.TopPanelItem : -1; }
Place Panel1::Window::get() { PanelInfo pi; GetPanelInfo(_handle, pi); Place r; r.Left = pi.PanelRect.left; r.Top = pi.PanelRect.top; r.Right = pi.PanelRect.right; r.Bottom = pi.PanelRect.bottom; return r; }
// STOP: It is possible to ask the current file directly, but implementation is not safe. FarFile^ Panel1::CurrentFile::get() { PanelInfo pi; GetPanelInfo(_handle, pi); if (pi.ItemsNumber == 0) return nullptr; AutoPluginPanelItem item(_handle, (int)pi.CurrentItem, ShownFile); return ItemToFile(item.Get()); }
void Panel1::IsVisible::set(bool value) { PanelInfo pi; GetPanelInfo(_handle, pi); bool old = 0 != (pi.Flags & PFLAGS_VISIBLE); if (old == value) return; String^ macro = pi.PanelRect.left == 0 ? "Keys('CtrlF1')" : "Keys('CtrlF2')"; Far::Api->PostMacro(macro); }
bool Panel1::IsVisible::get() { PanelInfo pi; GetPanelInfo(_handle, pi); return 0 != (pi.Flags & PFLAGS_VISIBLE); }