Sectors mode: selected sectors geometry cache was not updated after undo/redo.

Updated hint system.
Corrected 2 typos in action names.
This commit is contained in:
MaxED 2013-12-11 08:47:11 +00:00
parent 0b622c5f73
commit 47cebd9b20
13 changed files with 233 additions and 25 deletions

View file

@ -195,7 +195,9 @@ namespace CodeImp.DoomBuilder.Actions
//mxd. This returns the shortcut key description for an action name
public static string GetShortcutKeyDesc(string actionName) {
return GetShortcutKeyDesc(General.Actions.GetActionByName(actionName).ShortcutKey);
Action a = General.Actions.GetActionByName(actionName);
if(a.ShortcutKey == 0) return a.Title + " (not bound to a key)";
return GetShortcutKeyDesc(a.ShortcutKey);
}
#endregion

View file

@ -591,9 +591,6 @@ namespace CodeImp.DoomBuilder.Editing
/// </summary>
public override void OnEngage()
{
//mxd. Clear hint
General.Interface.ClearEditModeHints();
// Clear display overlay
renderer.StartOverlay(true);
renderer.Finish();

View file

@ -2828,9 +2828,13 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
public void ShowEditModeHints(string[] hintsText) {
hintIcon.Visible = true;
hints.Items.Clear();
foreach (string s in hintsText) hints.Items.Add(s);
if (hintsText != null) {
hintIcon.Visible = true;
hints.Items.Clear();
foreach (string s in hintsText) hints.Items.Add(s);
} else {
ClearEditModeHints();
}
}
//mxd

View file

@ -41,6 +41,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Variables
protected bool paintselectpressed; //mxd
//mxd. Hints
protected string[] hints;
protected string[] multiselectionHints;
#endregion
@ -54,6 +58,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public BaseClassicMode()
{
// Initialize
SetupHints(); //mxd
// We have no destructor
GC.SuppressFinalize(this);
@ -76,6 +81,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
//mxd
public override void OnEngage() {
General.Interface.ShowEditModeHints(hints);
base.OnEngage();
}
// This occurs when the user presses Copy. All selected geometry must be marked for copying!
public override bool OnCopyBegin()
{
@ -143,6 +154,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
marqueSelectionMode = MarqueSelectionMode.SELECT;
}
//mxd
protected override void OnEndMultiSelection() {
General.Interface.ShowEditModeHints(hints);
base.OnEndMultiSelection();
}
//mxd
public override void OnUndoEnd() {
General.Map.Renderer2D.UpdateExtraFloorFlag();
@ -163,6 +180,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay(); // Redraw display to hide changes :)
}
//mxd
protected override void StartMultiSelection() {
General.Interface.ShowEditModeHints(multiselectionHints);
base.StartMultiSelection();
}
//mxd
protected virtual void updateSelectionInfo() {
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
@ -207,6 +230,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
General.Interface.OnEditFormValuesChanged -= thingEditForm_OnValuesChanged;
}
//mxd
protected virtual void SetupHints() {
hints = new[] { "Press F1 to view help about current editing mode" };
multiselectionHints = new[] { "Press F1 to view help about current editing mode" };
}
#endregion

View file

@ -217,6 +217,24 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes
General.Editing.ChangeMode(General.Editing.PreviousStableMode.Name);
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string acceptKey = Actions.Action.GetShortcutKeyDesc("builder_acceptmode");
string cancelKey = Actions.Action.GetShortcutKeyDesc("builder_cancelmode");
string removeKey = Actions.Action.GetShortcutKeyDesc("buildermodes_removepoint");
string incSub = Actions.Action.GetShortcutKeyDesc("buildermodes_increasesubdivlevel");
string decSub = Actions.Action.GetShortcutKeyDesc("buildermodes_decreasesubdivlevel");
hints = new[]{"Press " + selectKey + " to place a vertex",
"Use " + incSub + " and " + decSub + " to change detail level of the curve",
"Press " + removeKey + " to remove last vertex",
"Press " + acceptKey + " to accept",
"Press " + cancelKey + " or " + editKey + " to cancel"
};
}
//ACTIONS
[BeginAction("increasesubdivlevel")]
protected virtual void increaseSubdivLevel() {

View file

@ -73,6 +73,24 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
return "BVL: "+bevelWidth+"; VERTS: "+subdivisions;
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string cancelKey = Actions.Action.GetShortcutKeyDesc("builder_cancelmode");
string incSub = Actions.Action.GetShortcutKeyDesc("buildermodes_increasesubdivlevel");
string decSub = Actions.Action.GetShortcutKeyDesc("buildermodes_decreasesubdivlevel");
string incBvl = Actions.Action.GetShortcutKeyDesc("buildermodes_increasebevel");
string decBvl = Actions.Action.GetShortcutKeyDesc("buildermodes_decreasebevel");
hints = new[]{"Press " + selectKey + " to place a vertex",
"Use " + incBvl + " and " + decBvl + " to change bevel by current grid size",
"Use " + incSub + " and " + decSub + " to change the number of points in ellipse",
"Place second vertex to finish drawing",
"Press " + cancelKey + " or " + editKey + " to cancel"
};
}
//ACTIONS
override protected void increaseSubdivLevel() {
if (subdivisions < maxSubdivisions) {

View file

@ -408,6 +408,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
return true;
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string acceptKey = Actions.Action.GetShortcutKeyDesc("builder_acceptmode");
string cancelKey = Actions.Action.GetShortcutKeyDesc("builder_cancelmode");
string removeKey = Actions.Action.GetShortcutKeyDesc("buildermodes_removepoint");
hints = new[]{ "Press " + selectKey + " to place a vertex",
"Press " + removeKey + " to remove last vertex",
"Press " + acceptKey + " to accept",
"Press " + cancelKey + " or " + editKey + " to cancel"
};
}
#endregion
@ -427,20 +442,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Set cursor
General.Interface.SetCursor(Cursors.Cross);
//mxd. Show hints
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string acceptKey = Actions.Action.GetShortcutKeyDesc("builder_acceptmode");
string cancelKey = Actions.Action.GetShortcutKeyDesc("builder_cancelmode");
string removeKey = Actions.Action.GetShortcutKeyDesc("buildermodes_removepoint");
string[] hints = new []{ "Press " + selectKey + " to place a vertex",
"Press " + removeKey + " to remove last vertex",
"Press " + acceptKey + " to accept",
"Press " + cancelKey + " or " + editKey + " to cancel"};
General.Interface.ShowEditModeHints(hints);
}
// Disengaging

View file

@ -182,6 +182,24 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes
return "BVL: " + bevelWidth + "; SUB: " + subdivisions;
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string cancelKey = Actions.Action.GetShortcutKeyDesc("builder_cancelmode");
string incSub = Actions.Action.GetShortcutKeyDesc("buildermodes_increasesubdivlevel");
string decSub = Actions.Action.GetShortcutKeyDesc("buildermodes_decreasesubdivlevel");
string incBvl = Actions.Action.GetShortcutKeyDesc("buildermodes_increasebevel");
string decBvl = Actions.Action.GetShortcutKeyDesc("buildermodes_decreasebevel");
hints = new[]{"Press " + selectKey + " to place a vertex",
"Use " + incBvl + " and " + decBvl + " to change corners bevel by current grid size",
"Use " + incSub + " and " + decSub + " to change bevel detail level",
"Place second vertex to finish drawing",
"Press " + cancelKey + " or " + editKey + " to cancel"
};
}
//update top-left and bottom-right points, which define drawing shape
private void updateReferencePoints(DrawnVertex p1, DrawnVertex p2) {
if (p1.pos.x < p2.pos.x) {

View file

@ -257,6 +257,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
return selectionrect.Contains(l.Start.Position.x, l.Start.Position.y) && selectionrect.Contains(l.End.Position.x, l.End.Position.y);
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string clearKey = Actions.Action.GetShortcutKeyDesc("builder_clearselection");
string insertKey = Actions.Action.GetShortcutKeyDesc("builder_insertitem");
string deleteKey = Actions.Action.GetShortcutKeyDesc("builder_deleteitem");
string panKey = Actions.Action.GetShortcutKeyDesc("builder_pan_view");
string drawKey = Actions.Action.GetShortcutKeyDesc("buildermodes_drawlinesmode");
string gridIncKey = Actions.Action.GetShortcutKeyDesc("builder_griddec");
string gridDecKey = Actions.Action.GetShortcutKeyDesc("builder_gridinc");
hints = new[]{ "Press " + panKey + " to pan the view",
"Press " + selectKey + " to select a linedef",
"Hold " + selectKey + " and drag to use rectangular selection",
"Press " + clearKey + " to clear selection",
"Press " + deleteKey + " to delete selected linedef(s)",
"Press " + editKey + " to edit properties of current selection",
"Use " + gridIncKey + " and " + gridDecKey + " to change grid size",
"Press " + drawKey + " or " + insertKey + " to start drawing lines",
};
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",
};
}
#endregion

View file

@ -502,8 +502,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
private bool isInSelectionRect(Sector s, List<Line2D> selectionOutline) {
bool isInsideSelection = selectionrect.Contains(s.BBox);
if (isInsideSelection) return true;
if(selectionrect.Contains(s.BBox)) return true;
if(BuilderPlug.Me.MarqueSelectTouching && s.BBox.IntersectsWith(selectionrect)) {
//check endpoints
@ -525,6 +524,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
return false;
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string clearKey = Actions.Action.GetShortcutKeyDesc("builder_clearselection");
string insertKey = Actions.Action.GetShortcutKeyDesc("builder_insertitem");
string deleteKey = Actions.Action.GetShortcutKeyDesc("builder_deleteitem");
string panKey = Actions.Action.GetShortcutKeyDesc("builder_pan_view");
string drawKey = Actions.Action.GetShortcutKeyDesc("buildermodes_drawlinesmode");
string gridIncKey = Actions.Action.GetShortcutKeyDesc("builder_griddec");
string gridDecKey = Actions.Action.GetShortcutKeyDesc("builder_gridinc");
hints = new[]{ "Press " + panKey + " to pan the view",
"Press " + selectKey + " to select a sector",
"Hold " + selectKey + " and drag to use rectangular selection",
"Press " + clearKey + " to clear selection",
"Press " + deleteKey + " to delete selected sector(s)",
"Press " + editKey + " to edit properties of current selection",
"Use " + gridIncKey + " and " + gridDecKey + " to change grid size",
"Press " + drawKey + " or " + insertKey + " to start drawing lines",
};
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",
};
}
#endregion
#region ================== Events
@ -1115,6 +1142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Clear labels
SetupLabels();
updateEffectLabels(); //mxd
updateOverlaySurfaces(); //mxd
}
// When redo is used
@ -1132,6 +1160,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Clear labels
SetupLabels();
updateEffectLabels(); //mxd
updateOverlaySurfaces(); //mxd
base.OnRedoEnd(); //mxd
}

View file

@ -632,6 +632,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string clearKey = Actions.Action.GetShortcutKeyDesc("builder_clearselection");
string insertKey = Actions.Action.GetShortcutKeyDesc("builder_insertitem");
string deleteKey = Actions.Action.GetShortcutKeyDesc("builder_deleteitem");
string panKey = Actions.Action.GetShortcutKeyDesc("builder_pan_view");
string drawKey = Actions.Action.GetShortcutKeyDesc("buildermodes_drawlinesmode");
string gridIncKey = Actions.Action.GetShortcutKeyDesc("builder_griddec");
string gridDecKey = Actions.Action.GetShortcutKeyDesc("builder_gridinc");
hints = new[]{ "Press " + panKey + " to pan the view",
"Press " + selectKey + " to select a thing",
"Hold " + selectKey + " and drag to use rectangular selection",
"Press " + clearKey + " to clear selection",
"Press " + deleteKey + " to delete selected thing(s)",
"Press " + editKey + " to edit properties of current selection",
"Use " + gridIncKey + " and " + gridDecKey + " to change grid size",
"Press " + insertKey + " to create a new thing",
"Press " + drawKey + " to start drawing lines",
};
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",
};
}
#endregion
#region ================== Actions

View file

@ -229,6 +229,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Present();
}
}
//mxd
protected override void StartMultiSelection() {
General.Interface.ShowEditModeHints(multiselectionHints);
base.StartMultiSelection();
}
// Selection
protected override void OnSelectBegin()
@ -636,6 +642,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
}
//mxd. Setup hints for current editing mode
protected override void SetupHints() {
string selectKey = Actions.Action.GetShortcutKeyDesc("builder_classicselect");
string editKey = Actions.Action.GetShortcutKeyDesc("builder_classicedit");
string clearKey = Actions.Action.GetShortcutKeyDesc("builder_clearselection");
string insertKey = Actions.Action.GetShortcutKeyDesc("builder_insertitem");
string deleteKey = Actions.Action.GetShortcutKeyDesc("builder_deleteitem");
string panKey = Actions.Action.GetShortcutKeyDesc("builder_pan_view");
string drawKey = Actions.Action.GetShortcutKeyDesc("buildermodes_drawlinesmode");
string gridIncKey = Actions.Action.GetShortcutKeyDesc("builder_griddec");
string gridDecKey = Actions.Action.GetShortcutKeyDesc("builder_gridinc");
hints = new[]{ "Press " + panKey + " to pan the view",
"Press " + selectKey + " to select a vertex",
"Hold " + selectKey + " and drag to use rectangular selection",
"Press " + clearKey + " to clear selection",
"Press " + insertKey + " to insert a new vertex",
"Press " + deleteKey + " to delete selected vertices",
"Press " + editKey + " to edit properties of current selection",
"Use " + gridIncKey + " and " + gridDecKey + " to change grid size",
"Press " + drawKey + " to start drawing lines",
};
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",
};
}
#endregion

View file

@ -127,7 +127,7 @@ drawcurvemode
//mxd
increasesubdivlevel
{
title = "Increase Sudivision Level";
title = "Increase Subdivision Level";
category = "drawing";
description = "Increases subdivision level in Rectangle and Ellipse Drawing Modes.";
allowkeys = true;
@ -139,7 +139,7 @@ increasesubdivlevel
//mxd
decreasesubdivlevel
{
title = "Decrease Sudivision Level";
title = "Decrease Subdivision Level";
category = "drawing";
description = "Decreases subdivision level in Rectangle and Ellipse Drawing Modes.";
allowkeys = true;