개정판 f816dd63
issue #923: add RedoCommand class
Change-Id: I4030ff812a02655439edccaa65cdaaa035e1549a
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
3148 | 3148 |
{ |
3149 | 3149 |
Ang = 360 - rotate.Angle; |
3150 | 3150 |
} |
3151 |
move = new Move(); |
|
3152 | 3151 |
|
3153 | 3152 |
if (e.OriginalSource is System.Windows.Controls.Image) |
3154 | 3153 |
{ |
... | ... | |
6342 | 6341 |
return multi_Undo_Data; |
6343 | 6342 |
} |
6344 | 6343 |
|
6345 |
public void Undo() |
|
6346 |
{ |
|
6347 |
// if (ViewerDataModel.Instance.IsPressCtrl) |
|
6348 |
// { |
|
6349 |
// ViewerDataModel.Instance.IsPressCtrl = false; |
|
6350 |
// } |
|
6351 |
Undo_data undo = new Undo_data(); |
|
6352 |
AdornerFinal final; |
|
6353 |
SelectionSet.Instance.UnSelect(this); |
|
6354 |
|
|
6355 |
undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault(); |
|
6356 |
if (undo == null) |
|
6357 |
return; |
|
6358 |
|
|
6359 |
|
|
6360 |
|
|
6361 |
switch (undo.Event) |
|
6362 |
{ |
|
6363 |
case (Event_Type.Create): |
|
6364 |
{ |
|
6365 |
foreach (var item in undo.Markup_List) |
|
6366 |
{ |
|
6367 |
ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
|
6368 |
} |
|
6369 |
} |
|
6370 |
break; |
|
6371 |
case (Event_Type.Delete): |
|
6372 |
{ |
|
6373 |
foreach (var item in undo.Markup_List) |
|
6374 |
{ |
|
6375 |
ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
|
6376 |
} |
|
6377 |
} |
|
6378 |
break; |
|
6379 |
case (Event_Type.Thumb): |
|
6380 |
{ |
|
6381 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
|
6382 |
|
|
6383 |
foreach (var item in undo.Markup_List) |
|
6384 |
{ |
|
6385 |
ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
|
6386 |
|
|
6387 |
if ((item.Markup as IViewBox) != null) |
|
6388 |
{ |
|
6389 |
(item.Markup as IViewBox).Angle = item.Angle; |
|
6390 |
} |
|
6391 |
if ((item.Markup as TextControl) != null) |
|
6392 |
{ |
|
6393 |
(item.Markup as TextControl).Angle = item.Angle; |
|
6394 |
Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
|
6395 |
Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
|
6396 |
} |
|
6397 |
else |
|
6398 |
{ |
|
6399 |
(item.Markup as IPath).PointSet = item.PointSet; |
|
6400 |
(item.Markup as IPath).updateControl(); |
|
6401 |
} |
|
6402 |
|
|
6403 |
comment.Add(item.Markup); |
|
6404 |
} |
|
6405 |
final = new AdornerFinal(comment); |
|
6406 |
SelectLayer.Children.Add(final); |
|
6407 |
SelectionSet.Instance.UnSelect(this); |
|
6408 |
} |
|
6409 |
break; |
|
6410 |
case (Event_Type.Select): |
|
6411 |
{ |
|
6412 |
SelectionSet.Instance.UnSelect(this); |
|
6413 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
|
6414 |
|
|
6415 |
foreach (var item in undo.Markup_List) |
|
6416 |
{ |
|
6417 |
ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
|
6418 |
|
|
6419 |
if ((item.Markup as IPath) != null) |
|
6420 |
{ |
|
6421 |
(item.Markup as IPath).LineSize = item.LineSize; |
|
6422 |
} |
|
6423 |
if ((item.Markup as UIElement) != null) |
|
6424 |
{ |
|
6425 |
(item.Markup as UIElement).Opacity = item.Opacity; |
|
6426 |
} |
|
6427 |
if ((item.Markup as IDashControl) != null) |
|
6428 |
{ |
|
6429 |
(item.Markup as IDashControl).DashSize = item.DashSize; |
|
6430 |
} |
|
6431 |
if ((item.Markup as IShapeControl) != null) |
|
6432 |
{ |
|
6433 |
(item.Markup as IShapeControl).Paint = item.paint; |
|
6434 |
} |
|
6435 |
|
|
6436 |
comment.Add(item.Markup); |
|
6437 |
} |
|
6438 |
|
|
6439 |
final = new AdornerFinal(comment); |
|
6440 |
SelectLayer.Children.Add(final); |
|
6441 |
} |
|
6442 |
break; |
|
6443 |
case (Event_Type.Option): |
|
6444 |
{ |
|
6445 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
|
6446 |
|
|
6447 |
foreach (var item in undo.Markup_List) |
|
6448 |
{ |
|
6449 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
|
6450 |
|
|
6451 |
if (undo.LineSize != 0 && item.Markup as IPath != null) |
|
6452 |
{ |
|
6453 |
(item.Markup as IPath).LineSize = undo.LineSize; |
|
6454 |
} |
|
6455 |
else if (undo.Opacity != 0 && item.Markup as UIElement != null) |
|
6456 |
{ |
|
6457 |
(item.Markup as UIElement).Opacity = undo.Opacity; |
|
6458 |
} |
|
6459 |
else if (undo.DashSize != null && item.Markup as IDashControl != null) |
|
6460 |
{ |
|
6461 |
(item.Markup as IDashControl).DashSize = undo.DashSize; |
|
6462 |
} |
|
6463 |
else if (undo.Interval != 0 && item.Markup as LineControl != null) |
|
6464 |
{ |
|
6465 |
(item.Markup as LineControl).Interval = undo.Interval; |
|
6466 |
} |
|
6467 |
else if (item.Markup as IShapeControl != null) |
|
6468 |
{ |
|
6469 |
(item.Markup as IShapeControl).Paint = undo.paint; |
|
6470 |
} |
|
6471 |
comment.Add(item.Markup); |
|
6472 |
} |
|
6473 |
final = new AdornerFinal(comment); |
|
6474 |
SelectLayer.Children.Add(final); |
|
6475 |
} |
|
6476 |
break; |
|
6477 |
} |
|
6478 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
|
6479 |
{ |
|
6480 |
i.IsUndo = true; |
|
6481 |
}); |
|
6482 |
} |
|
6483 |
|
|
6484 |
|
|
6485 |
|
|
6486 |
public void Redo() |
|
6487 |
{ |
|
6488 |
//if (ViewerDataModel.Instance.IsPressCtrl) |
|
6489 |
//{ |
|
6490 |
// ViewerDataModel.Instance.IsPressCtrl = false; |
|
6491 |
//} |
|
6492 |
AdornerFinal final; |
|
6493 |
Undo_data redo = new Undo_data(); |
|
6494 |
redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault(); |
|
6495 |
SelectionSet.Instance.UnSelect(this); |
|
6496 |
if (redo == null) |
|
6497 |
return; |
|
6498 |
|
|
6499 |
switch (redo.Event) |
|
6500 |
{ |
|
6501 |
case (Event_Type.Create): |
|
6502 |
{ |
|
6503 |
foreach (var item in redo.Markup_List) |
|
6504 |
{ |
|
6505 |
ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
|
6506 |
//temp.AddTemp(redo, pageNavigator.CurrentPage.PageNumber, 0, 0); |
|
6507 |
} |
|
6508 |
} |
|
6509 |
break; |
|
6510 |
case (Event_Type.Delete): |
|
6511 |
{ |
|
6512 |
foreach (var item in redo.Markup_List) |
|
6513 |
{ |
|
6514 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
|
6515 |
} |
|
6516 |
} |
|
6517 |
break; |
|
6518 |
case (Event_Type.Thumb): |
|
6519 |
{ |
|
6520 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
|
6521 |
|
|
6522 |
foreach (var item in redo.Markup_List) |
|
6523 |
{ |
|
6524 |
ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo)); |
|
6525 |
|
|
6526 |
if ((item.Markup as IViewBox) != null) |
|
6527 |
{ |
|
6528 |
(item.Markup as IViewBox).Angle = item.Angle; |
|
6529 |
} |
|
6530 |
if ((item.Markup as TextControl) != null) |
|
6531 |
{ |
|
6532 |
(item.Markup as TextControl).Angle = item.Angle; |
|
6533 |
|
|
6534 |
Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
|
6535 |
Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
|
6536 |
} |
|
6537 |
else |
|
6538 |
{ |
|
6539 |
(item.Markup as IPath).PointSet = item.PointSet; |
|
6540 |
(item.Markup as IPath).updateControl(); |
|
6541 |
} |
|
6542 |
comment.Add(item.Markup); |
|
6543 |
} |
|
6544 |
final = new AdornerFinal(comment); |
|
6545 |
SelectLayer.Children.Add(final); |
|
6546 |
SelectionSet.Instance.UnSelect(this); |
|
6547 |
} |
|
6548 |
break; |
|
6549 |
case (Event_Type.Select): |
|
6550 |
{ |
|
6551 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
|
6552 |
|
|
6553 |
foreach (var item in redo.Markup_List) |
|
6554 |
{ |
|
6555 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
|
6556 |
|
|
6557 |
if ((item.Markup as IPath) != null) |
|
6558 |
{ |
|
6559 |
(item.Markup as IPath).LineSize = item.LineSize; |
|
6560 |
} |
|
6561 |
if ((item.Markup as UIElement) != null) |
|
6562 |
{ |
|
6563 |
(item.Markup as UIElement).Opacity = item.Opacity; |
|
6564 |
} |
|
6565 |
if ((item.Markup as IDashControl) != null) |
|
6566 |
{ |
|
6567 |
(item.Markup as IDashControl).DashSize = item.DashSize; |
|
6568 |
} |
|
6569 |
if ((item.Markup as IShapeControl) != null) |
|
6570 |
{ |
|
6571 |
(item.Markup as IShapeControl).Paint = item.paint; |
|
6572 |
} |
|
6573 |
|
|
6574 |
comment.Add(item.Markup); |
|
6575 |
} |
|
6576 |
final = new AdornerFinal(comment); |
|
6577 |
SelectLayer.Children.Add(final); |
|
6578 |
} |
|
6579 |
break; |
|
6580 |
case (Event_Type.Option): |
|
6581 |
{ |
|
6582 |
List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
|
6583 |
|
|
6584 |
foreach (var item in redo.Markup_List) |
|
6585 |
{ |
|
6586 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
|
6587 |
if (redo.LineSize != 0 && item.Markup as IPath != null) |
|
6588 |
{ |
|
6589 |
(item.Markup as IPath).LineSize = redo.LineSize; |
|
6590 |
} |
|
6591 |
else if (redo.Opacity != 0 && item.Markup as UIElement != null) |
|
6592 |
{ |
|
6593 |
(item.Markup as UIElement).Opacity = redo.Opacity; |
|
6594 |
} |
|
6595 |
else if (redo.DashSize != null && item.Markup as IDashControl != null) |
|
6596 |
{ |
|
6597 |
(item.Markup as IDashControl).DashSize = redo.DashSize; |
|
6598 |
} |
|
6599 |
else if (redo.Interval != 0 && item.Markup as LineControl != null) |
|
6600 |
{ |
|
6601 |
(item.Markup as LineControl).Interval = redo.Interval; |
|
6602 |
} |
|
6603 |
else if (item.Markup as IShapeControl != null) |
|
6604 |
{ |
|
6605 |
(item.Markup as IShapeControl).Paint = redo.paint; |
|
6606 |
} |
|
6607 |
comment.Add(item.Markup); |
|
6608 |
} |
|
6609 |
final = new AdornerFinal(comment); |
|
6610 |
SelectLayer.Children.Add(final); |
|
6611 |
} |
|
6612 |
break; |
|
6613 |
} |
|
6614 |
|
|
6615 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
|
6616 |
{ |
|
6617 |
i.IsUndo = false; |
|
6618 |
}); |
|
6619 |
} |
|
6620 |
|
|
6621 | 6344 |
private void Comment_Move(object sender, MouseButtonEventArgs e) |
6622 | 6345 |
{ |
6623 | 6346 |
string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID; |
내보내기 Unified diff