public PreferencesController() : base(NSObject.AllocAndInitInstance("PreferencesController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("Preferences"), this); Unused.Value = window().setFrameAutosaveName(NSString.Create("preferences window")); m_tabs = new IBOutlet<NSTabView>(this, "tabs"); this["monoRoot"].Call("setDoubleAction:", new Selector("changeMonoRoot:")); m_contents = new IBOutlet<NSTableView>(this, "contents"); m_contents.Value.setDelegate(this); m_contents.Value.setDataSource(this); NSText text = this["globalIgnores"].To<NSText>(); text.setDelegate(this); DoInitFontButton("errors"); DoInitFontButton("transcript command"); DoInitFontButton("transcript stdout"); DoInitFontButton("transcript stderr"); DoInitWell("text default"); DoInitWell("text spaces"); DoInitWell("text tabs"); DoInitWell("selected line"); DoInitWell("transcript"); DoInitWell("errors"); DoInitWell("args"); this["globsTable"].Call("reload"); // TODO: for some reason our table isn't created until we call a method on it... ActiveObjects.Add(this); }
public TextController(string bossName) : base(NSObject.AllocAndInitInstance("TextController")) { m_boss = ObjectModel.Create(bossName); Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("text-editor"), this); m_textView = new IBOutlet<NSTextView>(this, "textView"); m_lineLabel = new IBOutlet<NSButton>(this, "lineLabel"); m_decPopup = new IBOutlet<NSPopUpButton>(this, "decsPopup"); m_scrollView = new IBOutlet<NSScrollView>(this, "scrollView"); m_restorer = new RestoreViewState(this); var wind = m_boss.Get<IWindow>(); wind.Window = window(); m_applier = new ApplyStyles(this, m_textView.Value); DoSetTextOptions(); Broadcaster.Register("text default color changed", this); Broadcaster.Register("languages changed", this); Broadcaster.Register("directory prefs changed", this); DoUpdateDefaultColor(string.Empty, null); m_textView.Value.Call("onOpened:", this); ActiveObjects.Add(this); }
public GetTextController() : base(NSObject.AllocAndInitInstance("GetTextController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("get-text"), this); Unused.Value = window().setFrameAutosaveName(NSString.Create("get-text window")); m_text = new IBOutlet<NSTextView>(this, "text"); }
protected BaseFindController(IntPtr instance, string nibName) : base(instance) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create(nibName), this); m_findBox = new IBOutlet<NSComboBox>(this, "findBox"); m_findEnabled = new IBOutlet<NSNumber>(this, "findEnabled"); m_findEnabled.Value = NSNumber.Create(false); m_replaceEnabled = new IBOutlet<NSNumber>(this, "replaceEnabled"); m_replaceEnabled.Value = NSNumber.Create(false); m_findText = new IBOutlet<NSString>(this, "findText"); m_replaceText = new IBOutlet<NSString>(this, "replaceText"); m_withinText = new IBOutlet<NSString>(this, "withinText"); m_caseSensitive = new IBOutlet<NSNumber>(this, "caseSensitive"); m_matchWords = new IBOutlet<NSNumber>(this, "matchWords"); m_useRegex = new IBOutlet<NSNumber>(this, "useRegex"); m_findList = new IBOutlet<NSMutableArray>(this, "findList"); this.willChangeValueForKey(NSString.Create("findList")); m_findList.Value = NSMutableArray.Create(); this.didChangeValueForKey(NSString.Create("findList")); m_replaceList = new IBOutlet<NSMutableArray>(this, "replaceList"); this.willChangeValueForKey(NSString.Create("replaceList")); m_replaceList.Value = NSMutableArray.Create(); this.didChangeValueForKey(NSString.Create("replaceList")); m_withinList = new IBOutlet<NSMutableArray>(this, "withinList"); NSMutableArray items = NSMutableArray.Create(); items.addObject(NSString.Create(Constants.Ellipsis)); // note that we can't do this within IB because we have bound the list items.addObject(NSString.Create("\"" + Constants.Ellipsis + "\"")); items.addObject(NSString.Create("@\"" + Constants.Ellipsis + "\"")); items.addObject(NSString.Create("(" + Constants.Ellipsis + ")")); items.addObject(NSString.Create("//" + Constants.Ellipsis)); items.addObject(NSString.Create("/*" + Constants.Ellipsis + "*/")); items.addObject(NSString.Create("<!--" + Constants.Ellipsis + "-->")); this.willChangeValueForKey(NSString.Create("withinList")); m_withinList.Value = items; this.didChangeValueForKey(NSString.Create("withinList")); this.willChangeValueForKey(NSString.Create("withinText")); m_withinText.Value = NSString.Create(Constants.Ellipsis); this.didChangeValueForKey(NSString.Create("withinText")); this.addObserver_forKeyPath_options_context( this, NSString.Create("findText"), 0, IntPtr.Zero); this.addObserver_forKeyPath_options_context( this, NSString.Create("replaceText"), 0, IntPtr.Zero); NSNotificationCenter.defaultCenter().addObserver_selector_name_object( // note that the controller doesn't go away so we don't bother removing ourself this, "mainWindowChanged:", Externs.NSWindowDidBecomeMainNotification, null); NSNotificationCenter.defaultCenter().addObserver_selector_name_object( this, "mainWindowChanged:", Externs.NSWindowDidResignMainNotification, null); }
public CompletionsController() : base(NSObject.AllocAndInitInstance("CompletionsController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("completions"), this); Unused.Value = window().setFrameAutosaveName(NSString.Create("auto-complete window")); m_table = new IBOutlet<CompletionsTable>(this, "table"); m_label = new IBOutlet<NSTextField>(this, "label"); ActiveObjects.Add(this); }
public GetStringController() : base(NSObject.AllocAndInitInstance("GetStringController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("get-string"), this); Unused.Value = window().setFrameAutosaveName(NSString.Create("get-string window")); m_okButton = new IBOutlet<NSButton>(this, "okButton"); m_text = new IBOutlet<NSTextField>(this, "text"); m_label = new IBOutlet<NSTextField>(this, "label"); m_text.Value.setDelegate(this); }
private DirPrefsController(IntPtr instance) : base(instance) { m_sheet = new IBOutlet<NSWindow>(this, "sheet"); m_ignoredTargets = new IBOutlet<NSTextField>(this, "ignoredTargets"); m_ignoredItems = new IBOutlet<NSTextField>(this, "ignoredItems"); m_addSpace = new IBOutlet<NSButton>(this, "addSpace"); m_addBraceLine = new IBOutlet<NSButton>(this, "addBraceLine"); m_useTabs = new IBOutlet<NSButton>(this, "useTabs"); m_numSpaces = new IBOutlet<NSTextField>(this, "numSpaces"); ActiveObjects.Add(this); }
public FindInFilesOptionsController(FindInFilesController find) : base(NSObject.AllocAndInitInstance("FindInFilesOptionsController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("find-in-files-options"), this); m_find = find; m_canRemove = new IBOutlet<NSNumber>(this, "canRemove"); this.willChangeValueForKey(NSString.Create("canRemove")); m_canRemove.Value = NSNumber.Create(true); this.didChangeValueForKey(NSString.Create("canRemove")); m_dirsTable = new IBOutlet<NSTableView>(this, "dirsTable"); m_dirsTable.Value.setDelegate(this); Unused.Value = window().setFrameAutosaveName(NSString.Create("find in files options panel")); }
public FindInFilesController() : base(NSObject.AllocAndInitInstance("FindInFilesController"), "find-in-files") { Unused.Value = window().setFrameAutosaveName(NSString.Create("find in files window")); m_include = new IBOutlet<NSString>(this, "include"); m_exclude = new IBOutlet<NSString>(this, "exclude"); NSUserDefaults defaults = NSUserDefaults.standardUserDefaults(); NSString defaultIncludes = defaults.stringForKey(NSString.Create("default include glob")); m_includeList = new IBOutlet<NSMutableArray>(this, "includeList"); this.willChangeValueForKey(NSString.Create("includeList")); NSMutableArray includes = NSMutableArray.Create(); includes.addObject(defaultIncludes); includes.addObject(NSString.Create("*.cs *.cpp *.c *.hpp *.h *.m *.rs *.js")); includes.addObject(NSString.Create("*.py *.sh *.rb *.pl")); includes.addObject(NSString.Create("Makefile Makefile.am Make.shared *.make *.mk SConstruct SConscript wscript wscript_build *.rc")); // TODO: might want some sort of pref for these includes.addObject(NSString.Create("*.xml *.xsd *.xsdl *.xsl *.schema *.config *.plist *.dtd *.html *.css")); m_includeList.Value = includes; this.didChangeValueForKey(NSString.Create("includeList")); m_excludeList = new IBOutlet<NSMutableArray>(this, "excludeList"); this.willChangeValueForKey(NSString.Create("excludeList")); m_excludeList.Value = NSMutableArray.Create(); this.didChangeValueForKey(NSString.Create("excludeList")); m_dirPopup = new IBOutlet<NSPopUpButton>(this, "dirPopup"); // pulldown buttons probably look a bit better but I was never able to get them working correctly string dir = DoGetInitialDirectory(); AddDefaultDirs(); DoAddOpenDirs(); if (dir != null) { NSString name = NSString.Create(dir); m_dirPopup.Value.addItemWithTitle(name); m_dirPopup.Value.setTitle(name); } this.willChangeValueForKey(NSString.Create("include")); m_include.Value = defaultIncludes; this.didChangeValueForKey(NSString.Create("include")); this.addObserver_forKeyPath_options_context( this, NSString.Create("include"), 0, IntPtr.Zero); this.addObserver_forKeyPath_options_context( this, NSString.Create("exclude"), 0, IntPtr.Zero); Broadcaster.Register("opened directory", this); }
public FindProgressController(IFindProgress find) : base(NSObject.AllocAndInitInstance("FindProgressController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("find-progress"), this); m_find = find; m_bar = new IBOutlet<NSProgressIndicator>(this, "bar"); m_text = new IBOutlet<NSTextField>(this, "text"); window().setDelegate(this); window().setTitle(NSString.Create(m_find.Title)); Unused.Value = window().setFrameAutosaveName(NSString.Create("find progress window")); window().makeKeyAndOrderFront(null); ms_controllers.Add(this); NSApplication.sharedApplication().BeginInvoke(this.DoUpdate, TimeSpan.FromMilliseconds(50)); }
public TranscriptController(Boss boss) : base(NSObject.AllocAndInitInstance("TranscriptController")) { Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("transcript"), this); m_boss = boss; m_output = new IBOutlet<NSTextView>(this, "output"); Unused.Value = window().setFrameAutosaveName(NSString.Create("transcript window")); m_output.Value.textStorage().setAttributedString(NSAttributedString.Create()); foreach (string name in new[]{"transcript command font changed", "transcript stdout font changed", "transcript stderr font changed"}) { Broadcaster.Register(name, this); m_attributes.Add(name, NSMutableDictionary.Create().Retain()); DoUpdateFont(name, null); } Broadcaster.Register("transcript color changed", this); DoUpdateBackgroundColor(string.Empty, null); ActiveObjects.Add(this); }
public Subclass1(IntPtr instance) : base(instance) { m_data = new IBOutlet <NSString>(this, "myData"); }
public Subclass1(IntPtr instance) : base(instance) { m_data = new IBOutlet<NSString>(this, "myData"); }
private void DoInitWell(string name) { NSUserDefaults defaults = NSUserDefaults.standardUserDefaults(); var data = defaults.objectForKey(NSString.Create(name + " color")).To<NSData>(); var color = NSUnarchiver.unarchiveObjectWithData(data).To<NSColor>(); if (name.StartsWith("text ")) name = name.Substring("text ".Length); else if (name.StartsWith("selected ")) name = name.Substring("selected ".Length); var well = new IBOutlet<NSColorWell>(this, name + "Well"); well.Value.setColor(color); }
public DirectoryController(string path) : base(NSObject.AllocAndInitInstance("DirectoryController")) { m_boss = ObjectModel.Create("DirectoryEditor"); m_path = path; m_dirStyler = new DirectoryItemStyler(path); Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("directory-editor"), this); m_table = new IBOutlet<NSOutlineView>(this, "table").Value; m_targets = new IBOutlet<NSPopUpButton>(this, "targets").Value; m_prefs = new IBOutlet<DirPrefsController>(this, "prefsController"); m_name = System.IO.Path.GetFileName(path); window().setTitle(NSString.Create(m_name)); Unused.Value = window().setFrameAutosaveName(NSString.Create(window().title().ToString() + " editor")); window().makeKeyAndOrderFront(this); m_table.setDoubleAction("doubleClicked:"); m_table.setTarget(this); var wind = m_boss.Get<IWindow>(); wind.Window = window(); m_builder = new GenericBuilder(path); m_targets.removeAllItems(); if (m_builder.CanBuild) { var handler = m_boss.Get<IMenuHandler>(); handler.Register(this, 50, this.DoBuild, this.DoBuildEnabled); handler.Register(this, 51, this.DoBuildVariables, this.DoHaveBuilder); handler.Register(this, 52, this.DoBuildFlags, this.DoHaveBuilder); handler.Register(this, 599, () => m_builder.Cancel(), this.DoCancelEnabled); handler.Register(this, 1000, this.DoShowPrefs); DoLoadPrefs(path); Broadcaster.Register("global ignores changed", this); Broadcaster.Register("finished building", this); DoUpdateTargets(string.Empty, null); } else DoLoadPrefs(path); m_root = new FolderItem(m_path, m_dirStyler, this); m_table.reloadData(); m_watcher = DoCreateWatcher(path); if (m_watcher != null) m_watcher.Changed += this.DoDirChanged; // m_watcher = new FileSystemWatcher(path); // m_watcher.IncludeSubdirectories = true; // m_watcher.Created += this.DoDirChanged; // m_watcher.Deleted += this.DoDirChanged; // m_watcher.Renamed += this.DoDirChanged; foreach (IOpened open in m_boss.GetRepeated<IOpened>()) { open.Opened(); } Broadcaster.Invoke("opened directory", m_boss); ActiveObjects.Add(this); }