added the On* prefix to all event methods

This commit is contained in:
codeimp 2008-05-15 08:10:29 +00:00
parent d7656f1f3b
commit 7e6d49450c
21 changed files with 310 additions and 291 deletions

View file

@ -274,7 +274,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Cancelled
public override void Cancel()
public override void OnCancel()
{
// Move geometry back to original position
MoveGeometryRelative(new Vector2D(0f, 0f), false, false);
@ -286,22 +286,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.Update();
// Cancel base class
base.Cancel();
base.OnCancel();
// Return to vertices mode
General.Map.ChangeMode(basemode);
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Disenagaging
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// When not cancelled
if(!cancelled)
@ -372,32 +372,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// When edit button is released
protected override void EndEdit()
protected override void OnEndEdit()
{
// Just return to base mode, Disengage will be called automatically.
General.Map.ChangeMode(basemode);
base.EndEdit();
base.OnEndEdit();
}
// Mouse moving
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
Update();
}
// When a key is released
public override void KeyUp(KeyEventArgs e)
public override void OnKeyUp(KeyEventArgs e)
{
base.KeyUp(e);
base.OnKeyUp(e);
if((snaptogrid != (General.Interface.ShiftState ^ General.Interface.SnapToGrid)) ||
(snaptonearest != (General.Interface.CtrlState ^ General.Interface.AutoMerge))) Update();
}
// When a key is pressed
public override void KeyDown(KeyEventArgs e)
public override void OnKeyDown(KeyEventArgs e)
{
base.KeyDown(e);
base.OnKeyDown(e);
if((snaptogrid != (General.Interface.ShiftState ^ General.Interface.SnapToGrid)) ||
(snaptonearest != (General.Interface.CtrlState ^ General.Interface.AutoMerge))) Update();
}

View file

@ -101,13 +101,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Disenagaging
public override void Disengage()
public override void OnDisengage()
{
// Select vertices from lines selection
General.Map.Map.ClearSelectedVertices();
@ -115,7 +115,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Vertex v in verts) v.Selected = true;
// Perform normal disengage
base.Disengage();
base.OnDisengage();
// Clear vertex selection
General.Map.Map.ClearSelectedVertices();
@ -129,7 +129,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();

View file

@ -101,13 +101,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Disenagaging
public override void Disengage()
public override void OnDisengage()
{
// Select vertices from lines selection
General.Map.Map.ClearSelectedVertices();
@ -115,7 +115,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Vertex v in verts) v.Selected = true;
// Perform normal disengage
base.Disengage();
base.OnDisengage();
// Clear vertex selection
General.Map.Map.ClearSelectedVertices();
@ -133,7 +133,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();

View file

@ -213,7 +213,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();
@ -249,7 +249,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Cancelled
public override void Cancel()
public override void OnCancel()
{
// Move geometry back to original position
MoveThingsRelative(new Vector2D(0f, 0f), false, false);
@ -261,22 +261,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.Update();
// Cancel base class
base.Cancel();
base.OnCancel();
// Return to vertices mode
General.Map.ChangeMode(basemode);
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Disenagaging
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
Cursor.Current = Cursors.AppStarting;
// When not cancelled
@ -343,33 +343,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// When edit button is released
protected override void EndEdit()
protected override void OnEndEdit()
{
// Just return to vertices mode, geometry will be merged on disengage.
General.Map.ChangeMode(basemode);
base.EndEdit();
base.OnEndEdit();
}
// Mouse moving
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
Update();
}
// When a key is released
public override void KeyUp(KeyEventArgs e)
public override void OnKeyUp(KeyEventArgs e)
{
base.KeyUp(e);
base.OnKeyUp(e);
if(snaptogrid != General.Interface.ShiftState ^ General.Interface.SnapToGrid) Update();
if(snaptonearest != General.Interface.CtrlState) Update();
}
// When a key is pressed
public override void KeyDown(KeyEventArgs e)
public override void OnKeyDown(KeyEventArgs e)
{
base.KeyDown(e);
base.OnKeyDown(e);
if(snaptogrid != General.Interface.ShiftState ^ General.Interface.SnapToGrid) Update();
if(snaptonearest != General.Interface.CtrlState) Update();
}

View file

@ -92,15 +92,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Disenagaging
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// When not cancelled
if(!cancelled)
@ -111,7 +111,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();

View file

@ -124,10 +124,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Cancelled
public override void Cancel()
public override void OnCancel()
{
// Cancel base class
base.Cancel();
base.OnCancel();
// Return to original mode
Type t = basemode.GetType();
@ -136,7 +136,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Disenagaging
public override void Disengage()
public override void OnDisengage()
{
List<Vertex> newverts = new List<Vertex>();
List<Vertex> intersectverts = new List<Vertex>();
@ -148,7 +148,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
MapSet map = General.Map.Map;
base.Disengage();
base.OnDisengage();
Cursor.Current = Cursors.AppStarting;
@ -548,7 +548,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
// Render lines
if(renderer.StartPlotter(true))
@ -731,9 +731,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Mouse moving
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
Update();
}
@ -789,17 +789,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// When a key is released
public override void KeyUp(KeyEventArgs e)
public override void OnKeyUp(KeyEventArgs e)
{
base.KeyUp(e);
base.OnKeyUp(e);
if((snaptogrid != (General.Interface.ShiftState ^ General.Interface.SnapToGrid)) ||
(snaptonearest != (General.Interface.CtrlState ^ General.Interface.AutoMerge))) Update();
}
// When a key is pressed
public override void KeyDown(KeyEventArgs e)
public override void OnKeyDown(KeyEventArgs e)
{
base.KeyDown(e);
base.OnKeyDown(e);
if((snaptogrid != (General.Interface.ShiftState ^ General.Interface.SnapToGrid)) ||
(snaptonearest != (General.Interface.CtrlState ^ General.Interface.AutoMerge))) Update();
}

View file

@ -84,24 +84,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Cancel mode
public override void Cancel()
public override void OnCancel()
{
base.Cancel();
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new LinedefsMode());
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Mode disengages
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
// Render lines
if(renderer.StartPlotter(true))
@ -196,7 +196,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Selection
protected override void Select()
protected override void OnSelect()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -221,11 +221,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
StartMultiSelection();
}
base.Select();
base.OnSelect();
}
// End selection
protected override void EndSelect()
protected override void OnEndSelect()
{
// Not stopping from multiselection?
if(!selecting)
@ -245,12 +245,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
base.EndSelect();
base.OnEndSelect();
}
// Start editing
protected override void Edit()
protected override void OnEdit()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -275,12 +275,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Present();
}
}
base.Edit();
base.OnEdit();
}
// Done editing
protected override void EndEdit()
protected override void OnEndEdit()
{
// Anything selected?
ICollection<Linedef> selected = General.Map.Map.GetLinedefsSelection(true);
@ -295,14 +295,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update entire display
General.Interface.RedrawDisplay();
}
base.EndEdit();
base.OnEndEdit();
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
// Not holding any buttons?
if(e.Button == MouseButtons.None)
@ -316,18 +316,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Mouse leaves
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
base.MouseLeave(e);
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
// Mouse wants to drag
protected override void DragStart(MouseEventArgs e)
protected override void OnDragStart(MouseEventArgs e)
{
base.DragStart(e);
base.OnDragStart(e);
// Edit button used?
if(General.Interface.CheckActionActive(null, "classicedit"))
@ -350,7 +350,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called wheh selection ends
protected override void EndMultiSelection()
protected override void OnEndMultiSelection()
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
@ -365,7 +365,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
(l.End.Position.y <= selectionrect.Bottom));
}
base.EndMultiSelection();
base.OnEndMultiSelection();
// Clear overlay
if(renderer.StartOverlay(true)) renderer.Finish();
@ -375,9 +375,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called when the selection is updated
protected override void UpdateMultiSelection()
protected override void OnUpdateMultiSelection()
{
base.UpdateMultiSelection();
base.OnUpdateMultiSelection();
// Render selection
if(renderer.StartOverlay(true))

View file

@ -99,24 +99,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Cancel mode
public override void Cancel()
public override void OnCancel()
{
base.Cancel();
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new SectorsMode());
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Mode disengages
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
@ -139,7 +139,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
// Render lines and vertices
if(renderer.StartPlotter(true))
@ -217,7 +217,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Selection
protected override void Select()
protected override void OnSelect()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -240,11 +240,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
StartMultiSelection();
}
base.Select();
base.OnSelect();
}
// End selection
protected override void EndSelect()
protected override void OnEndSelect()
{
// Not stopping from multiselection?
if(!selecting)
@ -263,11 +263,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
base.EndSelect();
base.OnEndSelect();
}
// Start editing
protected override void Edit()
protected override void OnEdit()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -292,11 +292,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
base.Edit();
base.OnEdit();
}
// Done editing
protected override void EndEdit()
protected override void OnEndEdit()
{
// Anything selected?
ICollection<Sector> selected = General.Map.Map.GetSectorsSelection(true);
@ -316,13 +316,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay();
}
base.EndEdit();
base.OnEndEdit();
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
// Not holding any buttons?
if(e.Button == MouseButtons.None)
@ -371,18 +371,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Mouse leaves
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
base.MouseLeave(e);
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
// Mouse wants to drag
protected override void DragStart(MouseEventArgs e)
protected override void OnDragStart(MouseEventArgs e)
{
base.DragStart(e);
base.OnDragStart(e);
// Edit button used?
if(General.Interface.CheckActionActive(null, "classicedit"))
@ -405,7 +405,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called wheh selection ends
protected override void EndMultiSelection()
protected override void OnEndMultiSelection()
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
@ -442,15 +442,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sector s in General.Map.Map.Sectors)
SelectSector(s, s.Selected);
base.EndMultiSelection();
base.OnEndMultiSelection();
if(renderer.StartOverlay(true)) renderer.Finish();
General.Interface.RedrawDisplay();
}
// This is called when the selection is updated
protected override void UpdateMultiSelection()
protected override void OnUpdateMultiSelection()
{
base.UpdateMultiSelection();
base.OnUpdateMultiSelection();
// Render selection
if(renderer.StartOverlay(true))

View file

@ -84,31 +84,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Cancel mode
public override void Cancel()
public override void OnCancel()
{
base.Cancel();
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new ThingsMode());
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Mode disengages
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Hide highlight info
General.Interface.HideInfo();
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
// Render lines and vertices
if(renderer.StartPlotter(true))
@ -172,7 +172,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Selection
protected override void Select()
protected override void OnSelect()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -195,11 +195,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
StartMultiSelection();
}
base.Select();
base.OnSelect();
}
// End selection
protected override void EndSelect()
protected override void OnEndSelect()
{
// Not ending from a multi-selection?
if(!selecting)
@ -218,11 +218,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
base.EndSelect();
base.OnEndSelect();
}
// Start editing
protected override void Edit()
protected override void OnEdit()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -246,11 +246,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
base.Edit();
base.OnEdit();
}
// Done editing
protected override void EndEdit()
protected override void OnEndEdit()
{
// Anything selected?
ICollection<Thing> selected = General.Map.Map.GetThingsSelection(true);
@ -266,13 +266,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay();
}
base.EndEdit();
base.OnEndEdit();
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
// Not holding any buttons?
if(e.Button == MouseButtons.None)
@ -286,18 +286,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Mouse leaves
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
base.MouseLeave(e);
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
// Mouse wants to drag
protected override void DragStart(MouseEventArgs e)
protected override void OnDragStart(MouseEventArgs e)
{
base.DragStart(e);
base.OnDragStart(e);
// Edit button used?
if(General.Interface.CheckActionActive(null, "classicedit"))
@ -320,7 +320,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called wheh selection ends
protected override void EndMultiSelection()
protected override void OnEndMultiSelection()
{
// Go for all things
foreach(Thing t in General.Map.Map.Things)
@ -331,7 +331,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
(t.Position.y <= selectionrect.Bottom));
}
base.EndMultiSelection();
base.OnEndMultiSelection();
// Clear overlay
if(renderer.StartOverlay(true)) renderer.Finish();
@ -341,9 +341,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called when the selection is updated
protected override void UpdateMultiSelection()
protected override void OnUpdateMultiSelection()
{
base.UpdateMultiSelection();
base.OnUpdateMultiSelection();
// Render selection
if(renderer.StartOverlay(true))

View file

@ -84,24 +84,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// Cancel mode
public override void Cancel()
public override void OnCancel()
{
base.Cancel();
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new VerticesMode());
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Mode disengages
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is LinedefsMode)
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This redraws the display
public override void RedrawDisplay()
public override void OnRedrawDisplay()
{
// Render lines and vertices
if(renderer.StartPlotter(true))
@ -188,7 +188,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Selection
protected override void Select()
protected override void OnSelect()
{
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -209,12 +209,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Start making a selection
StartMultiSelection();
}
base.Select();
base.OnSelect();
}
// End selection
protected override void EndSelect()
protected override void OnEndSelect()
{
// Not stopping from multiselection?
if(!selecting)
@ -231,26 +231,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
base.EndSelect();
base.OnEndSelect();
}
// Start editing
protected override void Edit()
protected override void OnEdit()
{
base.Edit();
base.OnEdit();
}
// Done editing
protected override void EndEdit()
protected override void OnEndEdit()
{
base.EndEdit();
base.OnEndEdit();
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
// Not holding any buttons?
if(e.Button == MouseButtons.None)
@ -264,18 +264,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Mouse leaves
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
base.MouseLeave(e);
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
// Mouse wants to drag
protected override void DragStart(MouseEventArgs e)
protected override void OnDragStart(MouseEventArgs e)
{
base.DragStart(e);
base.OnDragStart(e);
// Edit button used?
if(General.Interface.CheckActionActive(null, "classicedit"))
@ -298,7 +298,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called wheh selection ends
protected override void EndMultiSelection()
protected override void OnEndMultiSelection()
{
// Go for all vertices
foreach(Vertex v in General.Map.Map.Vertices)
@ -309,7 +309,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
(v.Position.y <= selectionrect.Bottom));
}
base.EndMultiSelection();
base.OnEndMultiSelection();
// Clear overlay
if(renderer.StartOverlay(true)) renderer.Finish();
@ -319,9 +319,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// This is called when the selection is updated
protected override void UpdateMultiSelection()
protected override void OnUpdateMultiSelection()
{
base.UpdateMultiSelection();
base.OnUpdateMultiSelection();
// Render selection
if(renderer.StartOverlay(true))

View file

@ -86,24 +86,24 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
#region ================== Methods
// Cancel mode
public override void Cancel()
public override void OnCancel()
{
base.Cancel();
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new SectorsMode());
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Mode disengages
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
@ -126,7 +126,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
}
// This redraws the display
public unsafe override void RedrawDisplay()
public unsafe override void OnRedrawDisplay()
{
// Render lines and vertices
if(renderer.StartPlotter(true))
@ -178,9 +178,9 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
// Find the nearest linedef within highlight range
Linedef l = General.Map.Map.NearestLinedef(mousemappos);
@ -218,18 +218,18 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
}
// Mouse leaves
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
base.MouseLeave(e);
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
// Mouse button pressed
public override void MouseDown(MouseEventArgs e)
public override void OnMouseDown(MouseEventArgs e)
{
base.MouseDown(e);
base.OnMouseDown(e);
bool front, back;
// Edit button is used?
@ -262,12 +262,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
}
// Mouse released
public override void MouseUp(MouseEventArgs e)
public override void OnMouseUp(MouseEventArgs e)
{
ICollection<Sector> selected;
TriangleList triangles;
base.MouseUp(e);
base.OnMouseUp(e);
// Item highlighted?
if((highlighted != null) && !highlighted.IsDisposed)
@ -358,7 +358,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
{
for(int a = 0; a < 6; a++)
{
RedrawDisplay();
OnRedrawDisplay();
Thread.Sleep(20);
// Start with a clear display
@ -386,7 +386,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
{
for(int a = 0; a < 6; a++)
{
RedrawDisplay();
OnRedrawDisplay();
Thread.Sleep(20);
Application.DoEvents();
@ -418,7 +418,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
for(int a = 0; a < 5; a++)
{
RedrawDisplay();
OnRedrawDisplay();
Thread.Sleep(10);
// Start with a clear display

View file

@ -101,24 +101,24 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
#region ================== Methods
// Cancel mode
public override void Cancel()
public override void OnCancel()
{
base.Cancel();
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new WAuthorMode());
}
// Mode engages
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
}
// Mode disengages
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Clear selected vertices
General.Map.Map.ClearAllSelected();
@ -128,7 +128,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
}
// This redraws the display
public unsafe override void RedrawDisplay()
public unsafe override void OnRedrawDisplay()
{
// Render lines and vertices
if(renderer.StartPlotter(true))
@ -281,9 +281,9 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
base.MouseMove(e);
base.OnMouseMove(e);
// Not holding any buttons?
if(e.Button == MouseButtons.None)
@ -356,33 +356,33 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
// Maybe i'll finish this later, or not even include this mode at all, not sure yet.
// Mouse leaves
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
base.MouseLeave(e);
base.OnMouseLeave(e);
// Highlight nothing
Highlight(null);
}
// Mouse button pressed
public override void MouseDown(MouseEventArgs e)
public override void OnMouseDown(MouseEventArgs e)
{
base.MouseDown(e);
base.OnMouseDown(e);
}
// Mouse released
public override void MouseUp(MouseEventArgs e)
public override void OnMouseUp(MouseEventArgs e)
{
base.MouseUp(e);
base.OnMouseUp(e);
// This shows a popup menu
tools.LinedefPopup.Show(Cursor.Position);
}
// Mouse wants to drag
protected override void DragStart(MouseEventArgs e)
protected override void OnDragStart(MouseEventArgs e)
{
base.DragStart(e);
base.OnDragStart(e);
}
#endregion

View file

@ -161,7 +161,7 @@ namespace CodeImp.DoomBuilder.Editing
{
// Scroll now
renderer2d.PositionView(renderer2d.OffsetX + deltax, renderer2d.OffsetY + deltay);
this.ViewChanged();
this.OnViewChanged();
// Redraw
General.MainWindow.RedrawDisplay();
@ -206,14 +206,14 @@ namespace CodeImp.DoomBuilder.Editing
// Zoom now
renderer2d.PositionView(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y);
renderer2d.ScaleView(newscale);
this.ViewChanged();
this.OnViewChanged();
// Redraw
//General.Map.Map.Update();
General.MainWindow.RedrawDisplay();
// Give a new mousemove event to update coordinates
if(mouseinside) MouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
if(mouseinside) OnMouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
}
// This zooms to a specific level
@ -221,14 +221,14 @@ namespace CodeImp.DoomBuilder.Editing
{
// Zoom now
renderer2d.ScaleView(newscale);
this.ViewChanged();
this.OnViewChanged();
// Redraw
//General.Map.Map.Update();
General.MainWindow.RedrawDisplay();
// Give a new mousemove event to update coordinates
if(mouseinside) MouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
if(mouseinside) OnMouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
}
// This zooms and scrolls to fit the map in the window
@ -268,18 +268,20 @@ namespace CodeImp.DoomBuilder.Editing
// Change the view to see the whole map
renderer2d.ScaleView(scale);
renderer2d.PositionView(left + (right - left) * 0.5f, top + (bottom - top) * 0.5f);
this.ViewChanged();
this.OnViewChanged();
// Redraw
//General.Map.Map.Update();
General.MainWindow.RedrawDisplay();
// Give a new mousemove event to update coordinates
if(mouseinside) MouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
if(mouseinside) OnMouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
}
// This is called when the view changes (scroll/zoom)
protected virtual void ViewChanged()
/// <summary>
/// This is called when the view changes (scroll/zoom), before the display is redrawn.
/// </summary>
protected virtual void OnViewChanged()
{
}
@ -288,7 +290,7 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Input
// Mouse leaves the display
public override void MouseLeave(EventArgs e)
public override void OnMouseLeave(EventArgs e)
{
// Mouse is outside the display
mouseinside = false;
@ -300,11 +302,11 @@ namespace CodeImp.DoomBuilder.Editing
General.MainWindow.UpdateCoordinates(mousemappos);
// Let the base class know
base.MouseLeave(e);
base.OnMouseLeave(e);
}
// Mouse moved inside the display
public override void MouseMove(MouseEventArgs e)
public override void OnMouseMove(MouseEventArgs e)
{
Vector2D delta;
@ -330,55 +332,55 @@ namespace CodeImp.DoomBuilder.Editing
{
// Dragging starts now
mousedragging = e.Button;
DragStart(e);
OnDragStart(e);
}
}
}
// Selecting?
if(selecting) UpdateMultiSelection();
if(selecting) OnUpdateMultiSelection();
// Let the base class know
base.MouseMove(e);
base.OnMouseMove(e);
}
// Mouse button pressed
public override void MouseDown(MouseEventArgs e)
public override void OnMouseDown(MouseEventArgs e)
{
// Save mouse down position
mousedownpos = mousepos;
mousedownmappos = mousemappos;
// Let the base class know
base.MouseDown(e);
base.OnMouseDown(e);
}
// Mouse button released
public override void MouseUp(MouseEventArgs e)
public override void OnMouseUp(MouseEventArgs e)
{
// Releasing drag button?
if(e.Button == mousedragging)
{
// No longer dragging
DragStop(e);
OnDragStop(e);
mousedragging = MouseButtons.None;
}
// Let the base class know
base.MouseUp(e);
base.OnMouseUp(e);
}
/// <summary>
/// Automatically called when dragging operation starts.
/// </summary>
protected virtual void DragStart(MouseEventArgs e)
protected virtual void OnDragStart(MouseEventArgs e)
{
}
/// <summary>
/// Automatically called when dragging operation stops.
/// </summary>
protected virtual void DragStop(MouseEventArgs e)
protected virtual void OnDragStop(MouseEventArgs e)
{
}
@ -387,7 +389,7 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Display
// This just refreshes the display
public override void RefreshDisplay()
public override void OnRefreshDisplay()
{
renderer2d.Present();
}
@ -399,21 +401,21 @@ namespace CodeImp.DoomBuilder.Editing
/// <summary>
/// Automatically called by the core when this editing mode is engaged.
/// </summary>
public override void Engage()
public override void OnEngage()
{
// Clear display overlay
renderer.StartOverlay(true);
renderer.Finish();
base.Engage();
base.OnEngage();
}
/// <summary>
/// Called when the user requests to cancel this editing mode.
/// </summary>
public override void Cancel()
public override void OnCancel()
{
cancelled = true;
base.Cancel();
base.OnCancel();
}
/// <summary>
@ -421,7 +423,7 @@ namespace CodeImp.DoomBuilder.Editing
/// (in Doom Builder 1, this was always the right mousebutton)
/// </summary>
[BeginAction("classicedit", BaseAction = true)]
protected virtual void Edit()
protected virtual void OnEdit()
{
}
@ -430,7 +432,7 @@ namespace CodeImp.DoomBuilder.Editing
/// (in Doom Builder 1, this was always the right mousebutton)
/// </summary>
[EndAction("classicedit", BaseAction = true)]
protected virtual void EndEdit()
protected virtual void OnEndEdit()
{
}
@ -439,7 +441,7 @@ namespace CodeImp.DoomBuilder.Editing
/// (in Doom Builder 1, this was always the left mousebutton)
/// </summary>
[BeginAction("classicselect", BaseAction = true)]
protected virtual void Select()
protected virtual void OnSelect()
{
}
@ -448,15 +450,15 @@ namespace CodeImp.DoomBuilder.Editing
/// (in Doom Builder 1, this was always the left mousebutton)
/// </summary>
[EndAction("classicselect", BaseAction = true)]
protected virtual void EndSelect()
protected virtual void OnEndSelect()
{
if(selecting) EndMultiSelection();
if(selecting) OnEndMultiSelection();
}
/// <summary>
/// This is called automatically when a rectangular multi-selection ends.
/// </summary>
protected virtual void EndMultiSelection()
protected virtual void OnEndMultiSelection()
{
selecting = false;
}
@ -474,7 +476,7 @@ namespace CodeImp.DoomBuilder.Editing
/// <summary>
/// This is called automatically when a multi-selection is updated.
/// </summary>
protected virtual void UpdateMultiSelection()
protected virtual void OnUpdateMultiSelection()
{
selectionrect.X = selectstart.x;
selectionrect.Y = selectstart.y;

View file

@ -147,14 +147,14 @@ namespace CodeImp.DoomBuilder.Editing
//
// Mode engages
public virtual void Engage()
public virtual void OnEngage()
{
// Bind any methods
General.Actions.BindMethods(this);
}
// Mode disengages
public virtual void Disengage()
public virtual void OnDisengage()
{
// Unbind any methods
General.Actions.UnbindMethods(this);
@ -162,27 +162,26 @@ namespace CodeImp.DoomBuilder.Editing
// This forces the mode to cancel and return to the "parent" mode
[BeginAction("cancelmode", BaseAction = true)]
public virtual void Cancel() { }
public virtual void OnCancel() { }
// Optional interface methods
public virtual void MouseClick(MouseEventArgs e) { }
public virtual void MouseDoubleClick(MouseEventArgs e) { }
public virtual void MouseDown(MouseEventArgs e) { }
public virtual void MouseEnter(EventArgs e) { }
public virtual void MouseLeave(EventArgs e) { }
public virtual void MouseMove(MouseEventArgs e) { }
public virtual void MouseUp(MouseEventArgs e) { }
public virtual void KeyDown(KeyEventArgs e) { }
public virtual void KeyUp(KeyEventArgs e) { }
public virtual void MouseInput(Vector2D delta) { }
// Interface events
public virtual void OnMouseClick(MouseEventArgs e) { }
public virtual void OnMouseDoubleClick(MouseEventArgs e) { }
public virtual void OnMouseDown(MouseEventArgs e) { }
public virtual void OnMouseEnter(EventArgs e) { }
public virtual void OnMouseLeave(EventArgs e) { }
public virtual void OnMouseMove(MouseEventArgs e) { }
public virtual void OnMouseUp(MouseEventArgs e) { }
public virtual void OnKeyDown(KeyEventArgs e) { }
public virtual void OnKeyUp(KeyEventArgs e) { }
public virtual void OnMouseInput(Vector2D delta) { }
// Rendering events
public virtual void OnRedrawDisplay() { }
public virtual void OnRefreshDisplay() { }
/// <summary>
/// NOTE: Do not call directly! Only for overriding. Call General.Interface.RedrawDisplay() instead.
/// </summary>
public virtual void RedrawDisplay() { }
public virtual void RefreshDisplay() { }
public virtual void Process() { }
// Processing events
public virtual void OnProcess() { }
#endregion
}

View file

@ -112,9 +112,9 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Start / Stop
// Mode is engaged
public override void Engage()
public override void OnEngage()
{
base.Engage();
base.OnEngage();
// Find a 3D Mode thing
foreach(Thing t in General.Map.Map.Things)
@ -136,9 +136,9 @@ namespace CodeImp.DoomBuilder.Editing
}
// Mode is disengaged
public override void Disengage()
public override void OnDisengage()
{
base.Disengage();
base.OnDisengage();
// Do we have a 3D Mode thing?
if(modething != null)
@ -158,9 +158,9 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Input
// Mouse input
public override void MouseInput(Vector2D delta)
public override void OnMouseInput(Vector2D delta)
{
base.MouseInput(delta);
base.OnMouseInput(delta);
// Change camera angles with the mouse changes
camanglexy -= delta.x * ANGLE_FROM_MOUSE;
@ -178,11 +178,11 @@ namespace CodeImp.DoomBuilder.Editing
}
// Key down
public override void KeyDown(KeyEventArgs e)
public override void OnKeyDown(KeyEventArgs e)
{
string[] actions;
base.KeyDown(e);
base.OnKeyDown(e);
/* WRONG
// Get the actions for this key
@ -202,11 +202,11 @@ namespace CodeImp.DoomBuilder.Editing
}
// Key up
public override void KeyUp(KeyEventArgs e)
public override void OnKeyUp(KeyEventArgs e)
{
string[] actions;
base.KeyUp(e);
base.OnKeyUp(e);
/* WRONG
// Get the actions for this key
@ -230,12 +230,12 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Processing
// Processing
public override void Process()
public override void OnProcess()
{
Vector3D camvec;
Vector3D camvecstrafe;
base.Process();
base.OnProcess();
// Calculate camera direction vectors
camvec = Vector3D.FromAngleXYZ(camanglexy, camanglez);

View file

@ -581,7 +581,7 @@ namespace CodeImp.DoomBuilder
internal static void CancelVolatileMode()
{
if((map != null) && (map.Mode != null) && map.Mode.Attributes.Volatile)
map.Mode.Cancel();
map.Mode.OnCancel();
}
// This creates a new map

View file

@ -856,7 +856,7 @@ namespace CodeImp.DoomBuilder
}
// Disenagage old mode
if(oldmode != null) oldmode.Disengage();
if(oldmode != null) oldmode.OnDisengage();
// Change cancelled?
if(cancelmodechange)
@ -875,7 +875,7 @@ namespace CodeImp.DoomBuilder
General.MainWindow.CheckEditModeButton("");
// Engage new mode
if(newmode != null) newmode.Engage();
if(newmode != null) newmode.OnEngage();
// Dispose old mode
if(oldmode != null) oldmode.Dispose();

View file

@ -627,7 +627,7 @@ namespace CodeImp.DoomBuilder.Interface
{
if((General.Map != null) && (General.Map.Mode != null))
{
General.Map.Mode.RedrawDisplay();
General.Map.Mode.OnRedrawDisplay();
}
else
{
@ -642,7 +642,7 @@ namespace CodeImp.DoomBuilder.Interface
{
if(General.Map.Mode != null)
{
if(!displayresized) General.Map.Mode.RefreshDisplay();
if(!displayresized) General.Map.Mode.OnRefreshDisplay();
}
else
{
@ -690,10 +690,10 @@ namespace CodeImp.DoomBuilder.Interface
}
// Mouse click
private void display_MouseClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.MouseClick(e); }
private void display_MouseClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseClick(e); }
// Mouse doubleclick
private void display_MouseDoubleClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.MouseDoubleClick(e); }
private void display_MouseDoubleClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseDoubleClick(e); }
// Mouse down
private void display_MouseDown(object sender, MouseEventArgs e)
@ -714,27 +714,27 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyPressed(key);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.MouseDown(e);
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseDown(e);
}
// Mouse enters
private void display_MouseEnter(object sender, EventArgs e)
{
mouseinside = true;
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.MouseEnter(e);
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseEnter(e);
}
// Mouse leaves
private void display_MouseLeave(object sender, EventArgs e)
{
mouseinside = false;
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.MouseLeave(e);
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseLeave(e);
}
// Mouse moves
private void display_MouseMove(object sender, MouseEventArgs e)
{
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.MouseMove(e);
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseMove(e);
}
// Mouse up
@ -756,7 +756,7 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyReleased(key);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.MouseUp(e);
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseUp(e);
}
#endregion
@ -905,7 +905,7 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyPressed((int)e.KeyData);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.KeyDown(e);
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnKeyDown(e);
}
// When a key is released
@ -926,7 +926,7 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyReleased((int)e.KeyData);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.KeyUp(e);
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnKeyUp(e);
}
#endregion
@ -1348,12 +1348,12 @@ namespace CodeImp.DoomBuilder.Interface
// Process mouse input
deltamouse = mouseinput.Process();
if((General.Map != null) && (General.Map.Mode != null))
General.Map.Mode.MouseInput(deltamouse);
General.Map.Mode.OnMouseInput(deltamouse);
}
// Process signal
if((General.Map != null) && (General.Map.Mode != null))
General.Map.Mode.Process();
General.Map.Mode.OnProcess();
}
#endregion

View file

@ -83,13 +83,6 @@ namespace CodeImp.DoomBuilder.Plugins
#region ================== Methods
/// <summary>
/// This is called after the constructor to allow a plugin to initialize.
/// </summary>
public virtual void Initialize()
{
}
/// <summary>
/// This finds the embedded resource with the specified name in the plugin and creates
/// a Stream from it. Returns null when the embedded resource cannot be found.
@ -102,10 +95,21 @@ namespace CodeImp.DoomBuilder.Plugins
return plugin.GetResourceStream(resourcename);
}
#endregion
#region ================== Events
/// <summary>
/// This is called after the constructor to allow a plugin to initialize.
/// </summary>
public virtual void OnInitialize()
{
}
/// <summary>
/// This is called by the Doom Builder core when the user chose to reload the resources.
/// </summary>
public virtual void ReloadResources()
public virtual void OnReloadResources()
{
}
@ -114,7 +118,21 @@ namespace CodeImp.DoomBuilder.Plugins
/// </summary>
/// <param name="oldmode">The previous editing mode</param>
/// <param name="newmode">The new editing mode</param>
public virtual void ModeChanges(EditMode oldmode, EditMode newmode)
public virtual void OnModeChange(EditMode oldmode, EditMode newmode)
{
}
/// <summary>
/// Called by the Doom Builder core when the user changes the program configuration (F5).
/// </summary>
public virtual void OnProgramReconfigure()
{
}
/// <summary>
/// Called by the Doom Builder core when the user changes the map settings (F2).
/// </summary>
public virtual void OnMapReconfigure()
{
}

View file

@ -86,7 +86,7 @@ namespace CodeImp.DoomBuilder.Plugins
// Make plug instance
plug = CreateObject<Plug>(t);
plug.Plugin = this;
plug.Initialize();
plug.OnInitialize();
}
else
{

View file

@ -191,14 +191,14 @@ namespace CodeImp.DoomBuilder.Plugins
public void ReloadResources()
{
foreach(Plugin p in plugins)
p.Plug.ReloadResources();
p.Plug.OnReloadResources();
}
// This calls ModeChanges on all plugins
public void ModeChanges(EditMode oldmode, EditMode newmode)
{
foreach(Plugin p in plugins)
p.Plug.ModeChanges(oldmode, newmode);
p.Plug.OnModeChange(oldmode, newmode);
}
#endregion