Skip to content

Commit

Permalink
Add all code files
Browse files Browse the repository at this point in the history
  • Loading branch information
Pharap authored Apr 25, 2022
1 parent 1532911 commit e18e025
Show file tree
Hide file tree
Showing 81 changed files with 16,509 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ABSpriteEditor/ABSpriteEditor.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ABSpriteEditor", "ABSpriteEditor\ABSpriteEditor.csproj", "{110C6CE2-2264-4037-9BD4-C2143246D849}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{110C6CE2-2264-4037-9BD4-C2143246D849}.Debug|x86.ActiveCfg = Debug|x86
{110C6CE2-2264-4037-9BD4-C2143246D849}.Debug|x86.Build.0 = Debug|x86
{110C6CE2-2264-4037-9BD4-C2143246D849}.Release|x86.ActiveCfg = Release|x86
{110C6CE2-2264-4037-9BD4-C2143246D849}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
375 changes: 375 additions & 0 deletions ABSpriteEditor/ABSpriteEditor/ABSpriteEditor.csproj

Large diffs are not rendered by default.

112 changes: 112 additions & 0 deletions ABSpriteEditor/ABSpriteEditor/Controls/ActionPanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

142 changes: 142 additions & 0 deletions ABSpriteEditor/ABSpriteEditor/Controls/ActionPanel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using ABSpriteEditor.Utilities;

//
// Copyright (C) 2022 Pharap (@Pharap)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

namespace ABSpriteEditor.Controls
{
public partial class ActionPanel : UserControl
{
private Bitmap image;

public event EventHandler ImageChanged;
public event EventHandler BeforeAction;
public event EventHandler AfterAction;

public ActionPanel()
{
InitializeComponent();
}

public Bitmap Image
{
get { return this.image; }
set
{
// If the assigned image is not the current image
if (this.image != value)
{
// Change the image
this.image = value;

// Raise ImageChanged event
this.OnImageChanged(EventArgs.Empty);
}
}
}

#region Methods

private void OnImageChanged(EventArgs e)
{
// Cache the handler
var handler = this.ImageChanged;

// If the handler isn't null
if (handler != null)
// Call the handler
handler(this, e);
}

private void OnAfterAction(EventArgs e)
{
// Cache the handler
var handler = this.AfterAction;

// If the handler isn't null
if (handler != null)
// Call the handler
handler(this, e);
}

private void OnBeforeAction(EventArgs e)
{
// Cache the handler
var handler = this.BeforeAction;

// If the handler isn't null
if (handler != null)
// Call the handler
handler(this, e);
}

#endregion

private void flipHorizontallyToolStripButton_Click(object sender, EventArgs e)
{
// If there is no image
if (this.Image == null)
// Exit early
return;

// Raise before action event
this.OnBeforeAction(EventArgs.Empty);

// Defer to a helper class to horizontally flip the image
BitmapHelper.FlipHorizontally(this.Image);

// Raise after action event
this.OnAfterAction(EventArgs.Empty);
}

private void flipVerticallyToolStripButton_Click(object sender, EventArgs e)
{
// If there is no image
if (this.Image == null)
// Exit early
return;

// Raise before action event
this.OnBeforeAction(EventArgs.Empty);

// Defer to a helper class to vertically flip the image
BitmapHelper.FlipVertically(this.Image);

// Raise after action event
this.OnAfterAction(EventArgs.Empty);
}

private void toolStripButton1_Click(object sender, EventArgs e)
{
// If there is no image
if (this.Image == null)
// Exit early
return;

// Raise before action event
this.OnBeforeAction(EventArgs.Empty);

// Defer to a helper class to vertically flip the image
BitmapHelper.RollLeft(this.Image, 2);

// Raise after action event
this.OnAfterAction(EventArgs.Empty);
}
}
}
Loading

0 comments on commit e18e025

Please sign in to comment.