- cleaned up debug stuff from action delegates binding

- fixed things in drag mode (now move correctly along with scroll/zoom), this fixes issue 0000039
This commit is contained in:
codeimp 2008-02-15 12:15:46 +00:00
parent e0c573bbe9
commit eee375031f
2 changed files with 30 additions and 3 deletions

View file

@ -72,6 +72,11 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
// List of unstable lines // List of unstable lines
private ICollection<Linedef> unstablelines; private ICollection<Linedef> unstablelines;
// Keep track of view changes
private float lastoffsetx;
private float lastoffsety;
private float lastscale;
// Options // Options
private bool snaptogrid; // SHIFT to toggle private bool snaptogrid; // SHIFT to toggle
private bool snaptonearest; // CTRL to enable private bool snaptonearest; // CTRL to enable
@ -112,6 +117,11 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
// Also keep old position of the dragged item // Also keep old position of the dragged item
dragitemposition = dragitem.Position; dragitemposition = dragitem.Position;
// Keep view information
lastoffsetx = renderer.OffsetX;
lastoffsety = renderer.OffsetY;
lastscale = renderer.Scale;
// Make list of unstable lines only // Make list of unstable lines only
// These will have their length displayed during the drag // These will have their length displayed during the drag
unstablelines = General.Map.Map.LinedefsFromSelectedVertices(false, false, true); unstablelines = General.Map.Map.LinedefsFromSelectedVertices(false, false, true);
@ -268,8 +278,15 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
// This redraws the display // This redraws the display
public unsafe override void RedrawDisplay() public unsafe override void RedrawDisplay()
{ {
bool viewchanged = false;
// View changed?
if(renderer.OffsetX != lastoffsetx) viewchanged = true;
if(renderer.OffsetY != lastoffsety) viewchanged = true;
if(renderer.Scale != lastscale) viewchanged = true;
// Start rendering // Start rendering
if(renderer.Start(true, false)) if(renderer.Start(true, viewchanged))
{ {
// Uncomment this to see triangulation // Uncomment this to see triangulation
/* /*
@ -283,6 +300,18 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
} }
} }
*/ */
// Redraw things when view changed
if(viewchanged)
{
renderer.SetThingsRenderOrder(false);
renderer.RenderThingSet(General.Map.Map.Things);
// Keep view information
lastoffsetx = renderer.OffsetX;
lastoffsety = renderer.OffsetY;
lastscale = renderer.Scale;
}
// Render lines and vertices // Render lines and vertices
renderer.RenderLinedefSet(General.Map.Map.Linedefs); renderer.RenderLinedefSet(General.Map.Map.Linedefs);

View file

@ -141,7 +141,6 @@ namespace CodeImp.DoomBuilder.Controls
actionname = a.GetFullActionName(type.Assembly); actionname = a.GetFullActionName(type.Assembly);
// Bind method to action // Bind method to action
General.WriteLogLine("Binding '" + actionname + "'");
if(General.Actions.Exists(actionname)) if(General.Actions.Exists(actionname))
General.Actions[actionname].Bind(del); General.Actions[actionname].Bind(del);
else else
@ -209,7 +208,6 @@ namespace CodeImp.DoomBuilder.Controls
actionname = a.GetFullActionName(type.Assembly); actionname = a.GetFullActionName(type.Assembly);
// Unbind method from action // Unbind method from action
General.WriteLogLine("Unbinding '" + actionname + "'");
General.Actions[actionname].Unbind(del); General.Actions[actionname].Unbind(del);
} }
} }