Example #1
0
 static void Delete(IEnumerable <Core.IEntry> self, Ctrl.IContext con)
 {
     // 注:self.ToArray() してシーケンスをコピーしておかないと Remove で落ちる
     foreach (var item in self.ToArray())
     {
         item.Owner.Remove(item.ID);
     }
 }
Example #2
0
 //[Ctrl.Command( "表示/非表示" )]
 static void ShowHide(Graphics.ISceneDecorator deco, Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.IsChecked = deco.Visible; return;
     }
     deco.Visible = !deco.Visible;
 }
Example #3
0
                public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con)
                {
                    bool runnable = Core.Progress.IsBusy ? false : con.Document.History.CanRedo;

                    return(new Ctrl.CommandOption {
                        QueryRunnable = runnable
                    });
                }
Example #4
0
                public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con)
                {
                    bool runnable = Core.Progress.IsBusy ? false : CoreUT.UnhandledErrorReport != null;

                    return(new Ctrl.CommandOption {
                        QueryRunnable = runnable
                    });
                }
Example #5
0
                public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con)
                {
                    bool runnable = Core.Progress.IsBusy || Ctrl.Current.Driver.IsActive;

                    return(new Ctrl.CommandOption {
                        QueryRunnable = runnable
                    });
                }
Example #6
0
 static void RenderFrontFace(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.IsChecked = !Gui.ViewSetting.Current.Backside;
     }
     else
     {
         Gui.ViewSetting.Current.Backside = false;
     }
 }
Example #7
0
 static void Next(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.QueryRunnable = SI.DocumentViews.ActiveHistory.HasNext;
     }
     else
     {
         SI.DocumentViews.ActiveHistory.Next();
     }
 }
Example #8
0
 static void Perspective(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.IsChecked = Gui.ViewSetting.Current.Perspective;
     }
     else
     {
         Gui.ViewSetting.Current.Perspective = true;
     }
 }
Example #9
0
 static void ShowRuler(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.IsChecked = Gui.ViewSetting.Current.ShowRuler;
     }
     else
     {
         Gui.ViewSetting.Current.ShowRuler = !Gui.ViewSetting.Current.ShowRuler;
     }
 }
Example #10
0
 static void Delete(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.QueryRunnable = (SI.SelectedEntries.Count != 0);
     }
     else
     {
         Menu.Delete(SI.SelectedEntries, con);
     }
 }
Example #11
0
                public ViewOperation(Ctrl.IContext con, Graphics.ViewOperations operation)
                    : base(con)
                {
                    this.OperationType = operation;
                    var viewop  = con.View.Operation as Graphics.StandardViewOperation;
                    var binding = new Graphics.ViewOperationBinding(operation, MouseButtons.Left, Keys.None);

                    this.Entered += (sender, e) => viewop.TemporaryBindings.Reset(binding);
                    this.Exited  += (sender, e) => viewop.TemporaryBindings.Clear();
                    this.Cursor   = GetCursor(operation);
                }
Example #12
0
 static void Capping(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.IsChecked = Gui.ClipPlane.Capping;
     }
     else
     {
         Gui.ClipPlane.Capping = !Gui.ClipPlane.Capping;
     }
 }
Example #13
0
 Core.IEntryCollection GetDestination(Ctrl.IContext con)
 {
     if (_target == typeof(Core.IEntry))
     {
         return(con.Selected.Entries);
     }
     if (_target == typeof(Core.Document))
     {
         return(con.Document.Entries);
     }
     return(con.ActiveEntries);
 }
 void Import(string filename, Hix.IFormatImporter importer, Ctrl.IContext con)
 {
     using (var progress = SI.PushProgress("importing: " + filename)) {
         var entry = this.GetDestination(con).Put(null);
         using (var stream = File.OpenRead(filename)) {
             progress.Step(0.8);
             importer.Import(stream, entry);
         }
         entry.Caption = Path.GetFileNameWithoutExtension(filename);
         progress.Step(0.2);
         con.View.Fit();
     }
 }
Example #15
0
            static void ZoomToMousePosition(Ctrl.IContext con, Ctrl.CommandOption opt)
            {
                var viewop = con.View.Operation as Graphics.StandardViewOperation;

                if (opt.QueryRunnable)
                {
                    opt.QueryRunnable = (viewop != null);
                    opt.IsChecked     = (viewop != null && viewop.ZoomToMousePosition);
                }
                else if (viewop != null)
                {
                    viewop.ZoomToMousePosition = !viewop.ZoomToMousePosition;
                }
            }
Example #16
0
 static void CheckInvariants(Ctrl.IContext con)
 {
     Testing.ITestReport report = new Testing.ConsoleReport();
     Testing.TestRegistry.RunChecks(con.Document, report);
     Testing.TestRegistry.RunChecks(con.Document.Entries, report);
     foreach (Core.IEntry entry in con.Document.Entries.GetEntriesRecursive())
     {
         Testing.TestRegistry.RunChecks(entry, report);
         Testing.TestRegistry.RunChecks(entry.Entries, report);
         Testing.TestRegistry.RunChecks(entry.Entity, report);
         foreach (object element in entry.Elements)
         {
             Testing.TestRegistry.RunChecks(element, report);
         }
     }
 }
Example #17
0
 static void OnOff(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     if (opt.QueryRunnable)
     {
         opt.IsChecked = (Gui.ClipPlane.Find(SI.DocumentViews) != null);
     }
     else
     {
         if (Gui.ClipPlane.Find(SI.DocumentViews) != null)
         {
             Gui.ClipPlane.Remove(SI.DocumentViews);
         }
         else
         {
             Gui.ClipPlane.Get(SI.DocumentViews);
         }
     }
 }
Example #18
0
            static Ctrl.IOperation RunViewOperation(
                Graphics.ViewOperations operation, Ctrl.IContext con, Ctrl.CommandOption opt)
            {
                var viewop = con.View.Operation as Graphics.StandardViewOperation;

                if (opt.QueryRunnable)
                {
                    opt.QueryRunnable = (viewop != null);
                    opt.IsChecked     = (viewop.TemporaryBindings.Find(operation) != null);
                    return(null);
                }
                if (SI.Driver.ActiveOperation is ViewOperation &&
                    ((ViewOperation)SI.Driver.ActiveOperation).OperationType == operation)
                {
                    SI.Driver.Abort();
                    return(null);
                }
                return(new ViewOperation(con, operation));
            }
Example #19
0
 public void Run(object target, Ctrl.IContext context)
 {
     if (Core.Progress.IsBusy)
     {
         Core.Progress.PostAbort();
     }
     else if (Ctrl.Current.Driver.IsActive)
     {
         Ctrl.Current.Driver.Abort();
         if (Ctrl.Current.Document.History.CanCancel)
         {
             context.Document.History.Cancel();
         }
         else
         {
             Core.Builder.Run();
         }
         Core.Document.Current.SelectedEntry = null;
         context.View.Invalidate();
     }
 }
Example #20
0
 override public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con)
 {
     return(new Ctrl.CommandOption {
         QueryRunnable = !Core.Progress.IsBusy
     });
 }
Example #21
0
 static void View(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     ToggleClipPlane(Gui.ClipDirections.View, opt);
 }
Example #22
0
 public void Run(object target, Ctrl.IContext context)
 {
     context.Document.History.Redo();
     context.View.Invalidate();
 }
Example #23
0
 public void Run(object target, Ctrl.IContext context)
 {
     Core.Builder.RunRebuild();
 }
Example #24
0
 static void PolygonStyleFaceEdge(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     SetPolygonStyle(opt, Graphics.PolygonStyles.Face | Graphics.PolygonStyles.Edge);
 }
Example #25
0
 static void Activate(Core.IEntry self, Ctrl.IContext con)
 {
     con.Document.ActiveEntries = self.Entries;
 }
Example #26
0
 static void PlusY(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     ToggleClipPlane(Gui.ClipDirections.PlusY, opt);
 }
Example #27
0
 static Ctrl.IOperation Spin(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     return(RunViewOperation(Graphics.ViewOperations.Spin, con, opt));
 }
Example #28
0
 static void MinusZ(Ctrl.IContext con, Ctrl.CommandOption opt)
 {
     ToggleClipPlane(Gui.ClipDirections.MinusZ, opt);
 }