개정판 d128ceb2
issue #923: add UndoCommand
Change-Id: I7bb9cf1d4276c75e50906b7f4672433afc233e15
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
1 | 1 |
using KCOM.Common; |
2 |
using KCOM.Events; |
|
2 | 3 |
using MarkupToPDF.Common; |
3 | 4 |
using MarkupToPDF.Controls.Cad; |
4 | 5 |
using MarkupToPDF.Controls.Common; |
... | ... | |
1192 | 1193 |
this.isDragging = false; |
1193 | 1194 |
DraggerThumb = null; |
1194 | 1195 |
|
1195 |
Undo_Event(); |
|
1196 |
var comments = (from drawing in this.MemberSet |
|
1197 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1198 |
UndoCommand.Instance.Execute(comments, this.AngleValue); |
|
1196 | 1199 |
} |
1197 | 1200 |
|
1198 | 1201 |
/// <summary> |
... | ... | |
1226 | 1229 |
} |
1227 | 1230 |
} |
1228 | 1231 |
|
1229 |
Undo_Event(); |
|
1232 |
var comments = (from drawing in this.MemberSet |
|
1233 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1234 |
UndoCommand.Instance.Execute(comments, this.AngleValue); |
|
1230 | 1235 |
} |
1231 | 1236 |
|
1232 | 1237 |
private void rotate_MouseMove(object sender, MouseEventArgs e) |
... | ... | |
1946 | 1951 |
return; |
1947 | 1952 |
} |
1948 | 1953 |
|
1949 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
|
1954 |
if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
|
|
1950 | 1955 |
{ |
1951 | 1956 |
return; |
1952 | 1957 |
} |
1953 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
|
1958 |
|
|
1959 |
if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
|
1954 | 1960 |
{ |
1955 | 1961 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
1956 | 1962 |
{ |
... | ... | |
1961 | 1967 |
} |
1962 | 1968 |
} |
1963 | 1969 |
|
1964 |
Undo_Event(); |
|
1970 |
var comments = (from drawing in this.MemberSet |
|
1971 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1972 |
UndoCommand.Instance.Execute(comments, this.AngleValue); |
|
1965 | 1973 |
} |
1966 | 1974 |
|
1967 | 1975 |
private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
1968 | 1976 |
{ |
1969 | 1977 |
rotateTop.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1970 |
|
|
1971 |
Undo_Event(); |
|
1978 |
|
|
1979 |
var comments = (from drawing in this.MemberSet |
|
1980 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1981 |
UndoCommand.Instance.Execute(comments, this.AngleValue); |
|
1972 | 1982 |
} |
1973 | 1983 |
|
1974 | 1984 |
private void drag_DragStarted(object sender, DragStartedEventArgs e) |
... | ... | |
1992 | 2002 |
} |
1993 | 2003 |
} |
1994 | 2004 |
|
1995 |
Undo_Event(); |
|
1996 |
} |
|
1997 |
|
|
1998 |
private void Undo_Event() |
|
1999 |
{ |
|
2000 |
List<Point> p_set = new List<Point>(); |
|
2001 |
|
|
2002 |
Undo_data UndoData = new Undo_data() |
|
2003 |
{ |
|
2004 |
IsUndo = false, |
|
2005 |
Event = Event_Type.Thumb, |
|
2006 |
EventTime = DateTime.Now, |
|
2007 |
Markup_List = new List<Multi_Undo_data>(), |
|
2008 |
}; |
|
2009 |
|
|
2010 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
2011 |
|
|
2012 |
foreach (var control in MemberSet) |
|
2013 |
{ |
|
2014 |
multi_Undo_Data.PointSet = new List<Point>(); |
|
2015 |
p_set = new List<Point>(); |
|
2016 |
|
|
2017 |
if (control.DrawingData as TextControl != null) |
|
2018 |
{ |
|
2019 |
multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).StartPoint); |
|
2020 |
multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).EndPoint); |
|
2021 |
} |
|
2022 |
|
|
2023 |
foreach (var point in ((control.DrawingData as CommentUserInfo) as IPath).PointSet) |
|
2024 |
{ |
|
2025 |
multi_Undo_Data.PointSet.Add(point); |
|
2026 |
} |
|
2027 |
|
|
2028 |
if (control.DrawingData as ArrowTextControl != null) |
|
2029 |
{ |
|
2030 |
multi_Undo_Data.Angle = AngleValue = (control.DrawingData as ArrowTextControl).Angle; |
|
2031 |
} |
|
2032 |
else |
|
2033 |
{ |
|
2034 |
multi_Undo_Data.Angle = AngleValue; |
|
2035 |
} |
|
2036 |
|
|
2037 |
multi_Undo_Data.Markup = control.DrawingData as CommentUserInfo; |
|
2038 |
UndoData.Markup_List.Add(multi_Undo_Data); |
|
2039 |
multi_Undo_Data = new Multi_Undo_data(); |
|
2040 |
} |
|
2041 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
|
2042 |
{ |
|
2043 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
|
2044 |
}); |
|
2045 |
|
|
2046 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
2047 |
|
|
2005 |
var comments = (from drawing in this.MemberSet |
|
2006 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
2007 |
UndoCommand.Instance.Execute(comments, this.AngleValue); |
|
2048 | 2008 |
} |
2049 | 2009 |
|
2050 | 2010 |
private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
2051 | 2011 |
{ |
2052 | 2012 |
DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2053 | 2013 |
|
2054 |
Undo_Event(); |
|
2014 |
var comments = (from drawing in this.MemberSet |
|
2015 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
2016 |
UndoCommand.Instance.Execute(comments, this.AngleValue); |
|
2055 | 2017 |
} |
2056 | 2018 |
|
2057 | 2019 |
public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
내보내기 Unified diff