개정판 684ef11c
issue #719 AutoCAD 저장 작업 중
Change-Id: I46dfcaa8fb3b15907afe75a1e17ae643bef64f3f
KCOM/Events/Implementation/TopMenuEvent.cs | ||
---|---|---|
15 | 15 |
using System.Windows.Media; |
16 | 16 |
using System.Windows.Media.Imaging; |
17 | 17 |
using Telerik.Windows.Controls; |
18 |
using IKCOM; |
|
19 |
using Microsoft.Win32; |
|
20 |
using System.IO; |
|
21 |
using System.Reflection; |
|
22 |
using System.Windows.Controls.Primitives; |
|
18 | 23 |
|
19 | 24 |
namespace KCOM.Views |
20 | 25 |
{ |
... | ... | |
761 | 766 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize); |
762 | 767 |
} |
763 | 768 |
break; |
769 |
case ("InsideWhiteControl"): |
|
770 |
{ |
|
771 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize; |
|
772 |
} |
|
773 |
break; |
|
774 |
case ("OverlapWhiteControl"): |
|
775 |
{ |
|
776 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize; |
|
777 |
} |
|
778 |
break; |
|
779 |
case ("ClipWhiteControl"): |
|
780 |
{ |
|
781 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize; |
|
782 |
} |
|
783 |
break; |
|
784 |
case ("CoordinateControl"): |
|
785 |
{ |
|
786 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize |
|
787 |
} |
|
788 |
break; |
|
764 | 789 |
} |
765 | 790 |
|
766 | 791 |
|
... | ... | |
960 | 985 |
{ |
961 | 986 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData; |
962 | 987 |
} |
963 |
break; |
|
988 |
break; |
|
989 |
case ("InsideWhiteControl"): |
|
990 |
{ |
|
991 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData; |
|
992 |
} |
|
993 |
break; |
|
994 |
case ("OverlapWhiteControl"): |
|
995 |
{ |
|
996 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData; |
|
997 |
} |
|
998 |
break; |
|
999 |
case ("ClipWhiteControl"): |
|
1000 |
{ |
|
1001 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData; |
|
1002 |
} |
|
1003 |
break; |
|
1004 |
case ("CoordinateControl"): |
|
1005 |
{ |
|
1006 |
(InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData; |
|
1007 |
} |
|
1008 |
break; |
|
964 | 1009 |
} |
965 | 1010 |
|
966 | 1011 |
multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo; |
... | ... | |
2312 | 2357 |
(Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture; |
2313 | 2358 |
break; |
2314 | 2359 |
#endregion |
2360 |
#region Cad |
|
2361 |
case "Inside": |
|
2362 |
//instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing; |
|
2363 |
//instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false; |
|
2364 |
Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite"; |
|
2365 |
instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite; |
|
2366 |
break; |
|
2367 |
case "Overlap": |
|
2368 |
//instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing; |
|
2369 |
//instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false; |
|
2370 |
Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite"; |
|
2371 |
instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite; |
|
2372 |
break; |
|
2373 |
case "Clip": |
|
2374 |
//instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing; |
|
2375 |
//instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false; |
|
2376 |
Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite"; |
|
2377 |
instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite; |
|
2378 |
break; |
|
2379 |
case "CadExport": |
|
2380 |
if (isClosed) |
|
2381 |
{ |
|
2382 |
//토글 및 마우스 상태 초기화 |
|
2383 |
var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>(); |
|
2384 |
foreach (var togle in toggleList) |
|
2385 |
{ |
|
2386 |
togle.IsChecked = false; |
|
2387 |
} |
|
2388 |
this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
|
2389 |
|
|
2390 |
isClosed = false; |
|
2391 |
//Control 파일 먼저 생성 |
|
2392 |
CollapsedButton_Click(); |
|
2393 |
CadViewer check = new CadViewer(); |
|
2394 |
check.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
2395 |
check.Title = "Export Viewer"; |
|
2396 |
//check.Topmost = true; |
|
2397 |
check.Show(); |
|
2398 |
check.Closed += Check_Closed; |
|
2399 |
instanceToggle.IsChecked = false; |
|
2400 |
} |
|
2401 |
break; |
|
2402 |
case "CadViewer": |
|
2403 |
if (isClosed) |
|
2404 |
{ |
|
2405 |
//토글 및 마우스 상태 초기화 |
|
2406 |
var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>(); |
|
2407 |
foreach (var togle in toggleList) |
|
2408 |
{ |
|
2409 |
togle.IsChecked = false; |
|
2410 |
} |
|
2411 |
this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
|
2412 |
|
|
2413 |
isClosed = false; |
|
2414 |
CadResultViewer check = new CadResultViewer(); |
|
2415 |
check.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
2416 |
check.Title = "Viewer"; |
|
2417 |
check.Show(); |
|
2418 |
|
|
2419 |
check.Closed += Check_Closed; |
|
2420 |
|
|
2421 |
} |
|
2422 |
break; |
|
2423 |
#endregion |
|
2315 | 2424 |
default: |
2316 | 2425 |
break; |
2317 | 2426 |
} |
... | ... | |
2354 | 2463 |
|
2355 | 2464 |
} |
2356 | 2465 |
|
2466 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
2467 |
CommentUserInfo currentControl { get; set; } |
|
2468 |
private Point GetSquareEndPoint(Point StartP, Point EndP) |
|
2469 |
{ |
|
2470 |
Point Return_Point = new Point(); |
|
2471 |
double dx = EndP.X - StartP.X; |
|
2472 |
double dy = EndP.Y - StartP.Y; |
|
2473 |
double length; |
|
2474 |
length = Math.Max(Math.Abs(dx), Math.Abs(dy)); |
|
2475 |
Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length; |
|
2476 |
Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length; |
|
2477 |
return Return_Point; |
|
2478 |
} |
|
2479 |
private void Check_Closed(object sender, EventArgs e) |
|
2480 |
{ |
|
2481 |
isClosed = true; |
|
2482 |
//this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true; |
|
2483 |
//토글 및 마우스 상태 초기화 |
|
2484 |
var toggleList = this.Parent.ChildrenOfType<RadToggleButton>(); |
|
2485 |
foreach (var togle in toggleList) |
|
2486 |
{ |
|
2487 |
togle.IsChecked = false; |
|
2488 |
} |
|
2489 |
this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
|
2490 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
|
2491 |
|
|
2492 |
} |
|
2493 |
|
|
2494 |
/* public class test |
|
2495 |
{ |
|
2496 |
public double width { get; set; } |
|
2497 |
public double height { get; set; } |
|
2498 |
} |
|
2499 |
*/ |
|
2500 |
private void CollapsedButton_Click() |
|
2501 |
{ |
|
2502 |
this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장 |
|
2503 |
|
|
2504 |
MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
|
2505 |
string[] data = new string[0]; |
|
2506 |
|
|
2507 |
int cnt = 0; |
|
2508 |
var menu = this.ParentOfType<MainWindow>().dzMainMenu; |
|
2509 |
|
|
2510 |
List<MarkupInfoItem> gridSelectionItem = menu.gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
|
2511 |
|
|
2512 |
foreach (var item in gridSelectionItem) |
|
2513 |
{ |
|
2514 |
if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null)) |
|
2515 |
{ |
|
2516 |
var instance = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber && |
|
2517 |
d.MarkupInfoID == item.MarkupInfoID).ToList(); |
|
2518 |
data = new string[instance.Count]; |
|
2519 |
foreach (var markup in instance) |
|
2520 |
{ |
|
2521 |
data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data); |
|
2522 |
} |
|
2523 |
} |
|
2524 |
} |
|
2525 |
|
|
2526 |
if (data != null) |
|
2527 |
{ |
|
2528 |
string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad"); |
|
2529 |
string FileName = FilePath + "\\commentstring.json"; // Default file name |
|
2530 |
if (!File.Exists(FilePath)) |
|
2531 |
{ |
|
2532 |
Directory.CreateDirectory(FilePath); |
|
2533 |
} |
|
2534 |
|
|
2535 |
if (!string.IsNullOrEmpty(FileName)) |
|
2536 |
{ |
|
2537 |
// File.WriteAllText(SaveDig.FileName, data); |
|
2538 |
File.WriteAllLines(FileName, data); |
|
2539 |
} |
|
2540 |
} |
|
2541 |
} |
|
2542 |
|
|
2543 |
private double minHeight; |
|
2544 |
private double minWidth; |
|
2545 |
|
|
2546 |
private double maxHeight; |
|
2547 |
private double maxWidth; |
|
2548 |
|
|
2549 |
public bool CanVResize { get; private set; } |
|
2550 |
public bool CanHResize { get; private set; } |
|
2551 |
|
|
2552 |
public void DesignerComponent(FrameworkElement content) |
|
2553 |
{ |
|
2554 |
this.InitializeComponent(); |
|
2555 |
|
|
2556 |
if (!double.IsNaN(content.Width)) |
|
2557 |
{ |
|
2558 |
CanHResize = false; |
|
2559 |
this.Width = content.Width; |
|
2560 |
} |
|
2561 |
else |
|
2562 |
{ |
|
2563 |
CanHResize = true; |
|
2564 |
this.Width = 23.0; |
|
2565 |
} |
|
2566 |
if (!double.IsNaN(content.Height)) |
|
2567 |
{ |
|
2568 |
CanVResize = false; |
|
2569 |
this.Height = content.Height; ; |
|
2570 |
} |
|
2571 |
else |
|
2572 |
{ |
|
2573 |
CanVResize = true; |
|
2574 |
this.Height = 23.0; |
|
2575 |
} |
|
2576 |
|
|
2577 |
minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth; |
|
2578 |
minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight; |
|
2579 |
maxWidth = content.MaxWidth; |
|
2580 |
maxHeight = content.MaxHeight; |
|
2581 |
|
|
2582 |
double top = (double)content.GetValue(Canvas.TopProperty); |
|
2583 |
if (double.IsNaN(top)) |
|
2584 |
top = 0.0; |
|
2585 |
double left = (double)content.GetValue(Canvas.LeftProperty); |
|
2586 |
if (double.IsNaN(left)) |
|
2587 |
left = 0.0; |
|
2588 |
SetValue(Canvas.TopProperty, top); |
|
2589 |
SetValue(Canvas.LeftProperty, left); |
|
2590 |
|
|
2591 |
//Set the actual content. Note that "Content" property is a new property. See below |
|
2592 |
this.Content = content; |
|
2593 |
} |
|
2594 |
private void Thumb_DragDelta(object sender, DragDeltaEventArgs e) |
|
2595 |
{ |
|
2596 |
string name = ((Thumb)sender).Name; |
|
2597 |
if (name.Contains("Top")) |
|
2598 |
{ |
|
2599 |
double newHeight = this.Height - e.VerticalChange; |
|
2600 |
if (newHeight >= minHeight && newHeight <= maxHeight) |
|
2601 |
{ |
|
2602 |
this.Height = newHeight; |
|
2603 |
SetValue(Canvas.TopProperty, |
|
2604 |
(double)GetValue(Canvas.TopProperty) + e.VerticalChange); |
|
2605 |
} |
|
2606 |
} |
|
2607 |
if (name.Contains("Right")) |
|
2608 |
{ |
|
2609 |
double newWidth = this.Width + e.HorizontalChange; |
|
2610 |
if (newWidth >= minWidth && newWidth <= maxWidth) |
|
2611 |
this.Width = newWidth; |
|
2612 |
} |
|
2613 |
if (name.Contains("Bottom")) |
|
2614 |
{ |
|
2615 |
double newHeight = this.Height + e.VerticalChange; |
|
2616 |
if (newHeight >= minHeight && newHeight <= maxHeight) |
|
2617 |
this.Height = newHeight; |
|
2618 |
} |
|
2619 |
if (name.Contains("Left")) |
|
2620 |
{ |
|
2621 |
double newWidth = this.Width - e.HorizontalChange; |
|
2622 |
if (newWidth >= minWidth && newWidth <= maxWidth) |
|
2623 |
{ |
|
2624 |
this.Width = newWidth; |
|
2625 |
SetValue(Canvas.LeftProperty, |
|
2626 |
(double)GetValue(Canvas.LeftProperty) + e.HorizontalChange); |
|
2627 |
} |
|
2628 |
} |
|
2629 |
} |
|
2630 |
|
|
2631 |
private void drawControlBorder(object sender) |
|
2632 |
{ |
|
2633 |
System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender; |
|
2634 |
} |
|
2635 |
|
|
2636 |
private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e) |
|
2637 |
{ |
|
2638 |
System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender; |
|
2639 |
if (designerItem != null) |
|
2640 |
{ |
|
2641 |
double deltaVertical, deltaHorizontal; |
|
2642 |
|
|
2643 |
switch (VerticalAlignment) |
|
2644 |
{ |
|
2645 |
case VerticalAlignment.Bottom: |
|
2646 |
deltaVertical = designerItem.ActualHeight - designerItem.MinHeight; |
|
2647 |
designerItem.Height -= deltaVertical; |
|
2648 |
break; |
|
2649 |
case VerticalAlignment.Top: |
|
2650 |
deltaVertical = designerItem.ActualHeight - designerItem.MinHeight; |
|
2651 |
Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical); |
|
2652 |
designerItem.Height -= deltaVertical; |
|
2653 |
break; |
|
2654 |
default: |
|
2655 |
break; |
|
2656 |
} |
|
2657 |
|
|
2658 |
switch (HorizontalAlignment) |
|
2659 |
{ |
|
2660 |
case HorizontalAlignment.Left: |
|
2661 |
deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth; |
|
2662 |
Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal); |
|
2663 |
designerItem.Width -= deltaHorizontal; |
|
2664 |
break; |
|
2665 |
case HorizontalAlignment.Right: |
|
2666 |
deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth; |
|
2667 |
designerItem.Width -= deltaHorizontal; |
|
2668 |
break; |
|
2669 |
default: |
|
2670 |
break; |
|
2671 |
} |
|
2672 |
} |
|
2673 |
e.Handled = true; |
|
2674 |
} |
|
2675 |
|
|
2676 |
SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그 |
|
2677 |
|
|
2678 |
void ExportMethod() |
|
2679 |
{ |
|
2680 |
//FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png"); |
|
2681 |
SaveDig.Filter = "PDF file format|*.pdf"; |
|
2682 |
SaveDig.Title = "Save an DWG File"; |
|
2683 |
SaveDig.ShowDialog(); |
|
2684 |
} |
|
2685 |
|
|
2357 | 2686 |
private void cbAutoSave_Checked(object sender, RoutedEventArgs e) |
2358 | 2687 |
{ |
2359 | 2688 |
if (cbAutoSave.IsChecked == true) |
내보내기 Unified diff