From a79b8e215ffab2ce82a8fab3b97862b6bdf5bce2 Mon Sep 17 00:00:00 2001 From: codeimp Date: Fri, 20 Aug 2010 19:41:20 +0000 Subject: [PATCH] @ Small improvement on selecting in Comments Panel plugin --- .../Plugins/CommentsPanel/CommentsDocker.cs | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Source/Plugins/CommentsPanel/CommentsDocker.cs b/Source/Plugins/CommentsPanel/CommentsDocker.cs index 08008add..2a359a0f 100644 --- a/Source/Plugins/CommentsPanel/CommentsDocker.cs +++ b/Source/Plugins/CommentsPanel/CommentsDocker.cs @@ -308,27 +308,34 @@ namespace CodeImp.DoomBuilder.CommentsPanel private void SelectComment(CommentInfo c, bool clear) { string editmode = ""; - bool selectinggeometry; - - if(c.Elements[0] is Thing) - selectinggeometry = false; - else - selectinggeometry = true; // Leave any volatile mode General.Editing.CancelVolatileMode(); if(clear) + { General.Map.Map.ClearAllSelected(); - if(selectinggeometry) - { - // Sectors mode is a bitch because it deals with selections somewhat aggressively - // so we have to switch to linedefs to make this work right - if((General.Editing.Mode.GetType().Name == "VerticesMode") || - (General.Editing.Mode.GetType().Name == "SectorsMode") || - (General.Editing.Mode.GetType().Name == "MakeSectorMode")) + if(c.Elements[0] is Thing) + General.Editing.ChangeMode("ThingsMode"); + else if(c.Elements[0] is Vertex) + General.Editing.ChangeMode("VerticesMode"); + else if((c.Elements[0] is Linedef) || (c.Elements[0] is Sidedef)) General.Editing.ChangeMode("LinedefsMode"); + else if(c.Elements[0] is Sector) + General.Editing.ChangeMode("SectorsMode"); + } + else + { + if(!(c.Elements[0] is Thing)) + { + // Sectors mode is a bitch because it deals with selections somewhat aggressively + // so we have to switch to linedefs to make this work right + if((General.Editing.Mode.GetType().Name == "VerticesMode") || + (General.Editing.Mode.GetType().Name == "SectorsMode") || + (General.Editing.Mode.GetType().Name == "MakeSectorMode")) + General.Editing.ChangeMode("LinedefsMode"); + } } // Select the map elements