Merge pull request #4091 from larsbrubaker/master
Don't call ExpandedChanged twice in TreeView
This commit is contained in:
commit
a9e0953e11
11 changed files with 88 additions and 25 deletions
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl
|
|||
new MappedSetting(this, "air_gap_speed", "air_gap_speed"),
|
||||
new MappedSetting(this, "extruder_wipe_temperature","extruder_wipe_temperature"),
|
||||
new MappedSetting(this, SettingsKey.filament_diameter,SettingsKey.filament_diameter),
|
||||
new MappedSetting(this, "first_layer_bed_temperature", SettingsKey.bed_temperature),
|
||||
new ReplaceWithSetting(this, "first_layer_bed_temperature", SettingsKey.bed_temperature, SettingsKey.bed_temperature),
|
||||
new MappedSetting(this, "first_layer_temperature", SettingsKey.temperature),
|
||||
new MappedSetting(this, SettingsKey.max_fan_speed,"max_fan_speed"),
|
||||
new MappedSetting(this, SettingsKey.min_fan_speed,"min_fan_speed"),
|
||||
|
|
@ -85,6 +85,9 @@ namespace MatterHackers.MatterControl
|
|||
new MappedSetting(this, SettingsKey.temperature,SettingsKey.temperature),
|
||||
new MappedSetting(this, "z_offset","z_offset"),
|
||||
new MappedSetting(this, SettingsKey.bed_temperature,SettingsKey.bed_temperature),
|
||||
new MappedSetting(this, SettingsKey.temperature1, SettingsKey.temperature1),
|
||||
new MappedSetting(this, SettingsKey.temperature2, SettingsKey.temperature2),
|
||||
new MappedSetting(this, SettingsKey.temperature3, SettingsKey.temperature3),
|
||||
new ScaledSingleNumber(this, "infill_speed", "infill_speed", 60),
|
||||
new ScaledSingleNumber(this, "min_print_speed", "min_print_speed", 60),
|
||||
new ScaledSingleNumber(this, "perimeter_speed","perimeter_speed", 60),
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
expandWidget.Click += (s, e) =>
|
||||
{
|
||||
this.Expanded = !this.Expanded;
|
||||
this.ExpandedChanged?.Invoke(this, null);
|
||||
expandWidget.Expanded = this.Expanded;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,9 +78,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
scaleItem.Children.Add(itemToFit);
|
||||
fitToBounds.Children.Add(bounds);
|
||||
|
||||
fitToBounds.SizeX = aabb.XSize;
|
||||
fitToBounds.SizeY = aabb.YSize;
|
||||
fitToBounds.SizeZ = aabb.ZSize;
|
||||
fitToBounds.boundsSize.X = aabb.XSize;
|
||||
fitToBounds.boundsSize.Y = aabb.YSize;
|
||||
fitToBounds.boundsSize.Z = aabb.ZSize;
|
||||
fitToBounds.Rebuild(null);
|
||||
|
||||
return fitToBounds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,14 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public PinchObject3D()
|
||||
{
|
||||
Name = "Pinch".Localize();
|
||||
// TODO: This feels like the wronge approach. I think changing the safe list should always
|
||||
// call into invalidate for every Object3D (this will cause a lot of classes to need to be fixed).
|
||||
Children.ItemsModified += Children_ItemsModified;
|
||||
}
|
||||
|
||||
private void Children_ItemsModified(object sender, System.EventArgs e)
|
||||
{
|
||||
OnInvalidate(new InvalidateArgs(null, InvalidateType.Content));
|
||||
}
|
||||
|
||||
[DisplayName("Back Ratio")]
|
||||
|
|
|
|||
|
|
@ -49,27 +49,44 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
|
||||
public override void Flatten(UndoBuffer undoBuffer)
|
||||
{
|
||||
var meshWrappers = this.Descendants().Where(o => o.OwnerID == this.ID).ToList();
|
||||
var ownedMeshWrappers = this.Descendants().Where(o => o.OwnerID == this.ID).ToList();
|
||||
|
||||
var newMeshObjects = new List<IObject3D>();
|
||||
|
||||
// remove all the meshWrappers (collapse the children)
|
||||
foreach (var meshWrapper in meshWrappers)
|
||||
foreach (var ownedMeshWrapper in ownedMeshWrappers)
|
||||
{
|
||||
var parent = meshWrapper.Parent;
|
||||
if (meshWrapper.Visible)
|
||||
var wrapperParent = ownedMeshWrapper.Parent;
|
||||
if (ownedMeshWrapper.Visible)
|
||||
{
|
||||
var newMesh = new Object3D()
|
||||
{
|
||||
Mesh = meshWrapper.Mesh
|
||||
Mesh = ownedMeshWrapper.Mesh.Copy(CancellationToken.None)
|
||||
};
|
||||
newMesh.CopyProperties(meshWrapper, Object3DPropertyFlags.All);
|
||||
newMesh.CopyProperties(ownedMeshWrapper, Object3DPropertyFlags.All);
|
||||
var matrix = ownedMeshWrapper.WorldMatrix(this);
|
||||
newMesh.Mesh.Transform(matrix);
|
||||
newMesh.Matrix = Matrix4X4.Identity;
|
||||
newMesh.Name = this.Name;
|
||||
parent.Children.Add(newMesh);
|
||||
newMeshObjects.Add(newMesh);
|
||||
}
|
||||
|
||||
// remove it
|
||||
parent.Children.Remove(meshWrapper);
|
||||
wrapperParent.Children.Remove(ownedMeshWrapper);
|
||||
}
|
||||
|
||||
this.Matrix = Matrix4X4.Identity;
|
||||
|
||||
this.Children.Modify(children =>
|
||||
{
|
||||
children.Clear();
|
||||
children.AddRange(newMeshObjects);
|
||||
foreach(var child in children)
|
||||
{
|
||||
child.MakeNameNonColliding();
|
||||
}
|
||||
});
|
||||
|
||||
base.Flatten(undoBuffer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
"enable_fan",
|
||||
"extruder_wipe_temperature",
|
||||
"extruders_share_temperature",
|
||||
"first_layer_bed_temperature",
|
||||
"g0",
|
||||
"layer_to_pause",
|
||||
"selector_ip_address",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Copyright (c) 2016, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
namespace MatterHackers.MatterControl.SlicerConfiguration.MappingClasses
|
||||
{
|
||||
public class ReplaceWithSetting : MappedSetting
|
||||
{
|
||||
string replaceSettingsName;
|
||||
|
||||
public ReplaceWithSetting(PrinterConfig printer, string canonicalSettingsName, string replaceSettingsName, string exportedName)
|
||||
: base(printer, canonicalSettingsName, exportedName)
|
||||
{
|
||||
this.replaceSettingsName = replaceSettingsName;
|
||||
}
|
||||
|
||||
public override string Value => printer.Settings.GetValue(replaceSettingsName);
|
||||
}
|
||||
}
|
||||
|
|
@ -404,15 +404,6 @@
|
|||
"ShowIfSet": "!sla_printer",
|
||||
"DefaultValue": "1"
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "first_layer_bed_temperature",
|
||||
"PresentationName": "Bed First Layer",
|
||||
"HelpText": "The temperature to set the bed to before printing the first layer. The printer will wait until this temperature has been reached before printing. Set to 0 to eliminate bed temperature commands.",
|
||||
"DataEditType": "DOUBLE",
|
||||
"Units": "°C",
|
||||
"ShowIfSet": "has_heated_bed",
|
||||
"DefaultValue": "75"
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "first_layer_extrusion_width",
|
||||
"PresentationName": "First Layer",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit c0dd75b189ef909264a736e7d9db9eca67a0c333
|
||||
Subproject commit c583dd6d0a62f478e456a25552935370446ab099
|
||||
|
|
@ -89,7 +89,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
TestMacroReplacement("[external_perimeter_speed]", "1260");
|
||||
TestMacroReplacement("[extruder_wipe_temperature]", "0");
|
||||
TestMacroReplacement("[filament_diameter]", "3");
|
||||
TestMacroReplacement("[first_layer_bed_temperature]", "75");
|
||||
TestMacroReplacement("[first_layer_bed_temperature]", "70");
|
||||
TestMacroReplacement("[first_layer_temperature]", "205");
|
||||
TestMacroReplacement("{max_fan_speed}", "100");
|
||||
TestMacroReplacement("{min_fan_speed}", "35");
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
var root = new Object3D();
|
||||
var cube = new CubeObject3D(20, 20, 20);
|
||||
root.Children.Add(cube);
|
||||
var fit = FitToBoundsObject3D_2.Create(cube);
|
||||
|
||||
fit.SizeX = 50;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue