1
0
mirror of synced 2024-12-03 19:47:29 +01:00
Switch-Toolbox/Switch_Toolbox_Library/Forms/Custom/DropdownPanel/STCollapsePanelButton.cs
KillzXGaming 04eec01042 Tons more layout editor improvements.
- The UI has been completely redone. It's far much more clean and intuitive to edit with.
- All major pane types can be created now. Part panes are not supported but will be added in a future update due to being more complex to mess with.
- Window panes can be fully customized now, with custom frame adjusting, adding, and editing materials per frame and content regions.
- Picture panes have improved UV editing, and vertex color editing (which can set by corner or all at once).
- Text boxes will have a dialog for selecting the font file. These also can be switchted in the text editor.
- Improved pane deleting signifcantly. Material references are removed, and undo/redo works perfectly fine.
- Fixed many flags for properties which didn't get set correctly if edited.
- Fixed layout saving for text boxes with using the wrong encoding. Also some padding fixes.
- Text panes now auto calculate the text length and allow restricted lengths to be edited.
- Properties can now be scrolled down, and kept at that state when refocused.
- Add a selection box for selecting multiple panes at once
- Textures can be added, removed and edited in editor. Make sure these are in the same archive!!!
 Wii U auto does it in the same archive opened, switch must have a bntx in it. Automatic creaton of these will come
 - Picture panes can be generated via textures. Drag and drop one from a list. Also keeps the original image sizes.
 - Fixed window pane rendering with 1 frame and flipping textures.
 - Materials can add textures, and have new custom blend and alpha modes.
 when i finish the new layout export dialog.
- Added an edit option for image editor to gamma fix smash ultimate bntx.
2019-10-13 21:02:39 -04:00

142 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Toolbox.Library.Forms
{
public partial class STCollapsePanelButton : UserControl
{
//Somewhat based on https://github.com/alexander-makarov/ExpandCollapsePanel
public STCollapsePanelButton()
{
InitializeComponent();
isExpanded = false;
BackColor = FormThemes.BaseTheme.DropdownButtonBackColor;
ForeColor = FormThemes.BaseTheme.FormForeColor;
SetIconColor = FormThemes.BaseTheme.DropdownButtonBackColor;
ExpandedImage = pictureBox1.Image;
CollapsedImage = new Bitmap(pictureBox1.Image);
CollapsedImage.RotateFlip(RotateFlipType.Rotate90FlipX);
}
public string PanelName
{
get
{
return stLabel1.Text;
}
set
{
stLabel1.Text = value;
}
}
public string PanelValueName
{
get
{
return alternativeLabel.Text;
}
set
{
alternativeLabel.Text = value;
}
}
public Image SetIcon
{
get
{
return pictureBox2.Image;
}
set
{
pictureBox2.Image = value;
}
}
public Color SetIconColor
{
get
{
return pictureBox3.BackColor;
}
set
{
pictureBox3.BackColor = value;
}
}
public Color SetIconAlphaColor
{
get
{
return pictureBox2.BackColor;
}
set
{
pictureBox2.BackColor = value;
}
}
private Image ExpandedImage { get; set; }
private Image CollapsedImage { get; set; }
private bool isExpanded = false;
public bool IsExpanded
{
get { return isExpanded; }
set
{
isExpanded = value;
OnExpandCollapse();
}
}
[Browsable(false)]
public override bool AutoScroll
{
get
{
return base.AutoScroll;
}
set
{
base.AutoScroll = value;
}
}
public event EventHandler<ExpandCollapseEventArgs> ExpandCollapse;
protected virtual void OnExpandCollapse()
{
pictureBox1.Image = isExpanded ? ExpandedImage : CollapsedImage;
EventHandler<ExpandCollapseEventArgs> handler = ExpandCollapse;
if (handler != null)
handler(this, new ExpandCollapseEventArgs(isExpanded));
}
private void OnMouseDown(object sender, MouseEventArgs e)
{
// just invert current state
IsExpanded = !IsExpanded;
}
}
}