static void Delete(IEnumerable <Core.IEntry> self, Ctrl.IContext con) { // 注:self.ToArray() してシーケンスをコピーしておかないと Remove で落ちる foreach (var item in self.ToArray()) { item.Owner.Remove(item.ID); } }
//[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; }
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 }); }
public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con) { bool runnable = Core.Progress.IsBusy ? false : CoreUT.UnhandledErrorReport != null; return(new Ctrl.CommandOption { QueryRunnable = runnable }); }
public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con) { bool runnable = Core.Progress.IsBusy || Ctrl.Current.Driver.IsActive; return(new Ctrl.CommandOption { QueryRunnable = runnable }); }
static void RenderFrontFace(Ctrl.IContext con, Ctrl.CommandOption opt) { if (opt.QueryRunnable) { opt.IsChecked = !Gui.ViewSetting.Current.Backside; } else { Gui.ViewSetting.Current.Backside = false; } }
static void Next(Ctrl.IContext con, Ctrl.CommandOption opt) { if (opt.QueryRunnable) { opt.QueryRunnable = SI.DocumentViews.ActiveHistory.HasNext; } else { SI.DocumentViews.ActiveHistory.Next(); } }
static void Perspective(Ctrl.IContext con, Ctrl.CommandOption opt) { if (opt.QueryRunnable) { opt.IsChecked = Gui.ViewSetting.Current.Perspective; } else { Gui.ViewSetting.Current.Perspective = true; } }
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; } }
static void Delete(Ctrl.IContext con, Ctrl.CommandOption opt) { if (opt.QueryRunnable) { opt.QueryRunnable = (SI.SelectedEntries.Count != 0); } else { Menu.Delete(SI.SelectedEntries, con); } }
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); }
static void Capping(Ctrl.IContext con, Ctrl.CommandOption opt) { if (opt.QueryRunnable) { opt.IsChecked = Gui.ClipPlane.Capping; } else { Gui.ClipPlane.Capping = !Gui.ClipPlane.Capping; } }
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(); } }
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; } }
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); } } }
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); } } }
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)); }
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(); } }
override public Ctrl.CommandOption QueryOption(object target, Ctrl.IContext con) { return(new Ctrl.CommandOption { QueryRunnable = !Core.Progress.IsBusy }); }
static void View(Ctrl.IContext con, Ctrl.CommandOption opt) { ToggleClipPlane(Gui.ClipDirections.View, opt); }
public void Run(object target, Ctrl.IContext context) { context.Document.History.Redo(); context.View.Invalidate(); }
public void Run(object target, Ctrl.IContext context) { Core.Builder.RunRebuild(); }
static void PolygonStyleFaceEdge(Ctrl.IContext con, Ctrl.CommandOption opt) { SetPolygonStyle(opt, Graphics.PolygonStyles.Face | Graphics.PolygonStyles.Edge); }
static void Activate(Core.IEntry self, Ctrl.IContext con) { con.Document.ActiveEntries = self.Entries; }
static void PlusY(Ctrl.IContext con, Ctrl.CommandOption opt) { ToggleClipPlane(Gui.ClipDirections.PlusY, opt); }
static Ctrl.IOperation Spin(Ctrl.IContext con, Ctrl.CommandOption opt) { return(RunViewOperation(Graphics.ViewOperations.Spin, con, opt)); }
static void MinusZ(Ctrl.IContext con, Ctrl.CommandOption opt) { ToggleClipPlane(Gui.ClipDirections.MinusZ, opt); }