Open AstralPhnx opened 4 years ago
I've been trying to figure out how exactly the chat system is written but I can't really find the link between a chat's position and the chats around it. If anyone knows if it is stored in some variable, please let me know where I can find it :)
I think you can start by looking at the ChannelTabControl, the channel tabs are stored in order of appereance in its TabContainer.TabItems
(AllTabItems
if you want to include ones in the dropdown).
In ChatOverlay.cs, I found ChatOverlay.ChannelTabControl and in there d.IsSwitchable = true with a summary saying you can use PlatfromAction.DocumentNext and PlatfromAction.DocumentPrevious, but I can't seem to use it to swap two channels around at all. PlatformAction.DocumentNext itself isn't defined, but I found in a keybinds section: new PlatformAction(PlatformActionType.DocumentNext). Same goes for DocumentPrevious
I do believe IsSwitchable
used to move back and forth between tabs using platform action (Ctrl
+ Tab
and Ctrl
+ Shift
+ Tab
for example on Windows), not used for reordering or swap positioning
That's a different thing entirely. It enables switching tabs back and forth using keyboard shortcuts (usually a variant of Ctrl+Tab to go forward, that same shortcut with Shift to go back).
I don't recall seeing a rearrangeable tab control anywhere. Closest thing is RearrangeableListContainer
framework-side, and I would say it's a type of control we would also like to expose in framework itself.
If this happens then it's most likely going to require a manual implementation from the ground up to work and present well. I wouldn't recommend starting to contribute to the project with such an undertaking.
Yeah I gave up on that after I found something I think is actually it, but I don't know how or where to implement it.
TabControl.cs (don't know the exact path, I got it from metadata)
//
// Summary:
// Switches the currently selected tab forward or backward one index, optionally
// wrapping.
//
// Parameters:
// direction:
// Pass 1 to move to the next tab, or -1 to move to the previous tab.
//
// wrap:
// If true, moving past the start or the end of the tab list will wrap to the opposite
// end.
public virtual void SwitchTab(int direction, bool wrap = true);
I'm going to try implementing a function in ChanneltabControl.cs to change tab with a simple rmb to check if the function works and if it's worth implementing the dragging feature with this function
You're misunderstanding that part - SwitchTab
changes the active channel tab to the next or previous one depending on the direction provided. It does not affect the layout in any way.
Yeah I noticed it
Describe the new feature: As suggested in the title, tabs in the chat overlay should be able to be dragged from side to side and be organized how the user sees fit.
Proposal designs of the feature: Essentially identical to how it is implemented in stable. A held left mouse click allows the user to drag any tab to the left or right with the tabs automatically snapping into place and pushing the tab that used to be in the location it is moving to out of the way and up the tab list.