<commit_before><?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 
		 xmlns="weave.editors.*"
		 xmlns:ui="weave.ui.*"
		 label="{lang('Image Settings')}"
		 implements="weave.api.ui.ILinkableObjectEditor">
	<ui:Indent label="{lang('Image URL:')}">
		<mx:TextInput id="urlInput" width="100%"/>
		<mx:Button label="{lang('Open file')}" click="fileAttacher.browseAndAttachFile()"/>
	</ui:Indent>
	<ui:Paragraph>
		Enter data coordinates below. Width and height are optional.
	</ui:Paragraph>
	<ui:IndentTextInput id="xInput" label="{lang('X')}"/>
	<ui:IndentTextInput id="yInput" label="{lang('Y')}"/>
	<ui:IndentTextInput id="widthInput" label="{lang('Width')}"/>
	<ui:IndentTextInput id="heightInput" label="{lang('Height')}"/>
	<ui:Indent label="Alignment">
		<ui:AlignmentControl id="alignmentInput"/>
	</ui:Indent>
	<mx:Script>
		<![CDATA[
			import weave.api.WeaveAPI;
			import weave.api.core.ILinkableObject;
			import weave.api.getSessionState;
			import weave.api.linkBindableProperty;
			import weave.api.reportError;
			import weave.services.FileAttacher;
			import weave.ui.ControlPanel;
			import weave.ui.CustomContextMenuManager;
			import weave.ui.DraggablePanel;
			import weave.visualization.layers.PlotManager;
			import weave.visualization.plotters.SingleImagePlotter;
			import weave.visualization.tools.SimpleVisTool;
			
			private var _plotter:SingleImagePlotter = null;
			public function setTarget(object:ILinkableObject):void
			{
				_plotter = object as SingleImagePlotter;
			}
			public function hasPendingChanges():Boolean { return false; }
			public function applyChanges():void { }
			
			override protected function childrenCreated():void
			{
				super.childrenCreated();
				linkBindableProperty(_plotter.imageURL, urlInput, "text", 1000);
				linkBindableProperty(_plotter.dataX, xInput, "text");
				linkBindableProperty(_plotter.dataY, yInput, "text");
				linkBindableProperty(_plotter.dataWidth, widthInput, "text");
				linkBindableProperty(_plotter.dataHeight, heightInput, "text");
				linkBindableProperty(_plotter.horizontalAlign, alignmentInput, 'horizontalAlign');
				linkBindableProperty(_plotter.verticalAlign, alignmentInput, 'verticalAlign');
			}
			
			//----------------------------------------------
			
			private static var _contextMenuItem:ContextMenuItem = null;
			public static function createContextMenuItems(destination:DisplayObject):Boolean
			{
				if(!destination.hasOwnProperty("contextMenu") )
					return false;
				
				// Add a listener to this destination context menu for when it is opened
				var contextMenu:ContextMenu = destination["contextMenu"] as ContextMenu;
				contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, handleContextMenuOpened);
				_contextMenuItem = CustomContextMenuManager.createAndAddMenuItemToDestination("Add Marker", destination, handleAddMarker, "2.1 textBoxMenuItem");
				
				return true;
			}
			
			private static var tool:SimpleVisTool = null;
			private static var anchorPoint:Point = new Point();
			private static function handleContextMenuOpened(e:ContextMenuEvent):void
			{	
				tool = DraggablePanel.activePanel as SimpleVisTool;
				if (tool)
				{
					_contextMenuItem.enabled = true;
					anchorPoint.x = e.mouseTarget.stage.mouseX;
					anchorPoint.y = e.mouseTarget.stage.mouseY;
				}
				else
				{
					_contextMenuItem.enabled = false;
					tool = null;
				}
			}
			
			private static function handleAddMarker(e:ContextMenuEvent):void
			{
				if (tool)
				{
					var state:Object = getSessionState(tool.visualization);
					var pm:PlotManager = tool.visualization.plotManager;
					var name:String = pm.plotters.generateUniqueName("marker");
					var plotter:SingleImagePlotter = pm.plotters.requestObject(name, SingleImagePlotter, false);
					
					var localAnchorPoint:Point = tool.visualization.globalToLocal(anchorPoint);
					pm.zoomBounds.projectScreenToData(localAnchorPoint);
					
					plotter.dataX.value = localAnchorPoint.x;
					plotter.dataY.value = localAnchorPoint.y;
					
					ControlPanel.openEditor(plotter, [tool.visualization], [state]);
				}
			}
			private var fileAttacher:FileAttacher = new FileAttacher(this, [new FileFilter("Image", "*.png,*.jpg")], handleURL);
			private function handleURL(url:String):void
			{
				urlInput.text = url;
			}
		]]>
	</mx:Script>
</mx:VBox><commit_msg>fixed asdoc error<commit_after><?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 
		 xmlns="weave.editors.*"
		 xmlns:ui="weave.ui.*"
		 label="{lang('Image Settings')}"
		 implements="weave.api.ui.ILinkableObjectEditor">
	<ui:Indent label="{lang('Image URL:')}">
		<mx:TextInput id="urlInput" width="100%"/>
		<mx:Button label="{lang('Open file')}" click="fileAttacher.browseAndAttachFile()"/>
	</ui:Indent>
	<ui:Paragraph>
		Enter data coordinates below. Width and height are optional.
	</ui:Paragraph>
	<ui:IndentTextInput id="xInput" label="{lang('X')}"/>
	<ui:IndentTextInput id="yInput" label="{lang('Y')}"/>
	<ui:IndentTextInput id="widthInput" label="{lang('Width')}"/>
	<ui:IndentTextInput id="heightInput" label="{lang('Height')}"/>
	<ui:Indent label="Alignment">
		<ui:AlignmentControl id="alignmentInput"/>
	</ui:Indent>
	<mx:Script>
		<![CDATA[
			import flash.net.FileFilter;
			
			import weave.api.core.ILinkableObject;
			import weave.api.getSessionState;
			import weave.api.linkBindableProperty;
			import weave.services.FileAttacher;
			import weave.ui.ControlPanel;
			import weave.ui.CustomContextMenuManager;
			import weave.ui.DraggablePanel;
			import weave.visualization.layers.PlotManager;
			import weave.visualization.plotters.SingleImagePlotter;
			import weave.visualization.tools.SimpleVisTool;
			
			private var _plotter:SingleImagePlotter = null;
			public function setTarget(object:ILinkableObject):void
			{
				_plotter = object as SingleImagePlotter;
			}
			public function hasPendingChanges():Boolean { return false; }
			public function applyChanges():void { }
			
			override protected function childrenCreated():void
			{
				super.childrenCreated();
				linkBindableProperty(_plotter.imageURL, urlInput, "text", 1000);
				linkBindableProperty(_plotter.dataX, xInput, "text");
				linkBindableProperty(_plotter.dataY, yInput, "text");
				linkBindableProperty(_plotter.dataWidth, widthInput, "text");
				linkBindableProperty(_plotter.dataHeight, heightInput, "text");
				linkBindableProperty(_plotter.horizontalAlign, alignmentInput, 'horizontalAlign');
				linkBindableProperty(_plotter.verticalAlign, alignmentInput, 'verticalAlign');
			}
			
			//----------------------------------------------
			
			private static var _contextMenuItem:ContextMenuItem = null;
			public static function createContextMenuItems(destination:DisplayObject):Boolean
			{
				if(!destination.hasOwnProperty("contextMenu") )
					return false;
				
				// Add a listener to this destination context menu for when it is opened
				var contextMenu:ContextMenu = destination["contextMenu"] as ContextMenu;
				contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, handleContextMenuOpened);
				_contextMenuItem = CustomContextMenuManager.createAndAddMenuItemToDestination("Add Marker", destination, handleAddMarker, "2.1 textBoxMenuItem");
				
				return true;
			}
			
			private static var tool:SimpleVisTool = null;
			private static var anchorPoint:Point = new Point();
			private static function handleContextMenuOpened(e:ContextMenuEvent):void
			{	
				tool = DraggablePanel.activePanel as SimpleVisTool;
				if (tool)
				{
					_contextMenuItem.enabled = true;
					anchorPoint.x = e.mouseTarget.stage.mouseX;
					anchorPoint.y = e.mouseTarget.stage.mouseY;
				}
				else
				{
					_contextMenuItem.enabled = false;
					tool = null;
				}
			}
			
			private static function handleAddMarker(e:ContextMenuEvent):void
			{
				if (tool)
				{
					var state:Object = getSessionState(tool.visualization);
					var pm:PlotManager = tool.visualization.plotManager;
					var name:String = pm.plotters.generateUniqueName("marker");
					var plotter:SingleImagePlotter = pm.plotters.requestObject(name, SingleImagePlotter, false);
					
					var localAnchorPoint:Point = tool.visualization.globalToLocal(anchorPoint);
					pm.zoomBounds.projectScreenToData(localAnchorPoint);
					
					plotter.dataX.value = localAnchorPoint.x;
					plotter.dataY.value = localAnchorPoint.y;
					
					ControlPanel.openEditor(plotter, [tool.visualization], [state]);
				}
			}
			
			private var imageFilter:FileFilter = new FileFilter("Image", "*.png,*.jpg");
			private var fileAttacher:FileAttacher = new FileAttacher(this, [imageFilter], handleURL);
			private function handleURL(url:String):void
			{
				urlInput.text = url;
			}
		]]>
	</mx:Script>
</mx:VBox>
{'fraction_non_alphanumeric': 0.13148945817274996, 'fraction_numerical': 0.003627295397868964, 'mean_word_length': 4.308664259927798, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 2, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '412520', 'n_tokens_mistral': 3246, 'n_tokens_neox': 2631, 'n_words': 485}