Skip to content

Commit

Permalink
Started to work on ModernSongEditor Control
Browse files Browse the repository at this point in the history
git-svn-id: https://ebixio.com/svn/DreamBeam/trunk@338 9e172561-ad11-0410-9a84-d5a4b8596161
  • Loading branch information
staeff777 committed Aug 7, 2008
1 parent 2c7b6a5 commit 6e0a881
Show file tree
Hide file tree
Showing 19 changed files with 1,001 additions and 559 deletions.
47 changes: 30 additions & 17 deletions DreamBeam.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,16 @@
<Compile Include="GuiTools\SlideDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GuiTools\SlidePanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\ISongEditor.cs" />
<Compile Include="GuiTools\Songeditor\NewEditor\AdditionalInformationDialog.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\AdditionalInformationDialog.Designer.cs">
<DependentUpon>AdditionalInformationDialog.cs</DependentUpon>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\ColoredTextBoxPanel.cs">
<SubType>UserControl</SubType>
</Compile>
Expand All @@ -357,24 +366,24 @@
<Compile Include="GuiTools\Songeditor\NewEditor\Form1.designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\RicherTextBox2.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\RTFEditorPanel.cs">
<Compile Include="GuiTools\Songeditor\NewEditor\ModernSongEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\RTFEditorPanel.Designer.cs">
<DependentUpon>RTFEditorPanel.cs</DependentUpon>
<Compile Include="GuiTools\Songeditor\NewEditor\ModernSongEditor.Designer.cs">
<DependentUpon>ModernSongEditor.cs</DependentUpon>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\RTFSongEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\RTFSongEditor.Designer.cs">
<DependentUpon>RTFSongEditor.cs</DependentUpon>
<Compile Include="GuiTools\Songeditor\NewEditor\RicherTextBox2.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\ScrollablePanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\SequenceDialog.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\SequenceDialog.Designer.cs">
<DependentUpon>SequenceDialog.cs</DependentUpon>
</Compile>
<Compile Include="GuiTools\Songeditor\NewEditor\TestForm.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -473,16 +482,20 @@
<DependentUpon>ImageWindow.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\ColoredTextBoxPanel.resx">
<DependentUpon>ColoredTextBoxPanel.cs</DependentUpon>
<EmbeddedResource Include="GuiTools\SlidePanel.resx">
<DependentUpon>SlidePanel.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\AdditionalInformationDialog.resx">
<DependentUpon>AdditionalInformationDialog.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\RTFEditorPanel.resx">
<DependentUpon>RTFEditorPanel.cs</DependentUpon>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\ColoredTextBoxPanel.resx">
<DependentUpon>ColoredTextBoxPanel.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\RTFSongEditor.resx">
<DependentUpon>RTFSongEditor.cs</DependentUpon>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\ModernSongEditor.resx">
<DependentUpon>ModernSongEditor.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GuiTools\Songeditor\NewEditor\TestForm.resx">
Expand Down
216 changes: 216 additions & 0 deletions GuiTools/SlidePanel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DreamBeam
{
public class SlidePanel : UserControl
{
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Timer timer1;
protected Control _oOwner;
public enum SLIDE_DIRECTION {TOP, LEFT, BOTTOM, RIGHT};
protected SLIDE_DIRECTION _eSlideDirection;
private float _fRatio;
private float _fStep;
private bool _bExpand;
private SizeF _oOffset;
private SizeF _oStep;
private Point _oOrigin;
/// <summary>
/// Return the state of the form (expanded or not)
/// </summary>
public bool IsExpanded
{
get
{
return _bExpand;
}
}
/// <summary>
/// Direction of sliding
/// </summary>
public SLIDE_DIRECTION SlideDirection
{
set
{
_eSlideDirection = value;
}
}
/// <summary>
/// Slide step of the motion
/// </summary>
public float SlideStep
{
set
{
_fStep = value;
}
}
/// <summary>
/// Default constructor
/// </summary>
public SlidePanel() : this(null, 0)
{
}
/// <summary>
/// Constructor with parent window and step of sliding motion
/// </summary>
public SlidePanel(Control poOwner, float pfStep)
{
InitializeComponent();
_oOwner = poOwner;
_fRatio = 0.0f;
SlideStep = pfStep;
//if (poOwner != null)
// Owner = poOwner.Owner;
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 10;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// SlidePanel
//
this.BackColor = System.Drawing.SystemColors.Control;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Name = "SlidePanel";
this.Size = new System.Drawing.Size(318, 190);
this.ResumeLayout(false);

}
#endregion
/// <summary>
/// Use this method to start the slide motion (in ou out)
/// according to the slide direction
/// </summary>
public void Slide()
{
this.Init();
if (!_bExpand)
Show();
//_oOwner.BringToFront();
_bExpand = !_bExpand;
timer1.Start();
}

private void timer1_Tick(object sender, System.EventArgs e)
{

if (_bExpand)
{
_fRatio += _fStep;
_oOffset += _oStep;
if (_fRatio >= 1)
timer1.Stop();
}
else
{
_fRatio -= _fStep;
_oOffset -= _oStep;
if (_fRatio <= 0)
timer1.Stop();
}
SetLocation();
}
private void SetLocation()
{
Location = _oOrigin + _oOffset.ToSize();
}

private void SlideDialog_Move(object sender, System.EventArgs e)
{
SetSlideLocation();
SetLocation();
}

private void SlideDialog_Resize(object sender, System.EventArgs e)
{
SetSlideLocation();
SetLocation();
}
private void SlideDialog_Closed(object sender, System.EventArgs e)
{

}

private void SetSlideLocation()
{
if (_oOwner != null)
{
switch (_eSlideDirection)
{
case SLIDE_DIRECTION.BOTTOM:
_oOrigin.X = _oOwner.Location.X;
_oOrigin.Y = _oOwner.Location.Y - Height+1 ;

//_oOrigin.X = _oOwner.Location.X;
//_oOrigin.Y = _oOwner.Location.Y + _oOwner.Height - Height;
//Width = _oOwner.Width;
_oStep = new SizeF(0, Height * _fStep);
break;
case SLIDE_DIRECTION.LEFT:

_oOrigin.X = _oOwner.Location.X + Width-1;
_oOrigin.Y = _oOwner.Location.Y;
_oStep = new SizeF(- Width * _fStep, 0);
//Height = _oOwner.Height;
break;
case SLIDE_DIRECTION.TOP:
_oOrigin.X = _oOwner.Location.X;
_oOrigin.Y = _oOwner.Location.Y + Height-1;
//Width = _oOwner.Width;

_oStep = new SizeF(0, - Height * _fStep);
break;
case SLIDE_DIRECTION.RIGHT:

_oOrigin.X = _oOwner.Location.X - Width+1;
_oOrigin.Y = _oOwner.Location.Y;
_oStep = new SizeF(Width * _fStep, 0);
//Height = _oOwner.Height;
break;
}
}
}

protected void Init()
{
SetSlideLocation();
SetLocation();
if (_oOwner != null)
{
//_oOwner.LocationChanged += new System.EventHandler(this.SlideDialog_Move);
//_oOwner.Resize += new System.EventHandler(this.SlideDialog_Resize);
//_oOwner.Closed += new System.EventHandler(this.SlideDialog_Closed);

}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="richTextBox.Text" xml:space="preserve">
<value>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb


aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


ggggggggggggggggggggggggggggggggggg
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ggggggggggggggggggggggggggggggggggg</value>
</data>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
Loading

0 comments on commit 6e0a881

Please sign in to comment.