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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -627,7 +627,7 @@ namespace CodeImp.DoomBuilder.Interface
{ {
if((General.Map != null) && (General.Map.Mode != null)) if((General.Map != null) && (General.Map.Mode != null))
{ {
General.Map.Mode.RedrawDisplay(); General.Map.Mode.OnRedrawDisplay();
} }
else else
{ {
@ -642,7 +642,7 @@ namespace CodeImp.DoomBuilder.Interface
{ {
if(General.Map.Mode != null) if(General.Map.Mode != null)
{ {
if(!displayresized) General.Map.Mode.RefreshDisplay(); if(!displayresized) General.Map.Mode.OnRefreshDisplay();
} }
else else
{ {
@ -690,10 +690,10 @@ namespace CodeImp.DoomBuilder.Interface
} }
// Mouse click // 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 // 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 // Mouse down
private void display_MouseDown(object sender, MouseEventArgs e) private void display_MouseDown(object sender, MouseEventArgs e)
@ -714,27 +714,27 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyPressed(key); General.Actions.KeyPressed(key);
// Invoke on editing mode // 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 // Mouse enters
private void display_MouseEnter(object sender, EventArgs e) private void display_MouseEnter(object sender, EventArgs e)
{ {
mouseinside = true; 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 // Mouse leaves
private void display_MouseLeave(object sender, EventArgs e) private void display_MouseLeave(object sender, EventArgs e)
{ {
mouseinside = false; 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 // Mouse moves
private void display_MouseMove(object sender, MouseEventArgs e) 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 // Mouse up
@ -756,7 +756,7 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyReleased(key); General.Actions.KeyReleased(key);
// Invoke on editing mode // 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 #endregion
@ -905,7 +905,7 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyPressed((int)e.KeyData); General.Actions.KeyPressed((int)e.KeyData);
// Invoke on editing mode // 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 // When a key is released
@ -926,7 +926,7 @@ namespace CodeImp.DoomBuilder.Interface
General.Actions.KeyReleased((int)e.KeyData); General.Actions.KeyReleased((int)e.KeyData);
// Invoke on editing mode // 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 #endregion
@ -1348,12 +1348,12 @@ namespace CodeImp.DoomBuilder.Interface
// Process mouse input // Process mouse input
deltamouse = mouseinput.Process(); deltamouse = mouseinput.Process();
if((General.Map != null) && (General.Map.Mode != null)) if((General.Map != null) && (General.Map.Mode != null))
General.Map.Mode.MouseInput(deltamouse); General.Map.Mode.OnMouseInput(deltamouse);
} }
// Process signal // Process signal
if((General.Map != null) && (General.Map.Mode != null)) if((General.Map != null) && (General.Map.Mode != null))
General.Map.Mode.Process(); General.Map.Mode.OnProcess();
} }
#endregion #endregion

View file

@ -83,13 +83,6 @@ namespace CodeImp.DoomBuilder.Plugins
#region ================== Methods #region ================== Methods
/// <summary>
/// This is called after the constructor to allow a plugin to initialize.
/// </summary>
public virtual void Initialize()
{
}
/// <summary> /// <summary>
/// This finds the embedded resource with the specified name in the plugin and creates /// 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. /// 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); 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> /// <summary>
/// This is called by the Doom Builder core when the user chose to reload the resources. /// This is called by the Doom Builder core when the user chose to reload the resources.
/// </summary> /// </summary>
public virtual void ReloadResources() public virtual void OnReloadResources()
{ {
} }
@ -114,7 +118,21 @@ namespace CodeImp.DoomBuilder.Plugins
/// </summary> /// </summary>
/// <param name="oldmode">The previous editing mode</param> /// <param name="oldmode">The previous editing mode</param>
/// <param name="newmode">The new 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 // Make plug instance
plug = CreateObject<Plug>(t); plug = CreateObject<Plug>(t);
plug.Plugin = this; plug.Plugin = this;
plug.Initialize(); plug.OnInitialize();
} }
else else
{ {

View file

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