repo
string
commit
string
message
string
diff
string
viirya/image-quantization-server
b31b516576cded7ca08ed5dc76598f925607b80f
added loader for tree meta data. fixed bug of parsing query features.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index 182b210..aa64129 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,292 +1,330 @@ package org.viirya.quantizer import scala.io.Source import scala.actors.Actor import scala.actors.Actor._ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.mortbay.jetty.Connector; import org.mortbay.jetty.Handler; import org.mortbay.jetty.HttpConnection; import org.mortbay.jetty.Request; import org.mortbay.jetty.Server; import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.handler.AbstractHandler; case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) def isLeaf(): Boolean = { if (children.length == 0) true else false } def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f for (i <- 0.to(value.length - 1)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } case t => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 - if (line_counter % tree_degree_per_node == 0) + if (line_counter % tree_degree_per_node == 0) { current_parent_node_in_tree = current_parent_node_in_tree + 1 + //println("current parent: " + current_parent_node_in_tree + " line: " + line_counter) + } + + //println(tree(current_parent_node_in_tree)) } if (line_counter % 100 == 0) println("Processing line " + line_counter) line_counter += 1 } } +object MetaDataLoader { + + var mean_values: Array[Float] = null + var std_values: Array[Float] = null + + def load(filepath: String) = { + + var line_counter = 0 + Source.fromFile(filepath) + .getLines + .foreach { read_line => + var line = read_line.stripLineEnd + var split_line: List[String] = List.fromString(line, ' ') + line_counter match { + case 0 => mean_values = split_line.map( (s) => s.toFloat ).toArray + case 1 => std_values = split_line.map( (s) => s.toFloat ).toArray + case _ => + } + line_counter = line_counter + 1 + } + } + +} + + class Query(var values: List[Array[Float]]) { var feature_dimension = 128 var num_features = 0 var line_counter = 0 def this() = this(List()) def parse(read_line: String) = { var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => - var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray - values = feature :: values + var features: Array[Float] = split_line.drop(4).map( (s) => s.toFloat ).toArray + var normalized_features: Array[Float] = new Array[Float](features.length) + var dimension = 0 + features.foreach { feature => + normalized_features(dimension) = (feature - MetaDataLoader.mean_values(dimension)) / MetaDataLoader.std_values(dimension) + dimension = dimension + 1 + } + values = values ::: List(normalized_features) } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } def loadFromString(data: String) = { num_features = 0 line_counter = 0 values = List() List.fromString(data, '\n').foreach( parse(_) ) } def loadFromFile(filepath: String) = { num_features = 0 line_counter = 0 values = List() Source.fromFile(filepath) .getLines .foreach( parse(_) ) /* read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } */ } } abstract class cService { def run() } class HttpService(val port: Int, val tree: MTree) extends cService { class ServiceHandler extends AbstractHandler { def handle(target: String, request: HttpServletRequest, response: HttpServletResponse, dispatch: Int) = { var base_request: Request = null if (request.isInstanceOf[Request]) base_request = request.asInstanceOf[Request] else base_request = HttpConnection.getCurrentConnection().getRequest() val feature_filename: String = base_request.getParameter("filename") val feature: String = base_request.getParameter("feature") var query: Query = new Query() var quantized_ret: String = "" if (feature_filename != null) { println("To quantize features in " + feature_filename) query.loadFromFile(feature_filename) quantized_ret = Quantizer.quantize(query, tree) } else if (feature != null) { println("To quantize features.....") query.loadFromString(feature) quantized_ret = Quantizer.quantize(query, tree) } println(quantized_ret) base_request.setHandled(true) response.setContentType("text/plain") response.setStatus(HttpServletResponse.SC_OK) response.getWriter().println(quantized_ret) } } def run() = { println("Service started.....") val server: Server = new Server() val connector: Connector = new SocketConnector() connector.setPort(port) server.setConnectors(Array(connector)) val handler: Handler = new ServiceHandler() server.setHandler(handler) server.start() server.join() } } class ServiceRunner extends Actor { def act() = { loop { react { case s: cService => println("Starting service....."); s.run() } } } } object Quantizer { def quantize(query: Query, tree: MTree): String = { var quantized_result: String = "" for (feature_point <- query.values) { var trace_tree = tree while (!trace_tree.isLeaf()) { trace_tree = trace_tree.findClosetNode(feature_point) } quantized_result = quantized_result + " vec" + trace_tree.id } quantized_result } def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) - println("Usage: scala Quantizer <port> <filepath to tree data> [SIFT feature file]") + println("Usage: scala Quantizer <port> <filepath to tree data> <filepath to tree meta data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(1)) println("Tree data loaded.") + MetaDataLoader.load(args(2)) + println("Tree meta data loaded.") + var query: Query = null - if (args.length == 3) { + if (args.length == 4) { query = new Query() - query.loadFromFile(args(2)) + query.loadFromFile(args(3)) println(quantize(query, tree_data.root)) } else { println("Running in service mode.....") val service_runner = new ServiceRunner service_runner.start service_runner ! new HttpService(args(0).toInt, tree_data.root) } } } }
viirya/image-quantization-server
323ae9d632d4622535e49fe0afe5660965262b02
connect to quantization service.
diff --git a/src/main/web/inc/cbir.inc b/src/main/web/inc/cbir.inc new file mode 100644 index 0000000..3644371 --- /dev/null +++ b/src/main/web/inc/cbir.inc @@ -0,0 +1,191 @@ +<?php + +function merge_query_result($arg) { + + $ret = array(); + + $flickr_photos = $arg['results']; + $weights = $arg['weights']; + + $ret['data'] = array(); + + $weight_count = 0; + foreach ($flickr_photos as $search_type => $photos) { + //if (!isset($photos['results']['query']['index'])) + // continue; + + $query_index = -1; + if (isset($photos['results']['query']['index'])) { + $query_index = $photos['results']['query']['index']; + } + + $items = $photos['results']['item']; + $mean = 0; + $std = 0; + $count = 0; + + foreach ($items as $key => $item) { + if ($item['index'] == $query_index || ($key == 0 && $query_index == -1 && $item['distance'] < 0.0001)) + continue; + + $mean += $item['distance']; + $count++; + } + + if ($count > 0) + $mean /= $count; + + foreach ($items as $key => $item) { + if ($item['index'] == $query_index || ($key == 0 && $query_index == -1 && $item['distance'] < 0.0001)) + continue; + + $std = $std + pow(($item['distance'] - $mean), 2); + } + + if ($count > 0) { + $std /= $count; + $std = sqrt($std); + } + + foreach ($items as $key => $item) { + if ($item['index'] == $query_index || ($key == 0 && $query_index == -1 && $item['distance'] < 0.0001)) + continue; + + $photo_id = $item['id']; + if(preg_match_all("/(.*)\.jpg/", $photo_id, $matches)) + $photo_id = $matches[1][0]; + + if ($photo_id == '') // || $photo_id == $item['id']) + continue; + + $index = $item['index']; + $distance = $item['distance']; + + //if (isset($ret['data'][$photo_id]) && $index != $ret['data'][$photo_id]['index']) + // continue; + +// if (isset($ret['data'][$photo_id])) { +// print "$photo_id\n"; +// } + + $ret['data'][$photo_id]['score'] += (1 - (1 / (1 + exp(-(($distance - $mean) / $std))))) * $weights[$weight_count]; + $ret['data'][$photo_id]['id'] = $photo_id; //$item['id']; + $ret['data'][$photo_id]['index'] = $index; + } + + $weight_count++; + + } + + usort($ret['data'], "cmp"); + + + return $ret; + +} + +function cmp($a, $b) { + if ($a['score'] == $b['score']) { + return 0; + } + //return ($a < $b) ? -1 : 1; + return ($a['score'] < $b['score']) ? 1 : -1; +} + +function query($args) { + + $k = 10; + if (isset($args['k'])) + $k = $args['k']; + + $query_id = ''; + if (isset($args['query_id'])) + $query_id = $args['query_id']; + + $flickr_id = ''; + if (isset($args['flickr_id'])) + $flickr_id = $args['flickr_id']; + + $feature = ''; + if (isset($args['feature'])) + $feature = $args['feature']; + + $url = "http://cml5.csie.ntu.edu.tw:5000/form_handler"; + if (isset($args['url'])) + $url = $args['url']; + + $post_fix = ".jpg"; + if (isset($args['postfix'])) + $post_fix = $args['postfix']; + + $query_args = array( + "url" => $url, + "params" => array( + "k" => $k, + "query_id" => $query_id, + "flickr_id" => $flickr_id, + "postfix" => $post_fix, + "feature" => $feature + ) + ); + + if (isset($args['sample']) && $args['sample'] == 'yes') + $query_args['params']['sample'] = 'yes'; + + //print_r($query_args); + + $xml = query_cbir_service($query_args); + $parser = new xml_parser(); + $ret = $parser->parse($xml); + //print_r($ret); + + return $ret; + +} + +function query_cbir_service($args) { + + $post_args = ''; + + $count = 0; + + foreach ($args['params'] as $key => $value) { + if ($count++ > 0) + $post_args = $post_args . '&'; + $post_args .= $key . "=" . $value; + } + + #print_r($args); + #print($post_args); + + // create a new cURL resource + $ch = curl_init(); + + // set URL and other appropriate options + if (isset($args['post'])) + curl_setopt($ch, CURLOPT_URL, $args['url']); + else + curl_setopt($ch, CURLOPT_URL, $args['url'] . '?' . $post_args); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_args); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + if (isset($args['post'])) { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_args); + } + + // grab URL and pass it to the browser + $ret = curl_exec($ch); + + //print_r($output); + + // close cURL resource, and free up system resources + curl_close($ch); + + return $ret; + +} + +?> diff --git a/src/main/web/query.php b/src/main/web/query.php index 1e65281..90a6216 100644 --- a/src/main/web/query.php +++ b/src/main/web/query.php @@ -1,43 +1,65 @@ <?php +include_once("inc/cbir.inc"); + $filename = get_convert_upload_image(); extract_features($filename); +$quantized_ret = quantize($filename); + +function quantize($filename) { + + $features = implode('', file($filename . '.hes')); + + $query_args = array( + "url" => "http://cml11.csie.ntu.edu.tw:5001/", + "post" => true, + "params" => array( + "feature" => $features + ) + ); + + + $quantized_ret = query_cbir_service($query_args); + print_r($quantized_ret); + return $quantized_ret; + +} function get_convert_upload_image() { $query_file = ''; if ($_FILES["userfile"]["size"] != 0) { $query_file = $_FILES["userfile"]["tmp_name"]; $tmp = explode( '/', $query_file ); move_uploaded_file($query_file, 'upload/' . $tmp[count($tmp) - 1]); $query_file = 'upload/' . $tmp[count($tmp) - 1]; } $queryimage_size = getimagesize($query_file); if ($queryimage_size[0] * $queryimage_size[1] > 360000 ) { $ratio = sqrt( 360000 / ($queryimage_size[0] * $queryimage_size[1]) ); $scaled_width = $queryimage_size[0] * $ratio; $scaled_height = $queryimage_size[1] * $ratio; exec('convert -resize ' . $scaled_width . 'x' . $scaled_height . ' ' . $query_file . $query_file); } $query_filename = explode(".", $query_file); if (count($query_filename) >= 2) unset($query_filename[count($query_filename) - 1]); $pgm_file = join(".", $query_filename); $convert_pgm = 'convert ' . $query_file . ' ' . $pgm_file . '.pgm'; $ret = shell_exec($convert_pgm); return $pgm_file; } function extract_features($filename) { exec('./bin/extract_features_64bit.ln -hesaff -sift -i ' . $filename . '.pgm -o1 ' . $filename . '.hes'); } ?>
viirya/image-quantization-server
d3cef2b159ce05ea4611215968dddd66aa3760db
remove debug message.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index ece8e9e..182b210 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,293 +1,292 @@ package org.viirya.quantizer import scala.io.Source import scala.actors.Actor import scala.actors.Actor._ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.mortbay.jetty.Connector; import org.mortbay.jetty.Handler; import org.mortbay.jetty.HttpConnection; import org.mortbay.jetty.Request; import org.mortbay.jetty.Server; import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.handler.AbstractHandler; case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) def isLeaf(): Boolean = { if (children.length == 0) true else false } def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f for (i <- 0.to(value.length - 1)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } - case t if t < 100 => + case t => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 - case _ => } if (line_counter % 100 == 0) println("Processing line " + line_counter) line_counter += 1 } } class Query(var values: List[Array[Float]]) { var feature_dimension = 128 var num_features = 0 var line_counter = 0 def this() = this(List()) def parse(read_line: String) = { var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } def loadFromString(data: String) = { num_features = 0 line_counter = 0 values = List() List.fromString(data, '\n').foreach( parse(_) ) } def loadFromFile(filepath: String) = { num_features = 0 line_counter = 0 values = List() Source.fromFile(filepath) .getLines .foreach( parse(_) ) /* read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } */ } } abstract class cService { def run() } class HttpService(val port: Int, val tree: MTree) extends cService { class ServiceHandler extends AbstractHandler { def handle(target: String, request: HttpServletRequest, response: HttpServletResponse, dispatch: Int) = { var base_request: Request = null if (request.isInstanceOf[Request]) base_request = request.asInstanceOf[Request] else base_request = HttpConnection.getCurrentConnection().getRequest() val feature_filename: String = base_request.getParameter("filename") val feature: String = base_request.getParameter("feature") var query: Query = new Query() var quantized_ret: String = "" if (feature_filename != null) { println("To quantize features in " + feature_filename) query.loadFromFile(feature_filename) quantized_ret = Quantizer.quantize(query, tree) } else if (feature != null) { println("To quantize features.....") query.loadFromString(feature) quantized_ret = Quantizer.quantize(query, tree) } println(quantized_ret) base_request.setHandled(true) response.setContentType("text/plain") response.setStatus(HttpServletResponse.SC_OK) response.getWriter().println(quantized_ret) } } def run() = { println("Service started.....") val server: Server = new Server() val connector: Connector = new SocketConnector() connector.setPort(port) server.setConnectors(Array(connector)) val handler: Handler = new ServiceHandler() server.setHandler(handler) server.start() server.join() } } class ServiceRunner extends Actor { def act() = { loop { react { case s: cService => println("Starting service....."); s.run() } } } } object Quantizer { def quantize(query: Query, tree: MTree): String = { var quantized_result: String = "" for (feature_point <- query.values) { var trace_tree = tree while (!trace_tree.isLeaf()) { trace_tree = trace_tree.findClosetNode(feature_point) } quantized_result = quantized_result + " vec" + trace_tree.id } quantized_result } def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) println("Usage: scala Quantizer <port> <filepath to tree data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(1)) println("Tree data loaded.") var query: Query = null if (args.length == 3) { query = new Query() query.loadFromFile(args(2)) println(quantize(query, tree_data.root)) } else { println("Running in service mode.....") val service_runner = new ServiceRunner service_runner.start service_runner ! new HttpService(args(0).toInt, tree_data.root) } } } }
viirya/image-quantization-server
7eccaccf38440903587d1a4c906c41d39f7cd15b
POST parameter used.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index ef70598..ece8e9e 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,257 +1,293 @@ package org.viirya.quantizer import scala.io.Source import scala.actors.Actor import scala.actors.Actor._ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.mortbay.jetty.Connector; import org.mortbay.jetty.Handler; import org.mortbay.jetty.HttpConnection; import org.mortbay.jetty.Request; import org.mortbay.jetty.Server; import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.handler.AbstractHandler; case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) def isLeaf(): Boolean = { if (children.length == 0) true else false } def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f for (i <- 0.to(value.length - 1)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } - case t => + case t if t < 100 => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 + case _ => } if (line_counter % 100 == 0) println("Processing line " + line_counter) line_counter += 1 } } class Query(var values: List[Array[Float]]) { - def this() = this(List()) + + var feature_dimension = 128 + var num_features = 0 + var line_counter = 0 + + def this() = this(List()) + + def parse(read_line: String) = { + var line = read_line.stripLineEnd + var split_line: List[String] = List.fromString(line, ' ') + line_counter match { + case 0 => feature_dimension = split_line(0).toInt + case 1 => num_features = split_line(0).toInt + case _ => + var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray + values = feature :: values + } + println("line " + line_counter + " loaded.") + line_counter = line_counter + 1 + } + + def loadFromString(data: String) = { + num_features = 0 + line_counter = 0 + values = List() + List.fromString(data, '\n').foreach( parse(_) ) + } + def loadFromFile(filepath: String) = { - var feature_dimension = 128 - var num_features = 0 - var line_counter = 0 + num_features = 0 + line_counter = 0 values = List() Source.fromFile(filepath) .getLines - .foreach { read_line => + .foreach( parse(_) ) +/* +read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } +*/ } } abstract class cService { def run() } class HttpService(val port: Int, val tree: MTree) extends cService { class ServiceHandler extends AbstractHandler { def handle(target: String, request: HttpServletRequest, response: HttpServletResponse, dispatch: Int) = { var base_request: Request = null if (request.isInstanceOf[Request]) base_request = request.asInstanceOf[Request] else base_request = HttpConnection.getCurrentConnection().getRequest() val feature_filename: String = base_request.getParameter("filename") + val feature: String = base_request.getParameter("feature") + + var query: Query = new Query() + var quantized_ret: String = "" if (feature_filename != null) { println("To quantize features in " + feature_filename) - - var query: Query = new Query() query.loadFromFile(feature_filename) + quantized_ret = Quantizer.quantize(query, tree) + + } else if (feature != null) { + println("To quantize features.....") + query.loadFromString(feature) + quantized_ret = Quantizer.quantize(query, tree) - val quantized_ret: String = Quantizer.quantize(query, tree) + } - println(quantized_ret) + println(quantized_ret) - base_request.setHandled(true) + base_request.setHandled(true) - response.setContentType("text/plain") - response.setStatus(HttpServletResponse.SC_OK) - response.getWriter().println(quantized_ret) - - } + response.setContentType("text/plain") + response.setStatus(HttpServletResponse.SC_OK) + response.getWriter().println(quantized_ret) } } def run() = { println("Service started.....") val server: Server = new Server() val connector: Connector = new SocketConnector() connector.setPort(port) server.setConnectors(Array(connector)) val handler: Handler = new ServiceHandler() server.setHandler(handler) server.start() server.join() } } class ServiceRunner extends Actor { def act() = { loop { react { case s: cService => println("Starting service....."); s.run() } } } } object Quantizer { def quantize(query: Query, tree: MTree): String = { var quantized_result: String = "" for (feature_point <- query.values) { var trace_tree = tree while (!trace_tree.isLeaf()) { trace_tree = trace_tree.findClosetNode(feature_point) } quantized_result = quantized_result + " vec" + trace_tree.id } quantized_result } def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) println("Usage: scala Quantizer <port> <filepath to tree data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(1)) println("Tree data loaded.") var query: Query = null if (args.length == 3) { query = new Query() query.loadFromFile(args(2)) println(quantize(query, tree_data.root)) } else { println("Running in service mode.....") val service_runner = new ServiceRunner service_runner.start service_runner ! new HttpService(args(0).toInt, tree_data.root) } } } }
viirya/image-quantization-server
a6d22e00d1634191056764bc4926b428e4e9c1fb
Web-based service interface added.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index 2662821..ef70598 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,166 +1,257 @@ package org.viirya.quantizer import scala.io.Source +import scala.actors.Actor +import scala.actors.Actor._ + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.mortbay.jetty.Connector; +import org.mortbay.jetty.Handler; +import org.mortbay.jetty.HttpConnection; +import org.mortbay.jetty.Request; +import org.mortbay.jetty.Server; +import org.mortbay.jetty.bio.SocketConnector; +import org.mortbay.jetty.handler.AbstractHandler; case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) def isLeaf(): Boolean = { if (children.length == 0) true else false } def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f for (i <- 0.to(value.length - 1)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } case t => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 } if (line_counter % 100 == 0) println("Processing line " + line_counter) line_counter += 1 } } class Query(var values: List[Array[Float]]) { def this() = this(List()) def loadFromFile(filepath: String) = { var feature_dimension = 128 var num_features = 0 var line_counter = 0 values = List() Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } } } + +abstract class cService { + + def run() + +} + +class HttpService(val port: Int, val tree: MTree) extends cService { + + class ServiceHandler extends AbstractHandler { + + def handle(target: String, request: HttpServletRequest, response: HttpServletResponse, dispatch: Int) = { + var base_request: Request = null + if (request.isInstanceOf[Request]) + base_request = request.asInstanceOf[Request] + else + base_request = HttpConnection.getCurrentConnection().getRequest() + + val feature_filename: String = base_request.getParameter("filename") + + if (feature_filename != null) { + println("To quantize features in " + feature_filename) + + var query: Query = new Query() + query.loadFromFile(feature_filename) + + val quantized_ret: String = Quantizer.quantize(query, tree) + + println(quantized_ret) + + base_request.setHandled(true) + + response.setContentType("text/plain") + response.setStatus(HttpServletResponse.SC_OK) + response.getWriter().println(quantized_ret) + + } + + } + + } + + def run() = { + + println("Service started.....") + + val server: Server = new Server() + val connector: Connector = new SocketConnector() + connector.setPort(port) + server.setConnectors(Array(connector)) + + val handler: Handler = new ServiceHandler() + server.setHandler(handler) + + server.start() + server.join() + } + +} + +class ServiceRunner extends Actor { + + def act() = { + loop { + react { + case s: cService => println("Starting service....."); s.run() + } + } + } + +} + object Quantizer { def quantize(query: Query, tree: MTree): String = { var quantized_result: String = "" for (feature_point <- query.values) { var trace_tree = tree while (!trace_tree.isLeaf()) { trace_tree = trace_tree.findClosetNode(feature_point) } quantized_result = quantized_result + " vec" + trace_tree.id } quantized_result } def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) - println("Usage: scala Quantizer <filepath to tree data> [SIFT feature file]") + println("Usage: scala Quantizer <port> <filepath to tree data> [SIFT feature file]") else { println("Starting service...") - tree_data = new TreeDataLoader(args(0)) + tree_data = new TreeDataLoader(args(1)) println("Tree data loaded.") var query: Query = null - if (args.length == 2) { + if (args.length == 3) { query = new Query() - query.loadFromFile(args(1)) + query.loadFromFile(args(2)) println(quantize(query, tree_data.root)) - } + } else { + println("Running in service mode.....") + val service_runner = new ServiceRunner + service_runner.start + service_runner ! new HttpService(args(0).toInt, tree_data.root) + } } } }
viirya/image-quantization-server
bfd2b29996c5e1d187584a924ba775faccaed570
fixed out of array bug in calculating distance
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index eb5e690..2662821 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,166 +1,166 @@ package org.viirya.quantizer import scala.io.Source case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) def isLeaf(): Boolean = { if (children.length == 0) true else false } def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f - for (i <- 0.to(value.length)) { + for (i <- 0.to(value.length - 1)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } - case _ => + case t => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 } if (line_counter % 100 == 0) println("Processing line " + line_counter) line_counter += 1 } } class Query(var values: List[Array[Float]]) { def this() = this(List()) def loadFromFile(filepath: String) = { var feature_dimension = 128 var num_features = 0 var line_counter = 0 values = List() Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } } } object Quantizer { def quantize(query: Query, tree: MTree): String = { var quantized_result: String = "" for (feature_point <- query.values) { var trace_tree = tree while (!trace_tree.isLeaf()) { trace_tree = trace_tree.findClosetNode(feature_point) } - quantized_result = quantized_result + "vec" + trace_tree.id + quantized_result = quantized_result + " vec" + trace_tree.id } quantized_result } def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) println("Usage: scala Quantizer <filepath to tree data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(0)) println("Tree data loaded.") var query: Query = null if (args.length == 2) { query = new Query() query.loadFromFile(args(1)) println(quantize(query, tree_data.root)) } } } }
viirya/image-quantization-server
d96440656b832c53bacf64e010ef28118880f61c
web interface.
diff --git a/src/main/web/bin/extract_features_64bit.ln b/src/main/web/bin/extract_features_64bit.ln new file mode 100755 index 0000000..2b3c942 Binary files /dev/null and b/src/main/web/bin/extract_features_64bit.ln differ diff --git a/src/main/web/cbir.html b/src/main/web/cbir.html new file mode 100644 index 0000000..d54c83f --- /dev/null +++ b/src/main/web/cbir.html @@ -0,0 +1,21 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Content-based Image Retrieval</title> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf8"> +</head> + +<body> +<div> +<h2>Query image:</h2> + <table border="0" width="100%"> + <tr><td valign="bottom"> + <form action="query.php" method="post" enctype="multipart/form-data"> + <input type="file" name="userfile" size=15> + <input type="submit" value="Upload"> + </form> + </td></tr> + </table> +</div> +</body> +</html> diff --git a/src/main/web/query.php b/src/main/web/query.php new file mode 100644 index 0000000..1e65281 --- /dev/null +++ b/src/main/web/query.php @@ -0,0 +1,43 @@ +<?php + +$filename = get_convert_upload_image(); +extract_features($filename); + + +function get_convert_upload_image() { + + $query_file = ''; + + if ($_FILES["userfile"]["size"] != 0) { + $query_file = $_FILES["userfile"]["tmp_name"]; + $tmp = explode( '/', $query_file ); + move_uploaded_file($query_file, 'upload/' . $tmp[count($tmp) - 1]); + $query_file = 'upload/' . $tmp[count($tmp) - 1]; + } + + $queryimage_size = getimagesize($query_file); + + if ($queryimage_size[0] * $queryimage_size[1] > 360000 ) { + $ratio = sqrt( 360000 / ($queryimage_size[0] * $queryimage_size[1]) ); + $scaled_width = $queryimage_size[0] * $ratio; + $scaled_height = $queryimage_size[1] * $ratio; + exec('convert -resize ' . $scaled_width . 'x' . $scaled_height . ' ' . $query_file . $query_file); + } + + $query_filename = explode(".", $query_file); + if (count($query_filename) >= 2) + unset($query_filename[count($query_filename) - 1]); + $pgm_file = join(".", $query_filename); + $convert_pgm = 'convert ' . $query_file . ' ' . $pgm_file . '.pgm'; + $ret = shell_exec($convert_pgm); + + return $pgm_file; +} + +function extract_features($filename) { + + exec('./bin/extract_features_64bit.ln -hesaff -sift -i ' . $filename . '.pgm -o1 ' . $filename . '.hes'); + +} + +?>
viirya/image-quantization-server
b6b77574e4a9a0eac50bd4ad270c40f76380032f
added quantizing function.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index 7f0ae20..eb5e690 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,143 +1,166 @@ package org.viirya.quantizer import scala.io.Source case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) + def isLeaf(): Boolean = { + if (children.length == 0) + true + else + false + } def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f for (i <- 0.to(value.length)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } case _ => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 } if (line_counter % 100 == 0) println("Processing line " + line_counter) line_counter += 1 } } class Query(var values: List[Array[Float]]) { - def this() = this(List()) + def this() = this(List()) def loadFromFile(filepath: String) = { var feature_dimension = 128 var num_features = 0 var line_counter = 0 values = List() Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } } } object Quantizer { + def quantize(query: Query, tree: MTree): String = { + + var quantized_result: String = "" + + for (feature_point <- query.values) { + var trace_tree = tree + while (!trace_tree.isLeaf()) { + trace_tree = trace_tree.findClosetNode(feature_point) + } + quantized_result = quantized_result + "vec" + trace_tree.id + } + + quantized_result + } + def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) println("Usage: scala Quantizer <filepath to tree data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(0)) println("Tree data loaded.") var query: Query = null if (args.length == 2) { query = new Query() query.loadFromFile(args(1)) + + println(quantize(query, tree_data.root)) } } } }
viirya/image-quantization-server
448a144f0f98d57773105413be4c729999764e88
fix debug message.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index d2ddc09..7f0ae20 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,142 +1,143 @@ package org.viirya.quantizer import scala.io.Source case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { def this(id: Int, value: Array[Float]) = this(id, value, List()) def calculateDistance(vector: Array[Float]): Float = { var distance: Float = 0.0f for (i <- 0.to(value.length)) { distance = distance + Math.pow(value(i) - vector(i), 2).toFloat } distance } def findClosetNode(vector: Array[Float]): MTree = { var minDistance = Math.MAX_FLOAT var closetNode: MTree = null children.foreach { child_node => var distance = child_node.calculateDistance(vector) if (distance < minDistance) { minDistance = distance closetNode = child_node } } closetNode } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } case _ => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 } - println("Processing line " + line_counter) + if (line_counter % 100 == 0) + println("Processing line " + line_counter) line_counter += 1 } } class Query(var values: List[Array[Float]]) { def this() = this(List()) def loadFromFile(filepath: String) = { var feature_dimension = 128 var num_features = 0 var line_counter = 0 values = List() Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => feature_dimension = split_line(0).toInt case 1 => num_features = split_line(0).toInt case _ => var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray values = feature :: values } println("line " + line_counter + " loaded.") line_counter = line_counter + 1 } } } object Quantizer { def main(args: Array[String]) = { var tree_data: TreeDataLoader = null if (args.length == 0) println("Usage: scala Quantizer <filepath to tree data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(0)) println("Tree data loaded.") var query: Query = null if (args.length == 2) { query = new Query() query.loadFromFile(args(1)) } } } }
viirya/image-quantization-server
e5e01139b79fe3b9d342c678cce40fba6f8197cf
added Query class to load SIFT features to quantize
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index cae9701..d2ddc09 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,91 +1,142 @@ package org.viirya.quantizer import scala.io.Source -case class MTree[T](id: Int, value: Array[T], var children: List[MTree[T]]) { - def this(id: Int, value: Array[T]) = this(id, value, List()) +case class MTree(id: Int, value: Array[Float], var children: List[MTree]) { + def this(id: Int, value: Array[Float]) = this(id, value, List()) + def calculateDistance(vector: Array[Float]): Float = { + var distance: Float = 0.0f + for (i <- 0.to(value.length)) { + distance = distance + Math.pow(value(i) - vector(i), 2).toFloat + } + distance + } + def findClosetNode(vector: Array[Float]): MTree = { + var minDistance = Math.MAX_FLOAT + var closetNode: MTree = null + children.foreach { child_node => + var distance = child_node.calculateDistance(vector) + if (distance < minDistance) { + minDistance = distance + closetNode = child_node + } + } + closetNode + } override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 - var tree: List[MTree[Float]] = List() + var tree: List[MTree] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } case _ => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray - var new_node: MTree[Float] = null + var new_node: MTree = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 } - //println("Processing line " + line_counter) + println("Processing line " + line_counter) line_counter += 1 } } + +class Query(var values: List[Array[Float]]) { + def this() = this(List()) + def loadFromFile(filepath: String) = { + var feature_dimension = 128 + var num_features = 0 + var line_counter = 0 + values = List() + Source.fromFile(filepath) + .getLines + .foreach { read_line => + var line = read_line.stripLineEnd + var split_line: List[String] = List.fromString(line, ' ') + line_counter match { + case 0 => feature_dimension = split_line(0).toInt + case 1 => num_features = split_line(0).toInt + case _ => + var feature: Array[Float] = split_line.map( (s) => s.toFloat ).toArray + values = feature :: values + } + println("line " + line_counter + " loaded.") + line_counter = line_counter + 1 + } + } +} + object Quantizer { def main(args: Array[String]) = { var tree_data: TreeDataLoader = null - if (args.length != 1) - println("Usage: scala Quantizer <filepath to tree data>") + if (args.length == 0) + println("Usage: scala Quantizer <filepath to tree data> [SIFT feature file]") else { println("Starting service...") tree_data = new TreeDataLoader(args(0)) println("Tree data loaded.") + + var query: Query = null + if (args.length == 2) { + query = new Query() + query.loadFromFile(args(1)) + } } } }
viirya/image-quantization-server
f5ff8683e828808b9fe9b7e9f54130cc597171e4
add usage message.
diff --git a/src/main/scala/quantizer.scala b/src/main/scala/quantizer.scala index 1da0ebe..cae9701 100644 --- a/src/main/scala/quantizer.scala +++ b/src/main/scala/quantizer.scala @@ -1,84 +1,91 @@ package org.viirya.quantizer import scala.io.Source case class MTree[T](id: Int, value: Array[T], var children: List[MTree[T]]) { def this(id: Int, value: Array[T]) = this(id, value, List()) override def toString = "M(" + value.toString + " {" + children.map(_.toString).mkString(",") + "})" } /* object MTree { def apply[T](id: Int, value: Array[T]) = new MTree(id, value, List()) def apply[T](id: Int, value: Array[T], children: List[MTree[T]]) = new MTree(id, value, children) } */ class TreeDataLoader(filepath: String) { var line_counter = 0 var tree_degree_per_node = 0 var tree_height = 0 var num_all_tree_nodes = 0 var num_not_leaf_nodes = 0 var feature_dimension = 128 var tree: List[MTree[Float]] = List() var root = new MTree(0, new Array[Float](128)) tree = tree ::: List(root) var current_pos_in_tree = 0 var current_parent_node_in_tree = 0 Source.fromFile(filepath) .getLines .foreach { read_line => var line = read_line.stripLineEnd var split_line: List[String] = List.fromString(line, ' ') line_counter match { case 0 => try { tree_degree_per_node = split_line(0).toInt tree_height = split_line(1).toInt num_all_tree_nodes = ((Math.pow(tree_degree_per_node, tree_height + 1) - 1) / (tree_degree_per_node - 1)).toInt - 1 num_not_leaf_nodes = num_all_tree_nodes - Math.pow(tree_degree_per_node, tree_height).toInt } catch { case _: java.lang.NumberFormatException => println("Error file format.") } case _ => var node_value: Array[Float] = split_line.map( (s) => s.toFloat ).toArray var new_node: MTree[Float] = null if (line_counter <= num_not_leaf_nodes) new_node = new MTree(-line_counter, node_value) else new_node = new MTree(line_counter - num_not_leaf_nodes, node_value) tree(current_parent_node_in_tree).children = tree(current_parent_node_in_tree).children ::: List(new_node) tree = tree ::: List(new_node) current_pos_in_tree = current_pos_in_tree + 1 if (line_counter % tree_degree_per_node == 0) current_parent_node_in_tree = current_parent_node_in_tree + 1 } + //println("Processing line " + line_counter) line_counter += 1 } } object Quantizer { def main(args: Array[String]) = { - println("Starting service...") - + var tree_data: TreeDataLoader = null + if (args.length != 1) + println("Usage: scala Quantizer <filepath to tree data>") + else { + println("Starting service...") + tree_data = new TreeDataLoader(args(0)) + println("Tree data loaded.") + } } }
kolia/cones_MC
4c34401cad2893169e6cb436a3efe528709dfc0c
bugfix
diff --git a/main.m b/main.m index dd344b6..4a6f046 100644 --- a/main.m +++ b/main.m @@ -1,56 +1,56 @@ cone_map.datafolder = 'peach' ; addpath(genpath(pwd)) %% LOAD DATA load(sprintf('%s/stas', cone_map.datafolder)) % stas struct contains fields: % stas(i).spikes : the list of spike times of cell i % stas(i).spatial : the spatial component of the STA of cell i load(sprintf('%s/cone_params', cone_map.datafolder)) % cone_params struct fields: % stimulus_variance : variance of each stim pixel color chanel (usually 1) % supersample : the integer number of cone positions per pixel % width/height (usually 4) % colors : 3x3 matrix of cone color sensitivities % support_radius : radius of cone receptive field filter (usually 3.0) % repulsion_radii % restrict the stimulus to a region of interest (if memory is a problem) % stas = restrict_ROI( stas, [1 160], [1 160] ) ; %% CONE_MAP contains parameters and preprocessed data structures % calculate sparsity pattern (for MCMC) and initial LL map (for greedy) cone_map = exact_LL_setup(stas,cone_params,cone_map) ; % How many MCMC/CAST iterations? cone_map.N_iterations = 5e5 ; cone_map.max_time = 4e5 ; % in seconds % % override defaults: plot, display, and save every ? iterations (0 = never) % cone_map.plot_every = 1000 ; % cone_map.display_every = 20 ; % cone_map.save_every = 0 ; % string identifying this cone_map problem; useful for naming saved results cone_map.description = cone_map_string( cone_map ) ; %% run GREEDY, MCMC or CAST locally % result = GREEDY(cone_map) ; save(['greed_' cone_map.description],'result') ; % result = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'result') ; % result = CAST(cone_map) ; save(['cast_' cone_map.description], 'result') ; %% some plots % make_plots( result ) % %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: % start by cloning AGRICOLA from https://github.com/kolia/agricola addpath('../agricola') N = 30 ; ids = cell(1,N) ; for i=1:length(ids) , ids{i} = {i} ; end cone_map.save_disk_space = true ; % strip results of large fields PBS.l.mem = '1500mb' ; PBS.l.walltime = '70:00:00' ; -sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; -sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; -sow(['greed_' base_str],@( )GREEDY(cone_map)) ; \ No newline at end of file +sow(['cast_' cone_map.description],@(ID)CAST(cone_map,ID),ids,PBS) ; +sow(['mcmc_' cone_map.description],@(ID)MCMC(cone_map,ID),ids,PBS) ; +sow(['greed_' cone_map.description],@( )GREEDY(cone_map)) ; \ No newline at end of file
kolia/cones_MC
f6a2d9c72ca0c5eb689a8651e9ff6ef74e95b5f9
bugfix
diff --git a/SimTempMCMC.m b/SimTempMCMC.m index 2a21ebf..01bb31b 100644 --- a/SimTempMCMC.m +++ b/SimTempMCMC.m @@ -1,86 +1,86 @@ function [X,ST] = SimTempMCMC( X, PROB, ST , j ) % Simulated Tempering + Wang-Landau update % simTempMCMC : We update the state, and then update the temperature % ST (Simulated Tempering) is a structure that contains fields: % T : cell array of temperatures % i : index of current temperature % lg : current log weights % n : number of current iteration if ~isfield(ST,'n' ) , ST.n = 1 ; end if ~isfield(ST,'i' ) , ST.i = 1 ; end if ~isfield(ST,'lg' ) , ST.lg = zeros(length(ST.T),1) ; end if ~isfield(ST,'f' ) , ST.f = zeros(length(ST.T),1) ; end if ~isfield(ST,'gamma0') , ST.gamma0 = 1e128 ; end if ~isfield(ST,'k' ) , ST.k = 0 ; end if ~isfield(ST,'avg_p' ) , ST.avg_p = zeros(length(ST.T),1) ; end if ~isfield(ST,'Q' ) ST.Q = ones(length(ST.T),1) ; ST.Q(2:end-1) = 0.5 ; end ST.gamma = ST.gamma0 ; ST.lg_curv = 0.3 * ones(length(ST.T)-1,1) ; % sample T % proposed change in temperature index is +1 or -1 with prob 0.5 if ST.i(j) == 1 proposed_i = 2 ; elseif ST.i(j) == length(ST.T) proposed_i = length(ST.T)-1 ; else proposed_i = ST.i(j) + 2* ( unifrnd(0,1)>0.5 ) - 1 ; end % calculate probability of accepting new T new_ll = calculate_LL( X , PROB , ST.T{proposed_i}) ; paccept = min(1, ST.Q(ST.i(j))/ST.Q(proposed_i)*... exp(new_ll-X.ll + ST.lg(ST.i(j)) - ST.lg(proposed_i)) ) ; ST.avg_p( ST.i(j) ) = ST.avg_p( ST.i(j) ) + paccept ; % accept new state with probability p accept = rand() < paccept ; if accept ST.i(j) = proposed_i ; X.ll = new_ll ; end ST.f(ST.i(j)) = ST.f(ST.i(j)) + 1 ; % update adaptive weights if numel(ST.f)*ST.f/sum(ST.f)>0.8 % fprintf('\nST.lg:') ; fprintf(' %g',ST.lg) % fprintf('\nST.f:') ; fprintf(' %g',ST.f/s) ST.k = ST.k+1 ; ST.gamma = (1 + ST.gamma0).^(1/(2*ST.k)) - 1 ; % fprintf('\navg_acceptance') ; fprintf(' %g',ST.avg_p./ST.f) ; if isfield(ST,'max_temps') && 2*length(ST.T)-1 <= ST.max_temps [ST.T,T] = refine_mesh(ST.T , ST.curvature) ; ST.lg = spline(1:length(ST.lg),ST.lg,1:0.5:length(ST.lg)) ; ST.f = zeros(length(ST.T),1) ; ST.avg_p = zeros(length(ST.T),1) ; ST.Q = ones( length(ST.T),1) ; ST.curvature = 1./(1+sqrt((1-ST.curvature)/ST.curvature)) ; ST.Q(2:end-1)= 0.5 ; ST.i = 2*ST.i-1 ; + + fprintf('\n\n+ %d inverse temperatures beta:\n',size(T,1)) + fprintf('%4.2f ',T(:,1)' ) + fprintf('\n\n+ %d powers delta:\n',size(T,1)) + fprintf('%4.2f ',T(:,2)') end - fprintf('\n\nNEW GAMMA: %g (k=%d)\n',ST.gamma,ST.k) - fprintf('\n+ %d inverse temperatures beta:\n',size(T,1)) - fprintf('%4.2f ',T(:,1)' ) - fprintf('\n\n+ %d powers delta:\n',size(T,1)) - fprintf('%4.2f ',T(:,2)') - fprintf('\n') + fprintf('\nNEW GAMMA: %g (k=%d)\n',ST.gamma,ST.k) end ST.lg(ST.i(j)) = ST.lg(ST.i(j)) + log(1 + ST.gamma) ; ST.n = ST.n + 1 ; % reshift ST.lg every 1000 iterations, for sanity if ~mod(ST.n,1000) , ST.lg = ST.lg - mean(ST.lg) ; end end \ No newline at end of file
kolia/cones_MC
434a6e4e4148c30ff67c26c1a2ead4348dcb904d
routine changes
diff --git a/main.m b/main.m index 5d6fb3c..dd344b6 100644 --- a/main.m +++ b/main.m @@ -1,56 +1,56 @@ cone_map.datafolder = 'peach' ; addpath(genpath(pwd)) %% LOAD DATA load(sprintf('%s/stas', cone_map.datafolder)) % stas struct contains fields: % stas(i).spikes : the list of spike times of cell i % stas(i).spatial : the spatial component of the STA of cell i load(sprintf('%s/cone_params', cone_map.datafolder)) % cone_params struct fields: % stimulus_variance : variance of each stim pixel color chanel (usually 1) % supersample : the integer number of cone positions per pixel % width/height (usually 4) % colors : 3x3 matrix of cone color sensitivities % support_radius : radius of cone receptive field filter (usually 3.0) % repulsion_radii % restrict the stimulus to a region of interest (if memory is a problem) % stas = restrict_ROI( stas, [1 160], [1 160] ) ; %% CONE_MAP contains parameters and preprocessed data structures % calculate sparsity pattern (for MCMC) and initial LL map (for greedy) cone_map = exact_LL_setup(stas,cone_params,cone_map) ; % How many MCMC/CAST iterations? cone_map.N_iterations = 5e5 ; cone_map.max_time = 4e5 ; % in seconds % % override defaults: plot, display, and save every ? iterations (0 = never) % cone_map.plot_every = 1000 ; % cone_map.display_every = 20 ; % cone_map.save_every = 0 ; % string identifying this cone_map problem; useful for naming saved results cone_map.description = cone_map_string( cone_map ) ; %% run GREEDY, MCMC or CAST locally % result = GREEDY(cone_map) ; save(['greed_' cone_map.description],'result') ; -result = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'result') ; +% result = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'result') ; % result = CAST(cone_map) ; save(['cast_' cone_map.description], 'result') ; %% some plots -make_plots( result ) - -%% %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: -% % start by cloning AGRICOLA from https://github.com/kolia/agricola -% addpath('../agricola') -% N = 30 ; ids = cell(1,N) ; for i=1:length(ids) , ids{i} = {i} ; end -% cone_map.save_disk_space = true ; % strip results of large fields -% -% PBS.l.mem = '1500mb' ; -% PBS.l.walltime = '70:00:00' ; -% sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; -% sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; -% sow(['greed_' base_str],@( )GREEDY(cone_map)) ; \ No newline at end of file +% make_plots( result ) + +% %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: +% start by cloning AGRICOLA from https://github.com/kolia/agricola +addpath('../agricola') +N = 30 ; ids = cell(1,N) ; for i=1:length(ids) , ids{i} = {i} ; end +cone_map.save_disk_space = true ; % strip results of large fields + +PBS.l.mem = '1500mb' ; +PBS.l.walltime = '70:00:00' ; +sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; +sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; +sow(['greed_' base_str],@( )GREEDY(cone_map)) ; \ No newline at end of file
kolia/cones_MC
f3801be15c2c2555c408a8cf3b280db3f49e8811
CAST using new SimTempMCMC, starts with just 2 temperatures
diff --git a/CAST.m b/CAST.m index 3bffe18..1d66fd0 100644 --- a/CAST.m +++ b/CAST.m @@ -1,208 +1,206 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults -default( cone_map , 'N_iterations' , 1000000) -default( cone_map , 'max_time' , 200000 ) -default( cone_map , 'plot_every' , 1000 ) -default( cone_map , 'display_every' , 50 ) -default( cone_map , 'save_every' , 0 ) -default( cone_map , 'profile_every' , 0 ) -default( cone_map , 'ID' , 0 ) -default( cone_map , 'N_fast' , 1 ) -default( cone_map , 'swap_N_times' , 50 ) -default( cone_map , 'save_disk_space', false ) - -% default progression of inverse temperatures -cone_map.min_delta = 0.2 ; -cone_map.min_beta = 0.3 ; -% cone_map.betas = -0.1 + make_deltas( cone_map.min_beta , 1, 4, 20 ) ; -cone_map.betas = make_deltas( cone_map.min_beta , 1, 4, 100 ) ; -cone_map.deltas = make_deltas( cone_map.min_delta , 1, 4, 100 ) ; +default( cone_map , 'N_iterations' , 1000000) +default( cone_map , 'max_time' , 200000 ) +default( cone_map , 'plot_every' , 1000 ) +default( cone_map , 'display_every' , 50 ) +default( cone_map , 'save_every' , 0 ) +default( cone_map , 'profile_every' , 0 ) +default( cone_map , 'ID' , 0 ) +default( cone_map , 'N_fast' , 1 ) +default( cone_map , 'swap_N_times' , 50 ) +default( cone_map , 'save_disk_space' , false ) + +% default hottest inverse temperature, max number of temps, and curvature +default( cone_map , 'min_beta' , 0.2 ) +default( cone_map , 'min_delta' , 0.2 ) +default( cone_map , 'max_temps' , 130 ) +default( cone_map , 'curvature' , 0.1 ) % how do temps fall off? % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps -N_temp = length(cone_map.betas) ; -ST.T = cell(N_temp,1) ; +ST.T = cell(2,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; -for i=1:N_temp - ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; -end +ST.curvature = curvature ; +ST.T{1} = [1 1] ; +ST.T{2} = [min_beta min_delta] ; % ST.g is used by Wang-Landau scheme in SimTempMCMC.m -ST.lg = ones(1,N_temp) ; %exp(100*(1:N_temp)/N_temp) ; %((1:N_temp)/N_temp*(1-cone_map.min_beta)*1e5) .^ 0.3 ; +ST.lg = ones(1,2) ; +ST.max_temps = max_temps ; % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP -fprintf('\n\nSTARTING CAST with' ) -fprintf('\n\n+ different inverse temperatures beta:\n') -fprintf('%4.2f ',cone_map.betas ) -fprintf('\n\n+ different powers delta:\n') -fprintf('%4.2f ',cone_map.deltas) +fprintf('\nSTARTING CAST with' ) +fprintf('\n+ hottest inverse temperature beta: %f\n',min_beta ) +fprintf('+ smallest power delta : %f\n',min_delta) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} proposal = move( X{1}, cone_map , [1 1]) ; accept = metropolis_hastings( X{1}.ll, proposal.ll, proposal.proposal_bias ) ; X{1} = update_X( {X{1}; proposal}, accept+1 ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast proposal = move( X{1+j}, cone_map , ST.T{ST.i(j)}) ; accept = metropolis_hastings( X{1}.ll, proposal.ll, proposal.proposal_bias ) ; X{1+j} = update_X( {X{1+j}; proposal}, accept+1 ) ; end for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 - if isfield(ST,'k') && ST.k>1 && ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 + if isfield(ST,'k') && 2*numel(ST.T)-1>max_temps && ... + ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 old_ll = X{1}.ll ; old_fast = X{2}.ll ; [X{1},X{1+j}] = swap_step(X{1},X{1+j},cone_map, swap_N_times, ST.T{1}) ; % if old_ll ~= X{1}.ll % fprintf(' dLL : %.2f',X{1}.ll-old_ll) ; % end % fprintf(' old_ll: %.2f slow : %.2f fast : %.2f ',old_ll,X{1}.ll,X{2}.ll) ; fprintf(' SWAPDLL: %.2f, SLOWDLL: %.2f',... X{1}.ll+X{2}.ll-old_ll-old_fast,... X{1}.ll-old_ll) ; end % update temperature step [X{1+j},ST] = SimTempMCMC( X{1+j}, cone_map, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) props = numel(ST.f)*ST.f/sum(ST.f) ; % fprintf('\nST.lg:') ; fprintf(' %g',ST.lg) % fprintf('\nST.f:') ; fprintf(' %g',props) fprintf(' min ST.f %g >? 0.8',min(props)) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) plot_cones_matlab( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X{1},{'contact'}) ; try to_save.X = rmfield(X{1},{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; if ~mod(jj,save_every) save(sprintf('cast_result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end
kolia/cones_MC
5a7e8e8b2c897d8c3e082f27a884c8abff1dc41f
refine_mesh does simple interpolation with a curvature parameter
diff --git a/refine_mesh.m b/refine_mesh.m new file mode 100644 index 0000000..3146c09 --- /dev/null +++ b/refine_mesh.m @@ -0,0 +1,27 @@ +function [Y,Z] = refine_mesh(X, curvature) +% Consider each column of X to be the values of a function on a mesh. +% Refine this mesh by making X larger in the first dimension, adding values +% that interpolate linearly between the old ones. The first dimension of +% the result is 2 * the old one - 1. +% If X is a cell, then every element in the cell is treated as a row of X, +% and the result is +% + +% if X is a cell, convert to matrix +Xcell = iscell(X) ; +if Xcell, X = cell2mat(X(:)) ; end + +Y = zeros(2*size(X,1)-1,size(X,2)) ; +Y(1:2:end,:) = X ; +Y(2:2:end,:) = X(1:end-1,:).*(1-curvature)+curvature.*X(2:end,:) ; + +Z = Y ; + +% if X was a cell, convert result back to cell +if Xcell + Y = cell(1,size(X,1)) ; + for i=1:size(Z,1) + Y{i} = Z(i,:) ; + end +end +end \ No newline at end of file
kolia/cones_MC
e493874112d716356e19c70acaf96a67c1553c81
SimTempMCMC builds up temperatures by interpolating successively
diff --git a/SimTempMCMC.m b/SimTempMCMC.m index d6f4786..2a21ebf 100644 --- a/SimTempMCMC.m +++ b/SimTempMCMC.m @@ -1,68 +1,86 @@ function [X,ST] = SimTempMCMC( X, PROB, ST , j ) % Simulated Tempering + Wang-Landau update % simTempMCMC : We update the state, and then update the temperature % ST (Simulated Tempering) is a structure that contains fields: -% T : cell array of temperatures -% i : index of current temperature -% g : current weights -% n : number of current iteration +% T : cell array of temperatures +% i : index of current temperature +% lg : current log weights +% n : number of current iteration if ~isfield(ST,'n' ) , ST.n = 1 ; end if ~isfield(ST,'i' ) , ST.i = 1 ; end if ~isfield(ST,'lg' ) , ST.lg = zeros(length(ST.T),1) ; end if ~isfield(ST,'f' ) , ST.f = zeros(length(ST.T),1) ; end -if ~isfield(ST,'gamma0') , ST.gamma0 = 1e25 ; end +if ~isfield(ST,'gamma0') , ST.gamma0 = 1e128 ; end if ~isfield(ST,'k' ) , ST.k = 0 ; end if ~isfield(ST,'avg_p' ) , ST.avg_p = zeros(length(ST.T),1) ; end if ~isfield(ST,'Q' ) ST.Q = ones(length(ST.T),1) ; ST.Q(2:end-1) = 0.5 ; end -ST.gamma = ST.gamma0 ; +ST.gamma = ST.gamma0 ; +ST.lg_curv = 0.3 * ones(length(ST.T)-1,1) ; -%step 4 (sample T) +% sample T % proposed change in temperature index is +1 or -1 with prob 0.5 if ST.i(j) == 1 proposed_i = 2 ; elseif ST.i(j) == length(ST.T) proposed_i = length(ST.T)-1 ; else proposed_i = ST.i(j) + 2* ( unifrnd(0,1)>0.5 ) - 1 ; end -%calculate probability of accepting new T -new_ll = calculate_LL( X , PROB , ST.T{proposed_i}) ; -paccept = min(1, ST.Q(ST.i(j))/ST.Q(proposed_i)*exp(new_ll-X.ll + ST.lg(ST.i(j)) - ST.lg(proposed_i)) ) ; +% calculate probability of accepting new T +new_ll = calculate_LL( X , PROB , ST.T{proposed_i}) ; +paccept = min(1, ST.Q(ST.i(j))/ST.Q(proposed_i)*... + exp(new_ll-X.ll + ST.lg(ST.i(j)) - ST.lg(proposed_i)) ) ; ST.avg_p( ST.i(j) ) = ST.avg_p( ST.i(j) ) + paccept ; -%accept new state with probability p +% accept new state with probability p accept = rand() < paccept ; if accept ST.i(j) = proposed_i ; X.ll = new_ll ; end ST.f(ST.i(j)) = ST.f(ST.i(j)) + 1 ; -%step 5 update adaptive weights +% update adaptive weights if numel(ST.f)*ST.f/sum(ST.f)>0.8 % fprintf('\nST.lg:') ; fprintf(' %g',ST.lg) % fprintf('\nST.f:') ; fprintf(' %g',ST.f/s) ST.k = ST.k+1 ; ST.gamma = (1 + ST.gamma0).^(1/(2*ST.k)) - 1 ; - fprintf('\navg_acceptance') ; fprintf(' %g',ST.avg_p./ST.f) ; - ST.f = ST.f * 0 ; - ST.avg_p = ST.avg_p * 0 ; +% fprintf('\navg_acceptance') ; fprintf(' %g',ST.avg_p./ST.f) ; + + if isfield(ST,'max_temps') && 2*length(ST.T)-1 <= ST.max_temps + [ST.T,T] = refine_mesh(ST.T , ST.curvature) ; + ST.lg = spline(1:length(ST.lg),ST.lg,1:0.5:length(ST.lg)) ; + ST.f = zeros(length(ST.T),1) ; + ST.avg_p = zeros(length(ST.T),1) ; + ST.Q = ones( length(ST.T),1) ; + + ST.curvature = 1./(1+sqrt((1-ST.curvature)/ST.curvature)) ; + + ST.Q(2:end-1)= 0.5 ; + ST.i = 2*ST.i-1 ; + end fprintf('\n\nNEW GAMMA: %g (k=%d)\n',ST.gamma,ST.k) + fprintf('\n+ %d inverse temperatures beta:\n',size(T,1)) + fprintf('%4.2f ',T(:,1)' ) + fprintf('\n\n+ %d powers delta:\n',size(T,1)) + fprintf('%4.2f ',T(:,2)') + fprintf('\n') end -ST.lg(ST.i(j)) = ST.lg(ST.i(j)) + log(1 + ST.gamma); +ST.lg(ST.i(j)) = ST.lg(ST.i(j)) + log(1 + ST.gamma) ; ST.n = ST.n + 1 ; % reshift ST.lg every 1000 iterations, for sanity if ~mod(ST.n,1000) , ST.lg = ST.lg - mean(ST.lg) ; end end \ No newline at end of file
kolia/cones_MC
e52e83078f0f271f522fd9f15172eb47584ba3e0
routine change
diff --git a/main.m b/main.m index f35e0ed..5d6fb3c 100644 --- a/main.m +++ b/main.m @@ -1,56 +1,56 @@ cone_map.datafolder = 'peach' ; addpath(genpath(pwd)) %% LOAD DATA load(sprintf('%s/stas', cone_map.datafolder)) % stas struct contains fields: % stas(i).spikes : the list of spike times of cell i % stas(i).spatial : the spatial component of the STA of cell i load(sprintf('%s/cone_params', cone_map.datafolder)) % cone_params struct fields: % stimulus_variance : variance of each stim pixel color chanel (usually 1) % supersample : the integer number of cone positions per pixel % width/height (usually 4) % colors : 3x3 matrix of cone color sensitivities % support_radius : radius of cone receptive field filter (usually 3.0) % repulsion_radii % restrict the stimulus to a region of interest (if memory is a problem) % stas = restrict_ROI( stas, [1 160], [1 160] ) ; %% CONE_MAP contains parameters and preprocessed data structures % calculate sparsity pattern (for MCMC) and initial LL map (for greedy) cone_map = exact_LL_setup(stas,cone_params,cone_map) ; % How many MCMC/CAST iterations? -cone_map.N_iterations = 2e4 ; +cone_map.N_iterations = 5e5 ; cone_map.max_time = 4e5 ; % in seconds % % override defaults: plot, display, and save every ? iterations (0 = never) % cone_map.plot_every = 1000 ; % cone_map.display_every = 20 ; % cone_map.save_every = 0 ; % string identifying this cone_map problem; useful for naming saved results cone_map.description = cone_map_string( cone_map ) ; %% run GREEDY, MCMC or CAST locally % result = GREEDY(cone_map) ; save(['greed_' cone_map.description],'result') ; result = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'result') ; % result = CAST(cone_map) ; save(['cast_' cone_map.description], 'result') ; %% some plots make_plots( result ) %% %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: % % start by cloning AGRICOLA from https://github.com/kolia/agricola % addpath('../agricola') % N = 30 ; ids = cell(1,N) ; for i=1:length(ids) , ids{i} = {i} ; end % cone_map.save_disk_space = true ; % strip results of large fields % % PBS.l.mem = '1500mb' ; % PBS.l.walltime = '70:00:00' ; % sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; % sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; % sow(['greed_' base_str],@( )GREEDY(cone_map)) ; \ No newline at end of file
kolia/cones_MC
9c6e0fe370e95f75a6995b6e01f048d4d094da20
slight change in LL, helps apparently
diff --git a/calculate_LL.m b/calculate_LL.m index 6ad3583..3c1b9e8 100644 --- a/calculate_LL.m +++ b/calculate_LL.m @@ -1,10 +1,10 @@ function ll = calculate_LL( X , PROB , T ) if X.N_cones>0 ll = 0.5 * T(1) * (sum( PROB.N_cones_terms .* sum(abs(X.sparse_STA_W_state)>0,2)) + ... - sum( PROB.quad_factors .* X.contributions.^T(2) ) ) ; + sum( (PROB.quad_factors .* X.contributions).^T(2) ) ) ; else ll = 0 ; end end \ No newline at end of file
kolia/cones_MC
558a332ed3c623d924d52c780fcbf84d7c18bed0
SimTempMCMC.m was incorrect, now implements Wang-Landau properly
diff --git a/SimTempMCMC.m b/SimTempMCMC.m index ecbdb09..d6f4786 100644 --- a/SimTempMCMC.m +++ b/SimTempMCMC.m @@ -1,41 +1,68 @@ -function ST = SimTempMCMC( X, PROB, LL, ST , j ) +function [X,ST] = SimTempMCMC( X, PROB, ST , j ) % Simulated Tempering + Wang-Landau update % simTempMCMC : We update the state, and then update the temperature % ST (Simulated Tempering) is a structure that contains fields: % T : cell array of temperatures % i : index of current temperature % g : current weights % n : number of current iteration -if ~isfield(ST,'n' ) , ST.n = 1 ; end -if ~isfield(ST,'i' ) , ST.i = length(ST.T) ; end -if ~isfield(ST,'g' ) , ST.g = ones(length(ST.T),1) ; end +if ~isfield(ST,'n' ) , ST.n = 1 ; end +if ~isfield(ST,'i' ) , ST.i = 1 ; end +if ~isfield(ST,'lg' ) , ST.lg = zeros(length(ST.T),1) ; end +if ~isfield(ST,'f' ) , ST.f = zeros(length(ST.T),1) ; end +if ~isfield(ST,'gamma0') , ST.gamma0 = 1e25 ; end +if ~isfield(ST,'k' ) , ST.k = 0 ; end +if ~isfield(ST,'avg_p' ) , ST.avg_p = zeros(length(ST.T),1) ; end +if ~isfield(ST,'Q' ) + ST.Q = ones(length(ST.T),1) ; + ST.Q(2:end-1) = 0.5 ; +end + +ST.gamma = ST.gamma0 ; %step 4 (sample T) % proposed change in temperature index is +1 or -1 with prob 0.5 -di = 2* ( unifrnd(0,1)>0.5 ) - 1 ; -% make sure proposed_i is between 1 and length(ST.T) -proposed_i = min( max( 1 , ST.i(j) + di ) , length(ST.T) ) ; +if ST.i(j) == 1 + proposed_i = 2 ; +elseif ST.i(j) == length(ST.T) + proposed_i = length(ST.T)-1 ; +else + proposed_i = ST.i(j) + 2* ( unifrnd(0,1)>0.5 ) - 1 ; +end %calculate probability of accepting new T -paccept = min(1, LL(X, PROB, ST.T{proposed_i})* ST.g(ST.i(j) ) ... - /(LL(X, PROB, ST.T{ST.i(j) })* ST.g(proposed_i))); +new_ll = calculate_LL( X , PROB , ST.T{proposed_i}) ; +paccept = min(1, ST.Q(ST.i(j))/ST.Q(proposed_i)*exp(new_ll-X.ll + ST.lg(ST.i(j)) - ST.lg(proposed_i)) ) ; + +ST.avg_p( ST.i(j) ) = ST.avg_p( ST.i(j) ) + paccept ; %accept new state with probability p -if unifrnd(0,1) < paccept +accept = rand() < paccept ; +if accept ST.i(j) = proposed_i ; + X.ll = new_ll ; end -%step 5 update adaptive weights MAY NEED TO MAKE A LIST INSTEAD OF A -%NUMBER (use log g) -%logG = log(g); -%logGnew = logG; -%logGnew(ind) = logG(ind) + log(1+gamma); -%gnew(ind) = exp(logGnew(ind)); -ST.g(ST.i(j)) = ST.g(ST.i(j))*(1 + 1/sqrt(1+ST.n)); +ST.f(ST.i(j)) = ST.f(ST.i(j)) + 1 ; + +%step 5 update adaptive weights +if numel(ST.f)*ST.f/sum(ST.f)>0.8 +% fprintf('\nST.lg:') ; fprintf(' %g',ST.lg) +% fprintf('\nST.f:') ; fprintf(' %g',ST.f/s) + ST.k = ST.k+1 ; + ST.gamma = (1 + ST.gamma0).^(1/(2*ST.k)) - 1 ; + fprintf('\navg_acceptance') ; fprintf(' %g',ST.avg_p./ST.f) ; + ST.f = ST.f * 0 ; + ST.avg_p = ST.avg_p * 0 ; + fprintf('\n\nNEW GAMMA: %g (k=%d)\n',ST.gamma,ST.k) +end + +ST.lg(ST.i(j)) = ST.lg(ST.i(j)) + log(1 + ST.gamma); + ST.n = ST.n + 1 ; -% renormalize ST.g every 100 iterations, for sanity -if ~mod(ST.n,100) , ST.g = ST.g * length(ST.g) / sum(ST.g) ; end +% reshift ST.lg every 1000 iterations, for sanity +if ~mod(ST.n,1000) , ST.lg = ST.lg - mean(ST.lg) ; end end \ No newline at end of file
kolia/cones_MC
be47b7a0a5f0e66e6d9dffa273e693d22aadcc9d
move.m returns single proposal, calculated reverse proposal probe, for MH
diff --git a/move.m b/move.m index eed3160..e6340a1 100644 --- a/move.m +++ b/move.m @@ -1,131 +1,132 @@ -function samples = move( X , PROB , T , n ) -% samples = move( X , PROB , n ) -% Draw n trial flips starting from state X. +function sample = move( X , PROB , T ) +% sample = move( X , PROB ) +% Draw a trial flips starting from state X; calculated forward and backward +% proposal probabilities. % Two types of move are produced: additions of cones, and moves or changes % in color of existing cones. -% First, n spatial locations are drawn. They are drawn from existing cone -% locations with probability PROB.q, and from the uniform distribution with -% probability (1-PROB.q). -% For each trial location i, if no cone of any color is at that position, -% then the corresponding trial is a placement of a single randomly colored -% cone at that location. -% If a cone of any color is at location i, then the corresponding +% First, a spatial location is drawn. It is drawn from existing cone +% locations with probability PROB.q, and from the set of locations that are +% available for adding a cone with probability (1-PROB.q). +% For the trial location, if no cone of any color is at that position, +% then the trial is a placement of a single randomly colored cone at that +% location. +% If a cone of any color is at the location, then the corresponding % trial is a change of color or deletion with probability 1/7, or a move of % the cone to a neighboring location, each with probability 1/7. If the % cone lies on the border of the domain, 7 is replaced by 3 + the number of % adjacent positions that are within the border. -% For speed, backward probabilities are not calculated: this sampler should -% only be used with the symmetric rule, not with metropolis-hastings. - -% check_X(X) if nargin<4 , n = 1 ; end M0 = PROB.M0 * PROB.SS ; M1 = PROB.M1 * PROB.SS ; % current cones in X [cx,cy] = find(X.state) ; -% initialize samples -samples = cell(X.N_cones*7+n,1) ; -ns = 0 ; +% probability of changing existing cone +if X.N_cones >= X.maxcones % not adding any more cones + q = 1 ; +else + q = PROB.q ; +end + % propose moves of existing cones -if X.N_cones > 0 - % draw n_moved existing cones - n_moved = binornd(n,PROB.q) ; - cones = randi( X.N_cones , 1 , n_moved ) ; +if X.N_cones>0 && rand()<q -% cones = 1:X.n_cones ; + cone = randi(X.N_cones,1) ; - for s=1:n_moved -% for s=1:X.n_cones - i = cx(cones(s)) ; - j = cy(cones(s)) ; - color = X.state(i,j) ; - - % probability of choosing this location - p = 1/X.N_cones * PROB.q ; + i = cx(cone) ; + j = cy(cone) ; + color = X.state(i,j) ; + + % number of legal moves for this cone, being careful about borders + nforward = 4 - PROB.outofbounds(i,j) + PROB.N_colors ; + + % cone deletion + if rand()<1/nforward + sample = flip_LL( X , [i j 0] , PROB , T ) ; + + % number of available new cone locations after removing cone + [~,indices] = not_excluded( X, i, j ) ; + excluded = X.excluded ; + excluded(indices) = false ; + N_not_excluded = M0*M1 - nnz(excluded) ; - % number of legal moves for this cone, being careful about borders - nforward = 4 - PROB.outofbounds(i,j) + PROB.N_colors ; - - % for each adjacent location, add trial move to that location - for d=1:4 % move N , E , S , W - ni = i + X.masks{1,1}.shift{d}(1) ; - nj = j + X.masks{1,1}.shift{d}(2) ; - if ni > 0 && ni <= M0 && nj>0 && nj <= M1 - ns = ns+1 ; -% samples{ns} = move_cone( X , i , j , d , PROB , T ) ; - samples{ns} = propagate_action(X,i+(j-1)*X.M0,d,PROB,T) ; - samples{ns}.forward_prob = p/nforward ; - end - end + forward_probability = 1/X.N_cones * q / nforward ; + + % probability of proposing reverse move: re-adding cone + reverse_probability = (1-PROB.q)/(N_not_excluded*PROB.N_colors) ; - % cone deletion - ns = ns+1 ; - samples{ns} = flip_LL( X , [i j 0] , PROB , T ) ; - samples{ns}.forward_prob = p/nforward ; -% check_X(samples{ns}) - - % change of color, without moving - deleted = ns ; - ne = not_excluded(X,i,j) ; - for cc=setdiff( 1:X.N_colors , color ) - ns = ns+1 ; - if ne && ~isempty(PROB.sparse_struct{i,j,cc}) - samples{ns} = flip_LL( samples{deleted} , [i j cc] , PROB , T ) ; -% check_X(samples{ns}) + % proposal probability bias + sample.proposal_bias = forward_probability/reverse_probability ; + + else + % change cone color + if rand()<(PROB.N_colors-1)/(nforward-1) + new_color = setdiff( 1:X.N_colors , color ) ; + new_color = new_color( randi(numel(new_color)) ) ; + + ne = not_excluded(X,i,j) ; + if ne && ~isempty(PROB.sparse_struct{i,j,new_color}) + sample = flip_LL( X , [i j new_color] , PROB , T ) ; else - samples{ns} = samples{deleted} ; - samples{ns}.ll = -Inf ; + sample = X ; + sample.ll = -Inf ; end - samples{ns}.forward_prob = p/nforward ; + + % shift cone + else + + % choose shift direction that is within bounds + while 1 + d = randi(4,1) ; + ni = i + X.masks{1,1}.shift{d}(1) ; + nj = j + X.masks{1,1}.shift{d}(2) ; + if ni > 0 && ni <= M0 && nj>0 && nj <= M1 + break ; + end + end + sample = propagate_action(X,i+(j-1)*X.M0,d,PROB,T) ; end + % proposal probability bias + sample.proposal_bias = 1 ; end + else - n_moved = 0 ; -end + + % sample unoccupied locations, propose cone additions + possible = find(~X.excluded & PROB.has_evidence) ; + [i,j] = ind2sub([M0 M1],possible(randi(numel(possible)))) ; -% sample unoccupied locations, propose cone additions -while ns <= n - n_moved - ex = find(~X.excluded & PROB.has_evidence) ; - [i,j] = ind2sub([M0 M1],ex(randi(numel(ex)))) ; -% i = ij(1) ; -% j = ij(2) ; -% i = randi( M0 , 1 ) ; -% j = randi( M1 , 1 ) ; - - if ~X.state(i+M0*(j-1)) - % probability of choosing this location & color - p = (1-PROB.q)/((M0*M1 - X.N_cones)*PROB.N_colors) ; - - if X.N_cones >= X.maxcones - % if maxcones has been reached, delete a random cone first - cone = randi( X.N_cones , 1 , 1 ) ; - X = flip_LL( X, [cx(cone) cy(cone) 0], PROB, T ) ; - p = p/X.N_cones ; - end + % forward probability of choosing this location & color + forward_probability = (1-q)/(numel(possible) * PROB.N_colors) ; - % propose addition of new cone of each color - ne = not_excluded(X,i,j) ; - for c=1:PROB.N_colors - ns = ns+1 ; - if ne && ~isempty(PROB.sparse_struct{i,j,c}) - samples{ns} = flip_LL( X , [i j c] , PROB , T ) ; -% check_X(samples{ns}) - else - samples{ns} = X ; - samples{ns}.ll = -Inf ; - end - samples{ns}.forward_prob = p ; - end + % choose new color + new_color = randi(PROB.N_colors) ; + + % propose addition of new cone of each color + ne = not_excluded(X,i,j) ; + if ne && ~isempty(PROB.sparse_struct{i,j,new_color}) + sample = flip_LL( X , [i j new_color] , PROB , T ) ; + else + sample = X ; + sample.ll = -Inf ; + end + + % probability of proposing reverse move: re-deleting cone + if X.N_cones >= X.maxcones % not adding any more cones + q = 1 ; + else + q = PROB.q ; end + nforward = 4 - PROB.outofbounds(i,j) + PROB.N_colors ; + reverse_probability = 1/X.N_cones * q / nforward ; + + % proposal probability bias + sample.proposal_bias = forward_probability/reverse_probability ; end -samples = samples(1:ns) ; -% fprintf('\nDONE sampling trial moves\n') - end \ No newline at end of file
kolia/cones_MC
878e07277e06b81b4ad135a5e67b5b55e7f57df3
restructured swap code
diff --git a/swap/swap_closure.m b/swap/swap_closure.m index 65474a4..a212df5 100644 --- a/swap/swap_closure.m +++ b/swap/swap_closure.m @@ -1,158 +1,53 @@ -function XS = swap_closure( X , T, otherX , oT, PROB ) +function [slowX,fastX,class] = swap_closure( slowX , slowT, fastX , fastT, PROB, class ) % Combine two systems into a single system, summing their log-likelihoods. % This is in preparation for swapping parts of the two systems' % configurations. For this, groups of cells that must be swapped together % are calculated. + +N = numel(slowX.state) ; +Oclass = class(class<=N) ; +Xclass = class(class >N) - N ; +M0 = PROB.M0 * PROB.SS ; +class = [Oclass(:)+N ; Xclass(:)] ; -% check_X(X) -% check_X(otherX) - -% calculate overlaps of X cones on otherX exclusion disks - -% symmetrize relation and calculate transitive closure -N = numel(X.state) ; - -% i = find( otherX.state) ; -% j = find( X.state) ; -R = overlap_relation( otherX , X ) ; - -% EO= logical(sparse(i,i,ones(length(i),1),N,N,3*N)) ; -% EX= logical(sparse(j,j,ones(length(j),1),N,N,3*N)) ; -% R = logical( [ EO R ; R' EX ] ) ; -% R = transitive_closure(R,[i ; N+j],0) ; - -% EO= logical(sparse([],[],[],N,N,N)) ; -% EX= logical(sparse([],[],[],N,N,N)) ; -% RR = logical( [ EO R ; R' EX ] ) ; -% RR = transitive_closure(RR,[i ; N+j],1) ; - -% clear i j - -% get equivalence classes / connected components -% classes_old = equivalence_classes(RR,20) ; - -classes = equivalence_classes_direct(R,50) ; +% fprintf('\t %d,%d',numel(Xclass),numel(Oclass)) ; -if numel(classes)>0 - classes = [{[]} ; classes] ; -else - classes = {[]} ; -end -XS = cell( numel(classes), 1 ) ; +if slowX.maxcones >= slowX.N_cones + numel(Oclass) && ... + slowX.maxcones >= fastX.N_cones + numel(Xclass) -fprintf(' %d',numel(classes)) + xcx = 1+mod(Xclass-1,M0) ; + xcy = 1+floor((Xclass-1)/M0) ; + xcc = slowX.state(Xclass) ; + ocx = 1+mod(Oclass-1,M0) ; + ocy = 1+floor((Oclass-1)/M0) ; + occ = fastX.state(Oclass) ; -keep = [] ; -for m=1:length(XS) - if m>1 - XX = struct ; - XX.state = X.state ; - if isfield(X,'invWW') - XX.invWW = X.invWW ; + for k=1:length(Xclass) + slowX = flip_LL( slowX , [xcx(k) xcy(k) 0] , PROB, slowT ) ; end - if isfield(X,'WW') - XX.WW = X.WW ; + for k=1:length(Oclass) + fastX = flip_LL( fastX , [ocx(k) ocy(k) 0] , PROB, fastT ) ; end - if isfield(X,'dUW_STA') - XX.dUW_STA = X.dUW_STA ; + for k=1:length(Oclass) + slowX = flip_LL( slowX , [ocx(k) ocy(k) occ(k)] , PROB, slowT ) ; end - if isfield(X,'ds_UW_STA') - XX.ds_UW_STA = X.ds_UW_STA ; + for k=1:length(Xclass) + fastX = flip_LL( fastX , [xcx(k) xcy(k) xcc(k)] , PROB, fastT ) ; end - XX.sparse_STA_W_state = X.sparse_STA_W_state ; - XX.contributions = X.contributions ; - XX.N_cones=X.N_cones ; - XX.ll = X.ll ; - XX.diff = X.diff ; - XX.beta = X.beta ; - XX.delta = X.delta ; - XX.LL_history = X.LL_history ; - XX.N_cones_history = X.N_cones_history ; - XX.cputime = X.cputime ; - - OX = struct ; - OX.state = otherX.state ; - if isfield(X,'invWW') - OX.invWW = otherX.invWW ; - end - if isfield(X,'WW') - OX.WW = otherX.WW ; - end - if isfield(X,'dUW_STA') - OX.dUW_STA = otherX.dUW_STA ; - end - if isfield(X,'ds_UW_STA') - OX.ds_UW_STA = otherX.ds_UW_STA ; - end - OX.sparse_STA_W_state = otherX.sparse_STA_W_state ; - OX.contributions = otherX.contributions ; - OX.N_cones=otherX.N_cones ; - OX.ll = otherX.ll ; - OX.diff = otherX.diff ; - OX.beta = otherX.beta ; - OX.delta = otherX.delta ; - OX.LL_history = otherX.LL_history ; - OX.N_cones_history = otherX.N_cones_history ; - OX.cputime = otherX.cputime ; - else - XX = X ; - OX = otherX ; - end - Oclass = classes{m}(classes{m}<=N) ; - Xclass = classes{m}(classes{m} >N) - N ; - -% fprintf('\t %d,%d',numel(Xclass),numel(Oclass)) ; - - if X.maxcones >= X.N_cones + numel(Oclass) && ... - X.maxcones >= otherX.N_cones + numel(Xclass) - - xcx = 1+mod(Xclass-1,X.M0) ; - xcy = 1+floor((Xclass-1)/X.M0) ; - xcc = XX.state(Xclass) ; - - ocx = 1+mod(Oclass-1,X.M0) ; - ocy = 1+floor((Oclass-1)/X.M0) ; - occ = OX.state(Oclass) ; - - for k=1:length(Xclass) - XX = flip_LL( XX , [xcx(k) xcy(k) 0] , PROB, T ) ; - end - for k=1:length(Oclass) - OX = flip_LL( OX , [ocx(k) ocy(k) 0] , PROB, oT ) ; - end - for k=1:length(Oclass) - XX = flip_LL( XX , [ocx(k) ocy(k) occ(k)] , PROB, T ) ; - end - for k=1:length(Xclass) - OX = flip_LL( OX , [xcx(k) xcy(k) xcc(k)] , PROB, oT ) ; - end - - XS{m}.X = XX ; - XS{m}.with = OX ; - XS{m}.ll = XX.ll + OX.ll ; - - keep = [keep m] ; - end -end -XS = XS(keep) ; - - -N = numel(XS) ; -for i=1:N -% check_X(XS{i}.X) -% check_X(XS{i}.with) - XS{i}.forward_prob = 1/N ; +else + slowX = [] ; + fastX = [] ; end -if N==0 - X - otherX - keep - numel(classes) - classes{1} - classes - save(sprintf('crash_dump_%d.mat',randi(100)),'X','otherX','keep','classes','PROB') -end +% if N==0 +% X +% otherX +% keep +% numel(classes) +% classes{1} +% classes +% save(sprintf('crash_dump_%d.mat',randi(100)),'X','otherX','keep','classes','PROB') +% end end \ No newline at end of file diff --git a/swap/swap_step.m b/swap/swap_step.m index 5219aa6..1938058 100644 --- a/swap/swap_step.m +++ b/swap/swap_step.m @@ -1,14 +1,34 @@ -function [X1,X2] = swap_step(X1,T1,X2,T2,PROB) - -% check_X(X1) -% check_X(X2) -swapX = swap_closure( X1, T1, X2 , T2, PROB) ; -% for i=1:numel(swapX) -% check_X(swapX{i}.X) -% check_X(swapX{i}.with) -% end -swapX = flip_MCMC( swapX{1}, swapX(2:end), PROB, {T1 T2} ) ; -X1 = swapX.X ; -X2 = swapX.with ; +function [slowX,fastX] = swap_step(slowX,fastX,PROB,N_times,fastT) + +% check_X(slowX) +% check_X(fastX) + +% calculate overlaps of slowX cones on fastX exclusion disks +R = overlap_relation( fastX , slowX ) ; + +% calculate at most N_times classes +classes = equivalence_classes_direct(R,N_times) ; + +if numel(classes)>0 + % propose swap moves N_times, choosing a different class every time + for i=1:numel(classes) + while 1 + ii = randi(numel(classes)) ; + class = classes{ii} ; + [proposed_slowX,proposed_fastX,class] = ... + swap_closure( slowX, [1 1], fastX, fastT, PROB, class ) ; + if ~isempty(proposed_slowX), break ; end + end + accept = metropolis_hastings( slowX.ll+ fastX.ll,... + proposed_slowX.ll+proposed_fastX.ll, 1) ; +% if accept +% fprintf(' swapdll: %.2f, slowdll: %.2f',... +% proposed_slowX.ll+proposed_fastX.ll-slowX.ll-fastX.ll,... +% proposed_slowX.ll-slowX.ll) ; +% end + [slowX,fastX] = update_swap(slowX,fastX,proposed_slowX,proposed_fastX,accept) ; + if accept, classes{ii} = class ; end + end +end end diff --git a/swap/update_swap.m b/swap/update_swap.m index ef7ef9c..0aace77 100644 --- a/swap/update_swap.m +++ b/swap/update_swap.m @@ -1,79 +1,15 @@ -function X = update_swap(trials,i) - -if i>1 - -% check_X(trials{1}.X) -% check_X(trials{1}.with) - - X.X = trials{1}.X ; - X.X.state = trials{i}.X.state ; - if isfield(trials{i}.X,'invWW') - X.X.invWW = trials{i}.X.invWW ; - end - if isfield(trials{i}.X,'WW') - X.X.WW = trials{i}.X.WW ; - end - if isfield(trials{i}.X,'dUW_STA') - X.X.dUW_STA = trials{i}.X.dUW_STA ; - end - if isfield(trials{i}.X,'ds_UW_STA') - X.X.ds_UW_STA = trials{i}.X.ds_UW_STA ; - end - X.X.sparse_STA_W_state = trials{i}.X.sparse_STA_W_state ; - X.X.contributions = trials{i}.X.contributions ; - X.X.N_cones = trials{i}.X.N_cones ; - X.X.ll = trials{i}.X.ll ; - X.X.diff = trials{i}.X.diff ; - X.X.beta = trials{i}.X.beta ; - X.X.delta = trials{i}.X.delta ; - X.X.LL_history = trials{i}.X.LL_history ; - X.X.N_cones_history = trials{i}.X.N_cones_history ; - X.X.cputime = trials{i}.X.cputime ; - - X.with = trials{1}.with ; - X.with.state = trials{i}.with.state ; - if isfield(trials{i}.with,'invWW') - X.with.invWW = trials{i}.with.invWW ; - end - if isfield(trials{i}.with,'WW') - X.with.WW = trials{i}.with.WW ; - end - if isfield(trials{i}.with,'dUW_STA') - X.with.dUW_STA = trials{i}.with.dUW_STA ; - end - if isfield(trials{i}.with,'ds_UW_STA') - X.with.ds_UW_STA = trials{i}.with.ds_UW_STA ; - end - X.with.sparse_STA_W_state = trials{i}.with.sparse_STA_W_state ; - X.with.contributions = trials{i}.with.contributions ; - X.with.N_cones = trials{i}.with.N_cones ; - X.with.ll = trials{i}.with.ll ; - X.with.diff = trials{i}.with.diff ; - X.with.beta = trials{i}.with.beta ; - X.with.delta = trials{i}.with.delta ; - X.with.LL_history = trials{i}.with.LL_history ; - X.with.N_cones_history = trials{i}.with.N_cones_history ; - X.with.cputime = trials{i}.with.cputime ; - - -% check_X(X.X) -% check_X(X.with) - -else - X = trials{1} ; -end +function [slowX,fastX] = update_swap(slowX,fastX,proposed_slowX,proposed_fastX,accept) % update both X -ii = 2*(i>1) + (i==1) ; -X.X = update_X({trials{1}.X X.X },ii) ; -X.with = update_X({trials{1}.with X.with},ii) ; +slowX = update_X({slowX proposed_slowX},accept+1) ; +fastX = update_X({fastX proposed_fastX},accept+1) ; -if isfield(X.X,'swap') - X.X.swap(X.X.iteration) = true ; +if isfield(slowX,'swap') + slowX.swap(slowX.iteration) = true ; end -if isfield(X.X,'swap') - X.with.swap(X.with.iteration) = true ; +if isfield(fastX,'swap') + fastX.swap(fastX.iteration) = true ; end end \ No newline at end of file
kolia/cones_MC
d38013d33a57370cbb229da6a75355efac889308
CAST and MCMC now use Metropolis-Hastings
diff --git a/CAST.m b/CAST.m index 0ec3303..3bffe18 100644 --- a/CAST.m +++ b/CAST.m @@ -1,194 +1,208 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'plot_every' , 1000 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'profile_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'N_fast' , 1 ) default( cone_map , 'swap_N_times' , 50 ) default( cone_map , 'save_disk_space', false ) % default progression of inverse temperatures cone_map.min_delta = 0.2 ; cone_map.min_beta = 0.3 ; % cone_map.betas = -0.1 + make_deltas( cone_map.min_beta , 1, 4, 20 ) ; cone_map.betas = make_deltas( cone_map.min_beta , 1, 4, 100 ) ; cone_map.deltas = make_deltas( cone_map.min_delta , 1, 4, 100 ) ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps N_temp = length(cone_map.betas) ; ST.T = cell(N_temp,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; for i=1:N_temp ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; end % ST.g is used by Wang-Landau scheme in SimTempMCMC.m ST.lg = ones(1,N_temp) ; %exp(100*(1:N_temp)/N_temp) ; %((1:N_temp)/N_temp*(1-cone_map.min_beta)*1e5) .^ 0.3 ; % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP fprintf('\n\nSTARTING CAST with' ) fprintf('\n\n+ different inverse temperatures beta:\n') fprintf('%4.2f ',cone_map.betas ) fprintf('\n\n+ different powers delta:\n') fprintf('%4.2f ',cone_map.deltas) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} - X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; + proposal = move( X{1}, cone_map , [1 1]) ; + accept = metropolis_hastings( X{1}.ll, proposal.ll, proposal.proposal_bias ) ; + X{1} = update_X( {X{1}; proposal}, accept+1 ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast - X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... - cone_map, {ST.T{ST.i(j)}} ) ; + proposal = move( X{1+j}, cone_map , ST.T{ST.i(j)}) ; + accept = metropolis_hastings( X{1}.ll, proposal.ll, proposal.proposal_bias ) ; + X{1+j} = update_X( {X{1+j}; proposal}, accept+1 ) ; end - + for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 - if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 - old_ll = X{1}.ll ; - [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; - if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end + if isfield(ST,'k') && ST.k>1 && ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 + old_ll = X{1}.ll ; + old_fast = X{2}.ll ; + [X{1},X{1+j}] = swap_step(X{1},X{1+j},cone_map, swap_N_times, ST.T{1}) ; +% if old_ll ~= X{1}.ll +% fprintf(' dLL : %.2f',X{1}.ll-old_ll) ; +% end +% fprintf(' old_ll: %.2f slow : %.2f fast : %.2f ',old_ll,X{1}.ll,X{2}.ll) ; + fprintf(' SWAPDLL: %.2f, SLOWDLL: %.2f',... + X{1}.ll+X{2}.ll-old_ll-old_fast,... + X{1}.ll-old_ll) ; end % update temperature step - ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; + [X{1+j},ST] = SimTempMCMC( X{1+j}, cone_map, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) + props = numel(ST.f)*ST.f/sum(ST.f) ; +% fprintf('\nST.lg:') ; fprintf(' %g',ST.lg) +% fprintf('\nST.f:') ; fprintf(' %g',props) + fprintf(' min ST.f %g >? 0.8',min(props)) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) plot_cones_matlab( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X{1},{'contact'}) ; try to_save.X = rmfield(X{1},{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; if ~mod(jj,save_every) save(sprintf('cast_result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end diff --git a/MCMC.m b/MCMC.m index 4d37a5e..a0244da 100644 --- a/MCMC.m +++ b/MCMC.m @@ -1,130 +1,131 @@ function to_save = MCMC( cone_map , ID ) % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'plot_every' , 0 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'save_disk_space', false ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('MCMC.m') ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end % MAIN MCMC LOOP fprintf('\n\nMCMC progress:') t = cputime ; tic n_runs = 1 ; %% initialization with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') ; % initialize MCMC loop X = cone_map.initX ; runbest = X ; runbest.i = 1 ; jj = 1 ; cone_map.bestX = {} ; n_best = 1 ; % tell update_X to record accepted moves; used to replay chain and plots X.dX = sparse([],[],[],N_iterations,3*X.maxcones) ; %% main MCMC loop while 1 % trials{i} is a proposed new configuration; each contains a new ll - trials = move(X, cone_map, [1 1]) ; + proposal = move(X, cone_map, [1 1]) ; - % choose one of the candidates, update_X its data structures - X = flip_MCMC( X, trials, cone_map, {[1 1]} ) ; + % accept or reject move, update_X + accept = metropolis_hastings( X.ll, proposal.ll, proposal.proposal_bias ) ; + X = update_X( {X; proposal}, accept+1 ) ; % keep track of best configuration encountered if X.ll>runbest.ll runbest = X ; runbest.i = jj ; end % reinitialize to cone_map.initX if MCMC becomes stuck if jj - runbest.i > cone_map.M0*cone_map.M1/3 % use less disk space and memory: remove large data structures runbest = rmfield(runbest,{'masks','contact'}) ; try runbest = rmfield(runbest,'invWW') ; end try runbest = rmfield(runbest,{'LL_history','cputime','N_cones_history','dX','excluded','sparse_STA_W_state'}) ; end % record current best confguration before reinitializing cone_map.bestX{n_best} = runbest ; n_best = n_best + 1 ; % reinitialize fprintf('reinitializing...\n') runbest = cone_map.initX ; runbest.LL_history = X.LL_history ; runbest.N_cones_history = X.N_cones_history ; runbest.cputime = X.cputime ; runbest.iteration = X.iteration ; runbest.i = jj ; n_runs = n_runs + 1 ; X = runbest ; end % DISPLAY to stdout if ~mod(jj,display_every) fprintf('Iter%4d of %d %4d cones %6.0f L %6.0f best %8.2f sec\n',... jj,N_iterations,numel(find(X.state>0)),X.ll,... runbest.ll,toc) tic end % PLOT if ~mod(jj,plot_every) figure(h) plot_cones_matlab( X.state , cone_map ) ; title( sprintf('After %d MCMC iterations',jj),'FontSize' , 24 ) % set(get(gca,'Title'),'Visible','on') drawnow end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X,{'contact'}) ; try to_save.X = rmfield(X,{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end if ~mod(jj,save_every) save(sprintf('result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end diff --git a/metropolis_hastings.m b/metropolis_hastings.m new file mode 100644 index 0000000..7997add --- /dev/null +++ b/metropolis_hastings.m @@ -0,0 +1,6 @@ +function accept = metropolis_hastings( old_ll, new_ll, proposal_bias ) + +p_accept = min( 1, exp( new_ll - old_ll ) / proposal_bias ) ; +accept = rand() < p_accept ; + +end \ No newline at end of file
kolia/cones_MC
d0e91f19a27f4c4b4e0d4f6ccbbb99e9752e7d75
parameter tweaks in CAST
diff --git a/CAST.m b/CAST.m index 84385cb..0ec3303 100644 --- a/CAST.m +++ b/CAST.m @@ -1,194 +1,194 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'plot_every' , 1000 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'profile_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'N_fast' , 1 ) default( cone_map , 'swap_N_times' , 50 ) default( cone_map , 'save_disk_space', false ) % default progression of inverse temperatures cone_map.min_delta = 0.2 ; cone_map.min_beta = 0.3 ; % cone_map.betas = -0.1 + make_deltas( cone_map.min_beta , 1, 4, 20 ) ; cone_map.betas = make_deltas( cone_map.min_beta , 1, 4, 100 ) ; cone_map.deltas = make_deltas( cone_map.min_delta , 1, 4, 100 ) ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps N_temp = length(cone_map.betas) ; ST.T = cell(N_temp,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; for i=1:N_temp ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; end % ST.g is used by Wang-Landau scheme in SimTempMCMC.m -ST.g = exp(-3.1035+0.2268*(1:N_temp)) ; % from converged g of previous runs +ST.lg = ones(1,N_temp) ; %exp(100*(1:N_temp)/N_temp) ; %((1:N_temp)/N_temp*(1-cone_map.min_beta)*1e5) .^ 0.3 ; % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP fprintf('\n\nSTARTING CAST with' ) fprintf('\n\n+ different inverse temperatures beta:\n') fprintf('%4.2f ',cone_map.betas ) fprintf('\n\n+ different powers delta:\n') fprintf('%4.2f ',cone_map.deltas) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... cone_map, {ST.T{ST.i(j)}} ) ; end for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 old_ll = X{1}.ll ; [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end end % update temperature step ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) plot_cones_matlab( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X{1},{'contact'}) ; try to_save.X = rmfield(X{1},{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; if ~mod(jj,save_every) save(sprintf('cast_result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end
kolia/cones_MC
d4ace03ab4576f74f4604d08e441d8978d52be0a
parameter tweaks in CAST
diff --git a/CAST.m b/CAST.m index f09cae3..84385cb 100644 --- a/CAST.m +++ b/CAST.m @@ -1,193 +1,194 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'plot_every' , 1000 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'profile_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'N_fast' , 1 ) default( cone_map , 'swap_N_times' , 50 ) default( cone_map , 'save_disk_space', false ) % default progression of inverse temperatures -cone_map.min_delta = 0.1 ; -cone_map.min_beta = 0.2 ; -cone_map.betas = make_deltas( cone_map.min_beta , 1, 1, 20 ) ; -cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, 20 ) ; +cone_map.min_delta = 0.2 ; +cone_map.min_beta = 0.3 ; +% cone_map.betas = -0.1 + make_deltas( cone_map.min_beta , 1, 4, 20 ) ; +cone_map.betas = make_deltas( cone_map.min_beta , 1, 4, 100 ) ; +cone_map.deltas = make_deltas( cone_map.min_delta , 1, 4, 100 ) ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps N_temp = length(cone_map.betas) ; ST.T = cell(N_temp,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; for i=1:N_temp ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; end % ST.g is used by Wang-Landau scheme in SimTempMCMC.m ST.g = exp(-3.1035+0.2268*(1:N_temp)) ; % from converged g of previous runs % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP fprintf('\n\nSTARTING CAST with' ) fprintf('\n\n+ different inverse temperatures beta:\n') fprintf('%4.2f ',cone_map.betas ) fprintf('\n\n+ different powers delta:\n') fprintf('%4.2f ',cone_map.deltas) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... cone_map, {ST.T{ST.i(j)}} ) ; end for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 old_ll = X{1}.ll ; [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end end % update temperature step ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) plot_cones_matlab( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X{1},{'contact'}) ; try to_save.X = rmfield(X{1},{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; if ~mod(jj,save_every) save(sprintf('cast_result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end
kolia/cones_MC
fb64809680e12f5f61c4b258d685130f4569ef3f
MCMC_step unused.
diff --git a/CAST.m b/CAST.m index 0b8a54e..f09cae3 100644 --- a/CAST.m +++ b/CAST.m @@ -1,192 +1,193 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'plot_every' , 1000 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'profile_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'N_fast' , 1 ) +default( cone_map , 'swap_N_times' , 50 ) default( cone_map , 'save_disk_space', false ) % default progression of inverse temperatures cone_map.min_delta = 0.1 ; cone_map.min_beta = 0.2 ; cone_map.betas = make_deltas( cone_map.min_beta , 1, 1, 20 ) ; cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, 20 ) ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps N_temp = length(cone_map.betas) ; ST.T = cell(N_temp,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; for i=1:N_temp ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; end % ST.g is used by Wang-Landau scheme in SimTempMCMC.m ST.g = exp(-3.1035+0.2268*(1:N_temp)) ; % from converged g of previous runs % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP fprintf('\n\nSTARTING CAST with' ) fprintf('\n\n+ different inverse temperatures beta:\n') fprintf('%4.2f ',cone_map.betas ) fprintf('\n\n+ different powers delta:\n') fprintf('%4.2f ',cone_map.deltas) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... cone_map, {ST.T{ST.i(j)}} ) ; end for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 old_ll = X{1}.ll ; [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end end % update temperature step ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) plot_cones_matlab( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X{1},{'contact'}) ; try to_save.X = rmfield(X{1},{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; if ~mod(jj,save_every) save(sprintf('cast_result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end diff --git a/MCMC_step.m b/MCMC_step.m deleted file mode 100644 index 53fb1b0..0000000 --- a/MCMC_step.m +++ /dev/null @@ -1,4 +0,0 @@ -function X = MCMC_step(X,PROB,T) -LL = @(x)get_LL(x,PROB,T) ; -X = flip_MCMC( X, move( X, PROB , T), @update_X, LL ) ; -end
kolia/cones_MC
0f8f0349152a1c7b9589eeb16d056f279bf5df2a
use m2html for documentation
diff --git a/README.md b/README.md index ca01c4b..94619a6 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,50 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - `stas(i).spikes` the list of spike times of cell i - `stas(i).spatial` the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - `supersample` : the integer number of cone positions per pixel width/height (usually 4) - `colors` : 3x3 matrix of cone color sensitivities - `support_radius` : radius of cone receptive field filter (usually 3.0) - `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data OUTPUTS ------- the current `main.m` saves results from GREEDY.m, MCMC.m and CAST.m to the current folder. a new folder is created by `make_plots.m` reflecting the name of the dataset; all appropriate plots are placed in it. some plots are in .svg format; in order for these plots to be automatically converted to pdf, there must be a folder called `batik/` containing a working version of [Apache Batik](http://xmlgraphics.apache.org/batik/download.cgi) in the same directory as `main.m`. one of the plots for MCMC and CAST output is `dancing_cones_movie.svg`; this movie can be viewed by opening it in a modern browser. DOCUMENTATION ------------- -most important files are commented; -[M2HTML](http://www.artefact.tk/software/matlab/m2html/) is your friend \ No newline at end of file +most important files are commented; [M2HTML](http://www.artefact.tk/software/matlab/m2html/) is your friend \ No newline at end of file
kolia/cones_MC
8808c12b005898e4ac0ed97b825060641efe52aa
m2html documentation; it works well…
diff --git a/README.md b/README.md index 76c7762..ca01c4b 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,51 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - `stas(i).spikes` the list of spike times of cell i - `stas(i).spatial` the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - `supersample` : the integer number of cone positions per pixel width/height (usually 4) - `colors` : 3x3 matrix of cone color sensitivities - `support_radius` : radius of cone receptive field filter (usually 3.0) - `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data OUTPUTS ------- the current `main.m` saves results from GREEDY.m, MCMC.m and CAST.m to the current folder. a new folder is created by `make_plots.m` reflecting the name of the dataset; all appropriate plots are placed in it. some plots are in .svg format; in order for these plots to be automatically converted to pdf, there must be a folder called `batik/` containing a working version of [Apache Batik](http://xmlgraphics.apache.org/batik/download.cgi) in the same directory as `main.m`. one of the plots for MCMC and CAST output is `dancing_cones_movie.svg`; -this movie can be viewed by opening it in a modern browser. \ No newline at end of file +this movie can be viewed by opening it in a modern browser. + + +DOCUMENTATION +------------- + +most important files are commented; +[M2HTML](http://www.artefact.tk/software/matlab/m2html/) is your friend \ No newline at end of file
kolia/cones_MC
eb53a0cf8e9cba10001cad377129e8c087dcae6c
markdowning some more
diff --git a/README.md b/README.md index ab4ae51..6864799 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,26 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - `stas(i).spikes` the list of spike times of cell i - `stas(i).spatial` the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - - `supersample` : the integer number of cone positions per pixel width/height (usually 4) + - `supersample` : the integer number of cone positions per pixel + width/height (usually 4) - `colors` : 3x3 matrix of cone color sensitivities - `support_radius` : radius of cone receptive field filter (usually 3.0 - `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data \ No newline at end of file
kolia/cones_MC
de9ee366d10343b1cb9018ffd54dbbd3ee6d938a
markdowning some more
diff --git a/README.md b/README.md index 527dc6d..ab4ae51 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - `stas(i).spikes` the list of spike times of cell i - `stas(i).spatial` the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - - `supersample` : the integer number of cone positions per pixel width/height (usually 4) - - `colors` : 3x3 matrix of cone color sensitivities - - `support_radius` : radius of cone receptive field filter (usually 3.0) - - `repulsion_radii` + - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) + - `supersample` : the integer number of cone positions per pixel width/height (usually 4) + - `colors` : 3x3 matrix of cone color sensitivities + - `support_radius` : radius of cone receptive field filter (usually 3.0 + - `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data \ No newline at end of file
kolia/cones_MC
aaca3eb449f85da1e5b5c7702f22a78cd5629d48
markdowning some more
diff --git a/README.md b/README.md index fd19302..527dc6d 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,25 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - - + `stas(i).spikes` : the list of spike times of cell i - - + `stas(i).spatial` : the spatial component of the STA of cell i + - `stas(i).spikes` the list of spike times of cell i + - `stas(i).spatial` the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - - `supersample` : the integer number of cone positions per pixel width/height (usually 4) - - `colors` : 3x3 matrix of cone color sensitivities - - `support_radius` : radius of cone receptive field filter (usually 3.0) - - `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data \ No newline at end of file
kolia/cones_MC
02d8f6d29333e849a976ff3fd0002ae6a650019c
mark downing some more
diff --git a/README.md b/README.md index 589a478..fd19302 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,32 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - * `stas(i).spikes` : the list of spike times of cell i + + `stas(i).spikes` : the list of spike times of cell i - * `stas(i).spatial` : the spatial component of the STA of cell i + + `stas(i).spatial` : the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - * `stimulus_variance` : variance of each stim pixel color chanel (usually 1) + - `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - * `supersample` : the integer number of cone positions per pixel width/height (usually 4) + - `supersample` : the integer number of cone positions per pixel width/height (usually 4) - * `colors` : 3x3 matrix of cone color sensitivities + - `colors` : 3x3 matrix of cone color sensitivities - * `support_radius` : radius of cone receptive field filter (usually 3.0) + - `support_radius` : radius of cone receptive field filter (usually 3.0) - * `repulsion_radii` + - `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data \ No newline at end of file
kolia/cones_MC
ce5e910fa7f79fa8d3728b730d8745c01e9fb7f2
markdowning
diff --git a/README.md b/README.md index b85fe25..589a478 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,32 @@ USAGE ------ `main.m` details typical usage: loading data, preparing calculations, running calculations and making some plots. INPUTS ------ place the following two files containing your data in a folder such as `peach/`: - `stas.mat` should contain a struct with fields: - + `stas(i).spikes` : the list of spike times of cell i - + `stas(i).spatial` : the spatial component of the STA of cell i + + * `stas(i).spikes` : the list of spike times of cell i + + * `stas(i).spatial` : the spatial component of the STA of cell i - `cone_params.mat` contains a struct with fields: - + `stimulus_variance` : variance of each stim pixel color chanel (usually 1) - + `supersample` : the integer number of cone positions per pixel width/height (usually 4) - + `colors` : 3x3 matrix of cone color sensitivities - + `support_radius` : radius of cone receptive field filter (usually 3.0) - + `repulsion_radii` + + * `stimulus_variance` : variance of each stim pixel color chanel (usually 1) + + * `supersample` : the integer number of cone positions per pixel width/height (usually 4) + + * `colors` : 3x3 matrix of cone color sensitivities + + * `support_radius` : radius of cone receptive field filter (usually 3.0) + + * `repulsion_radii` see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data \ No newline at end of file
kolia/cones_MC
8f01e29c00624697a3096f05d7213def5975f04b
Shaping up the README.md
diff --git a/README.md b/README.md index d5af7f1..b85fe25 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,25 @@ -USEAGE +USAGE ------ +`main.m` details typical usage: loading data, preparing calculations, +running calculations and making some plots. -Place `peach_data.mat` and `cone_params.mat` in the folder where the code lives. -cd to that folder in matlab and run `main_CAST.m` -This just sets up 'cone_map' for the first time. +INPUTS +------ + +place the following two files containing your data in a folder +such as `peach/`: + +- `stas.mat` should contain a struct with fields: + + `stas(i).spikes` : the list of spike times of cell i + + `stas(i).spatial` : the spatial component of the STA of cell i + +- `cone_params.mat` contains a struct with fields: + + `stimulus_variance` : variance of each stim pixel color chanel (usually 1) + + `supersample` : the integer number of cone positions per pixel width/height (usually 4) + + `colors` : 3x3 matrix of cone color sensitivities + + `support_radius` : radius of cone receptive field filter (usually 3.0) + + `repulsion_radii` -Now run: -`cone_map = CAST(cone_map) ;` \ No newline at end of file +see `fullstas2stas.m` for an example of how to make `stas(i).spatial` from raw data \ No newline at end of file
kolia/cones_MC
9c8d1e512eb3dcc15be59c9fb764bbadcea1312c
routine change
diff --git a/main.m b/main.m index 7095500..f35e0ed 100644 --- a/main.m +++ b/main.m @@ -1,56 +1,56 @@ cone_map.datafolder = 'peach' ; addpath(genpath(pwd)) %% LOAD DATA load(sprintf('%s/stas', cone_map.datafolder)) % stas struct contains fields: % stas(i).spikes : the list of spike times of cell i % stas(i).spatial : the spatial component of the STA of cell i load(sprintf('%s/cone_params', cone_map.datafolder)) % cone_params struct fields: % stimulus_variance : variance of each stim pixel color chanel (usually 1) % supersample : the integer number of cone positions per pixel % width/height (usually 4) % colors : 3x3 matrix of cone color sensitivities % support_radius : radius of cone receptive field filter (usually 3.0) % repulsion_radii % restrict the stimulus to a region of interest (if memory is a problem) % stas = restrict_ROI( stas, [1 160], [1 160] ) ; %% CONE_MAP contains parameters and preprocessed data structures % calculate sparsity pattern (for MCMC) and initial LL map (for greedy) cone_map = exact_LL_setup(stas,cone_params,cone_map) ; % How many MCMC/CAST iterations? -cone_map.N_iterations = 1e4 ; +cone_map.N_iterations = 2e4 ; cone_map.max_time = 4e5 ; % in seconds % % override defaults: plot, display, and save every ? iterations (0 = never) % cone_map.plot_every = 1000 ; % cone_map.display_every = 20 ; % cone_map.save_every = 0 ; % string identifying this cone_map problem; useful for naming saved results cone_map.description = cone_map_string( cone_map ) ; %% run GREEDY, MCMC or CAST locally % result = GREEDY(cone_map) ; save(['greed_' cone_map.description],'result') ; result = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'result') ; % result = CAST(cone_map) ; save(['cast_' cone_map.description], 'result') ; %% some plots make_plots( result ) %% %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: % % start by cloning AGRICOLA from https://github.com/kolia/agricola % addpath('../agricola') % N = 30 ; ids = cell(1,N) ; for i=1:length(ids) , ids{i} = {i} ; end % cone_map.save_disk_space = true ; % strip results of large fields % % PBS.l.mem = '1500mb' ; % PBS.l.walltime = '70:00:00' ; % sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; % sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; % sow(['greed_' base_str],@( )GREEDY(cone_map)) ; \ No newline at end of file
kolia/cones_MC
dd84cfb2869820226ca5fec721988b6c5ac1b3fc
dancing_cones_movie.svg naming for clarity
diff --git a/svg_movie.m b/svg_movie.m index 7ba2c9b..8c631d0 100644 --- a/svg_movie.m +++ b/svg_movie.m @@ -1,78 +1,78 @@ function svg = svg_movie( init , dX , greedy, NICE ) data = 'data = [' ; iterations = zeros(numel(dX),1) ; for j=1:numel(iterations) iterations(j) = size(dX{j},1) ; end for i=[1 nnz(greedy):max(iterations)] idata = cell(numel(dX),4) ; for j=1:numel(dX) if size(dX{j},1)>=i for jj=1:3 , idata{j,jj} = [idata{j,jj} dX{j}(i,jj:3:end)] ; end idata{j,4} = [idata{j,4} repmat(j,[1 numel(idata{j,1})])] ; if i == 1 , idata(j,:) = state2xyc( init{j} , j ) ; end end end if i==max(iterations), break ; end if i == 1 ss = state2xyc(greedy,0) ; for k=1:4 idata{k} = [idata{k} ss{k}] ; end end ith = xycs2js( idata ) ; % if ~isempty( ith ) data = [data '[' ith sprintf('],\n')] ; % end % if ~mod(i,100), fprintf('%d\n',i) ; end end data = [data(1:end-1) ']'] ; scale = 200/max([size(NICE,1) size(NICE,2)]) ; width = min([200 200*size(NICE,2)/size(NICE,1)])+20 ; height = min([200 200*size(NICE,1)/size(NICE,2)])+20 ; evidence = print_evidence( NICE ) ; fid = fopen('dance.js') ; js = sprintf(fread(fid,'*char'),data) ; fclose(fid) ; fid = fopen('dancing_cones_source.svg') ; svg = sprintf(fread(fid,'*char'),3*width,3*height,3*width,3*height,js,scale,scale,evidence) ; fclose(fid) ; % try % lsres = ls('dancing_cones.svg') ; % user_input = input('\nWarning: rm old dancing_cones.svg? (y/n): ','s') ; % switch user_input % case 'y' % delete('dancing_cones.svg') % otherwise % return % end % end -fid = fopen('dancing_cones.svg','w') ; +fid = fopen('dancing_cones_movie.svg','w') ; fwrite(fid,svg) ; fclose(fid) ; end function xyc = state2xyc(state,ii) [x,y,c] = find( state ) ; xyc = {x(:)' y(:)' c(:)' repmat(ii,[1 numel(x)])} ; end function js = xycs2js( xycs ) js = '' ; for i=1:size(xycs,1) inds = find(xycs{i,1}) ; for j=inds js = [js '[ ' num2str(xycs{i,2}(j)) ' , ' num2str(xycs{i,1}(j)) ' , ' ... num2str(xycs{i,3}(j)) ' , ' num2str(xycs{i,4}(j)) '] , '] ; end end if ~isempty(js) , js = js(1:end-5) ; end end \ No newline at end of file
kolia/cones_MC
cb8a6373eab36f5ffc573305a31a2aed9bbd8fa4
added .svg extensions to new make_plots plots
diff --git a/make_plots.m b/make_plots.m index 7ca5d61..9ef5f61 100644 --- a/make_plots.m +++ b/make_plots.m @@ -1,82 +1,82 @@ function make_plots( result, varargin ) % make_plots( X ) % or make_plots( X, cone_map ) % or make_plots( result ) % where X = result.X and cone_map = result % as returned by GREEDY, MCMC, and CAST % % makes whatever plots it can, saves them in folder % ['plots_for_' cone_map_string(result)] if iscell(result) result = result{1} ; end bestX = [] ; if isfield(result,'bestX') bestX = result.bestX ; end if isfield(result,'state') % result is an X X = result ; if ~isempty(varargin) cone_map = result ; else cone_map = remake_cone_map( X ) ; end else % result is a cone_map X = result.X ; if iscell(X), X = X{1} ; end cone_map = rmfield(result,'X') ; end clear result folder_name = cone_map_string(cone_map); % place all plots in a folder filename = ['plots_for_' folder_name] ; mkdir( filename ) here = pwd ; cd(filename) try % if possible, make cone field plot and movie; this requires dX % CAST runs have a dX field that records all moves if isfield( X, 'dX' ) try load('./confident') catch cone_map = remake_initX( cone_map, true ) ; fprintf('making confident.mat\n') % select which iterations to use; 10000 burnin, then every 20 iters selector = @(n) (n>1000) && (mod(n,20) == 0) ; confident = confident_cones( cone_map.initX , X.dX , cone_map , selector ) ; end save('confident','confident') ; svg_movie( {cone_map.initX.state} , {X.dX} , cone_map.initX.state, cone_map.NICE ) ; plot_cone_field( confident , cone_map ) end if ~isempty(bestX) for k=1:numel(bestX) plot_cones_matlab( bestX{k}.state, cone_map ) ; saveas(gcf,sprintf('best_cone_configuration_matlab_%d',k),'jpg') - plot_cone_field( bestX{k} , cone_map, sprintf('best_cone_configuration_%d',k) ) + plot_cone_field( bestX{k} , cone_map, sprintf('best_cone_configuration_%d.svg',k) ) end else plot_cones_matlab( X.state, cone_map ) ; saveas(gcf,'final_cone_configuration_matlab','jpg') - plot_cone_field( X , cone_map, 'final_cone_configuration' ) + plot_cone_field( X , cone_map, 'final_cone_configuration.svg' ) end % % [sta,invww] = denoised_sta( X.initX , X.dX , cone_map, selector ) ; % % make_sta_plots( sta , invww, 'denoised' ) cd(here) catch err cd(here) rethrow(err); end end \ No newline at end of file
kolia/cones_MC
ce80eb765ff68c4959331d7d2f328223732ad32e
gitignoring *.*~ matlab autosave files
diff --git a/.gitignore b/.gitignore index 1bc82e2..1483866 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,18 @@ *.mat *.jpg *.pdf *.png *.eps *.jar *.log batik figs -*.m~ +*.*~ .unison.* cluster__* plots_for_* LL_ncones.svg evidence.png Best_Greed_MCMC_CAST.svg timeline__*.svg *.DS_Store
kolia/cones_MC
435eede7f8efa29b08d8d72ab9395ced5c2389b8
cosmetic
diff --git a/fullstas2stas.m b/fullstas2stas.m index 71d03d2..160f3cf 100644 --- a/fullstas2stas.m +++ b/fullstas2stas.m @@ -1,26 +1,26 @@ load george/full_stas load george/time_courses load george/datarun -rf = zeros( 160, 160, 3 ) ; %0 * squeeze(full_stas{1}(:,:,:,1)) ; +rf = zeros( 160, 160, 3 ) ; k = 0 ; r = struct ; for i=1:376 if numel(full_stas{i})>0 k = k+1 ; r(k).spatial = rf ; r(k).spikes = datarun.spikes{i} ; r(k).cell_index = i ; for c=1:3 timecourse = time_courses{i}(:,c) ./ sqrt( sum(time_courses{i}(:,c).^2) ) ; for j=1:7 r(k).spatial(:,:,c) = r(k).spatial(:,:,c) + ... squeeze(full_stas{i}(81:240,61:220,c,j))*timecourse(j) ; end end end end stas = r ; save('george/stas','stas') \ No newline at end of file
kolia/cones_MC
d59cff2276a8b78306b4958cac6f8dbcb0e1bc4e
plot_cones_field now takes X as well as confidence
diff --git a/make_plots.m b/make_plots.m index b0b2322..7ca5d61 100644 --- a/make_plots.m +++ b/make_plots.m @@ -1,79 +1,82 @@ function make_plots( result, varargin ) % make_plots( X ) % or make_plots( X, cone_map ) % or make_plots( result ) % where X = result.X and cone_map = result % as returned by GREEDY, MCMC, and CAST % % makes whatever plots it can, saves them in folder % ['plots_for_' cone_map_string(result)] if iscell(result) result = result{1} ; end bestX = [] ; if isfield(result,'bestX') bestX = result.bestX ; end if isfield(result,'state') % result is an X X = result ; if ~isempty(varargin) cone_map = result ; else cone_map = remake_cone_map( X ) ; end else % result is a cone_map X = result.X ; if iscell(X), X = X{1} ; end cone_map = rmfield(result,'X') ; end clear result folder_name = cone_map_string(cone_map); % place all plots in a folder filename = ['plots_for_' folder_name] ; mkdir( filename ) here = pwd ; cd(filename) try % if possible, make cone field plot and movie; this requires dX % CAST runs have a dX field that records all moves if isfield( X, 'dX' ) try load('./confident') catch cone_map = remake_initX( cone_map, true ) ; fprintf('making confident.mat\n') % select which iterations to use; 10000 burnin, then every 20 iters selector = @(n) (n>1000) && (mod(n,20) == 0) ; confident = confident_cones( cone_map.initX , X.dX , cone_map , selector ) ; end save('confident','confident') ; svg_movie( {cone_map.initX.state} , {X.dX} , cone_map.initX.state, cone_map.NICE ) ; plot_cone_field( confident , cone_map ) end if ~isempty(bestX) for k=1:numel(bestX) plot_cones_matlab( bestX{k}.state, cone_map ) ; + saveas(gcf,sprintf('best_cone_configuration_matlab_%d',k),'jpg') + plot_cone_field( bestX{k} , cone_map, sprintf('best_cone_configuration_%d',k) ) end else plot_cones_matlab( X.state, cone_map ) ; saveas(gcf,'final_cone_configuration_matlab','jpg') + plot_cone_field( X , cone_map, 'final_cone_configuration' ) end % % [sta,invww] = denoised_sta( X.initX , X.dX , cone_map, selector ) ; % % make_sta_plots( sta , invww, 'denoised' ) cd(here) catch err cd(here) rethrow(err); end end \ No newline at end of file diff --git a/plot_cone_field.m b/plot_cone_field.m index 55434e3..796241c 100644 --- a/plot_cone_field.m +++ b/plot_cone_field.m @@ -1,37 +1,53 @@ -function svg = plot_cone_field( cc , PROB ) +function svg = plot_cone_field( cc , PROB , filename ) +% plot_cone_field( X, cone_map ) +% plot_cone_field( X, cone_map, filename ) +% plot_cone_field( confidence, cone_map ) +% plot_cone_field( confidence, cone_map, filename ) + +if nargin<3 + filename = 'cones_field.svg' ; +end + +if isstruct( cc ) + X = cc ; + cc = zeros(PROB.M0 * PROB.SS, PROB.M1 * PROB.SS, 3) ; + for c=1:3 + cc(:,:,c) = cc(:,:,c) + (X.state==c) ; + end +end alpha = sqrt(sum(cc.^2,3)) ; [x,y,alpha] = find( alpha ) ; [alpha,order] = sort( alpha, 1, 'ascend' ) ; x = x(order) ; y = y(order) ; [M0,M1,~] = size(cc) ; r = floor( 255*cc(x+M0*(y-1)) ./ alpha ) ; g = floor( 255*cc( M0*M1 + x+M0*(y-1)) ./ alpha ) ; b = floor( 255*cc(2*M0*M1 + x+M0*(y-1)) ./ alpha ) ; svg = sprints('<use xlink:href="#1" transform="translate(%f %f)" stroke="rgb(%d,%d,%d)" opacity="%.2f"/>\n', ... y,x,r,g,b,alpha) ; scale = 500/max([size(PROB.NICE,1) size(PROB.NICE,2)]) ; width = min([500 500*size(PROB.NICE,2)/size(PROB.NICE,1)])+20 ; height = min([500 500*size(PROB.NICE,1)/size(PROB.NICE,2)])+20 ; % width = scale*(size(PROB.NICE,2)+ 17) ; % height = scale*(size(PROB.NICE,1)+ 85) ; % scale = 1 ; % [width,height] = size(PROB.NICE) ; evidence = print_evidence( PROB.NICE ) ; % evidence = [sprintf('<g transform="scale(%f,%f)">',scale,scale) evidence '</g>'] ; fid = fopen('plot_cones_field_stub.svg') ; svg = sprintf(fread(fid,'*char'),width,height,width,height,scale,scale,evidence,svg) ; -save_svg_plot(svg,'cones_field.svg') +save_svg_plot(svg,filename) end \ No newline at end of file
kolia/cones_MC
c5d5e1adf08a385e6a1d41b340b94611ac1bef34
bugfix
diff --git a/make_plots.m b/make_plots.m index 7953962..b0b2322 100644 --- a/make_plots.m +++ b/make_plots.m @@ -1,79 +1,79 @@ function make_plots( result, varargin ) % make_plots( X ) % or make_plots( X, cone_map ) % or make_plots( result ) % where X = result.X and cone_map = result % as returned by GREEDY, MCMC, and CAST % % makes whatever plots it can, saves them in folder % ['plots_for_' cone_map_string(result)] if iscell(result) result = result{1} ; end bestX = [] ; -if isfield(result,bestX) +if isfield(result,'bestX') bestX = result.bestX ; end if isfield(result,'state') % result is an X X = result ; if ~isempty(varargin) cone_map = result ; else cone_map = remake_cone_map( X ) ; end else % result is a cone_map X = result.X ; if iscell(X), X = X{1} ; end cone_map = rmfield(result,'X') ; end clear result folder_name = cone_map_string(cone_map); % place all plots in a folder filename = ['plots_for_' folder_name] ; mkdir( filename ) here = pwd ; cd(filename) try % if possible, make cone field plot and movie; this requires dX % CAST runs have a dX field that records all moves if isfield( X, 'dX' ) try load('./confident') catch cone_map = remake_initX( cone_map, true ) ; fprintf('making confident.mat\n') % select which iterations to use; 10000 burnin, then every 20 iters selector = @(n) (n>1000) && (mod(n,20) == 0) ; confident = confident_cones( cone_map.initX , X.dX , cone_map , selector ) ; end save('confident','confident') ; svg_movie( {cone_map.initX.state} , {X.dX} , cone_map.initX.state, cone_map.NICE ) ; plot_cone_field( confident , cone_map ) end if ~isempty(bestX) for k=1:numel(bestX) plot_cones_matlab( bestX{k}.state, cone_map ) ; end else plot_cones_matlab( X.state, cone_map ) ; saveas(gcf,'final_cone_configuration_matlab','jpg') end % % [sta,invww] = denoised_sta( X.initX , X.dX , cone_map, selector ) ; % % make_sta_plots( sta , invww, 'denoised' ) cd(here) catch err cd(here) rethrow(err); end end \ No newline at end of file
kolia/cones_MC
5cc7ce9ffac0efc06b3deb4d7a3c4e1cbbd96ba3
using plot_cones_matlab instead of plot_cones
diff --git a/greedy.m b/greedy.m index a816678..13caab4 100644 --- a/greedy.m +++ b/greedy.m @@ -1,88 +1,88 @@ function cone_map = GREEDY( cone_map , speed ) warning off if nargin<2 % default is regular greedy (anything but 0: 'hot' version) speed = 0 ; end % plot, display, and save every N iterations (0 = never) display_every = 1 ; default( cone_map , 'plot_every' , 0 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'save_disk_space', false ) % no need to track_contacts, greedy does not shift cones, it just adds them if ~isfield(cone_map , 'track_contacts'), cone_map.track_contacts = false ; end if speed fprintf('\n\nSTARTING ''hot'' greedy search') else fprintf('\n\nSTARTING greedy search') end % initializing variables X = cone_map.initX ; % if not tracking contacts, contact field is not needed if ~cone_map.track_contacts, try X = rmfield(X,'contact') ; end ; end if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; end % GREEDY addition of cones, one at a time t = cputime ; tic for jj=1:cone_map.initX.maxcones % try adding a cone if speed [X,done] = greedy_hot(X,cone_map) ; else [X,done] = greedy(X,cone_map) ; end N_cones = numel(find(X.state>0)) ; % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nCones:%4d, %4d %.0f\tin %8.2f sec',jj,N_cones,X.ll,toc) tic end % DISPLAY plot if plot_every && ~mod(jj,plot_every) figure(h) - plot_cones( X.state , cone_map ) ; + plot_cones_matlab( X.state , cone_map ) ; title(sprintf('Iteration %d',jj),'FontSize',16) drawnow end % SAVE to disk really_done = done | jj/(N_cones+1)>1.1 ; if ~mod(jj,save_every) || really_done try X = rmfield(X,'excluded') ; end X = remake_X(cone_map,X) ; if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; try to_save.X = rmfield(X,{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end if ~mod(jj,save_every) save('result', 'to_save' ) end if really_done , break ; else clear to_save; end end end fprintf('\ndone in %.1f sec\n\n',cputime - t) ; cone_map.X = X ; cone_map.code = file2str('GREEDY.m') ; cone_map.N_cones = N_cones ; % save('results','cone_map','X') end \ No newline at end of file diff --git a/make_plots.m b/make_plots.m index 2d34a5e..7953962 100644 --- a/make_plots.m +++ b/make_plots.m @@ -1,80 +1,79 @@ function make_plots( result, varargin ) % make_plots( X ) % or make_plots( X, cone_map ) % or make_plots( result ) % where X = result.X and cone_map = result % as returned by GREEDY, MCMC, and CAST % % makes whatever plots it can, saves them in folder % ['plots_for_' cone_map_string(result)] if iscell(result) result = result{1} ; end bestX = [] ; if isfield(result,bestX) bestX = result.bestX ; end if isfield(result,'state') % result is an X X = result ; if ~isempty(varargin) cone_map = result ; else cone_map = remake_cone_map( X ) ; end else % result is a cone_map X = result.X ; if iscell(X), X = X{1} ; end cone_map = rmfield(result,'X') ; end clear result folder_name = cone_map_string(cone_map); % place all plots in a folder filename = ['plots_for_' folder_name] ; mkdir( filename ) here = pwd ; cd(filename) try % if possible, make cone field plot and movie; this requires dX % CAST runs have a dX field that records all moves if isfield( X, 'dX' ) try load('./confident') catch cone_map = remake_initX( cone_map, true ) ; fprintf('making confident.mat\n') % select which iterations to use; 10000 burnin, then every 20 iters selector = @(n) (n>1000) && (mod(n,20) == 0) ; confident = confident_cones( cone_map.initX , X.dX , cone_map , selector ) ; end save('confident','confident') ; svg_movie( {cone_map.initX.state} , {X.dX} , cone_map.initX.state, cone_map.NICE ) ; plot_cone_field( confident , cone_map ) end if ~isempty(bestX) for k=1:numel(bestX) - plot_cones( bestX{k}.state, cone_map ) ; - saveas(gcf,sprintf('best_cone_configuration_%d',k),'jpg') + plot_cones_matlab( bestX{k}.state, cone_map ) ; end else - plot_cones( X.state, cone_map ) ; - saveas(gcf,'final_cone_configuration','jpg') + plot_cones_matlab( X.state, cone_map ) ; + saveas(gcf,'final_cone_configuration_matlab','jpg') end % % [sta,invww] = denoised_sta( X.initX , X.dX , cone_map, selector ) ; % % make_sta_plots( sta , invww, 'denoised' ) cd(here) catch err cd(here) rethrow(err); end end \ No newline at end of file
kolia/cones_MC
9614477cccbf467fb09dc6e854a3024beec49649
using plot_cones_matlab instead of plot_cones
diff --git a/CAST.m b/CAST.m index 1cc0c8d..0b8a54e 100644 --- a/CAST.m +++ b/CAST.m @@ -1,192 +1,192 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'plot_every' , 1000 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'profile_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'N_fast' , 1 ) default( cone_map , 'save_disk_space', false ) % default progression of inverse temperatures cone_map.min_delta = 0.1 ; cone_map.min_beta = 0.2 ; cone_map.betas = make_deltas( cone_map.min_beta , 1, 1, 20 ) ; cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, 20 ) ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps N_temp = length(cone_map.betas) ; ST.T = cell(N_temp,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; for i=1:N_temp ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; end % ST.g is used by Wang-Landau scheme in SimTempMCMC.m ST.g = exp(-3.1035+0.2268*(1:N_temp)) ; % from converged g of previous runs % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP fprintf('\n\nSTARTING CAST with' ) fprintf('\n\n+ different inverse temperatures beta:\n') fprintf('%4.2f ',cone_map.betas ) fprintf('\n\n+ different powers delta:\n') fprintf('%4.2f ',cone_map.deltas) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... cone_map, {ST.T{ST.i(j)}} ) ; end for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 old_ll = X{1}.ll ; [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end end % update temperature step ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) - plot_cones( X{1}.state , cone_map ) ; + plot_cones_matlab( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X{1},{'contact'}) ; try to_save.X = rmfield(X{1},{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; if ~mod(jj,save_every) save(sprintf('cast_result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end diff --git a/MCMC.m b/MCMC.m index 4c79cd4..4d37a5e 100644 --- a/MCMC.m +++ b/MCMC.m @@ -1,130 +1,130 @@ function to_save = MCMC( cone_map , ID ) % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'plot_every' , 0 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'max_time' , 200000 ) default( cone_map , 'save_disk_space', false ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('MCMC.m') ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end % MAIN MCMC LOOP fprintf('\n\nMCMC progress:') t = cputime ; tic n_runs = 1 ; %% initialization with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; % % reduce memory footprint: LL is only used by greedy % cone_map = rmfield(cone_map,'LL') ; % initialize MCMC loop X = cone_map.initX ; runbest = X ; runbest.i = 1 ; jj = 1 ; cone_map.bestX = {} ; n_best = 1 ; % tell update_X to record accepted moves; used to replay chain and plots X.dX = sparse([],[],[],N_iterations,3*X.maxcones) ; %% main MCMC loop while 1 % trials{i} is a proposed new configuration; each contains a new ll trials = move(X, cone_map, [1 1]) ; % choose one of the candidates, update_X its data structures X = flip_MCMC( X, trials, cone_map, {[1 1]} ) ; % keep track of best configuration encountered if X.ll>runbest.ll runbest = X ; runbest.i = jj ; end % reinitialize to cone_map.initX if MCMC becomes stuck if jj - runbest.i > cone_map.M0*cone_map.M1/3 % use less disk space and memory: remove large data structures runbest = rmfield(runbest,{'masks','contact'}) ; try runbest = rmfield(runbest,'invWW') ; end try runbest = rmfield(runbest,{'LL_history','cputime','N_cones_history','dX','excluded','sparse_STA_W_state'}) ; end % record current best confguration before reinitializing cone_map.bestX{n_best} = runbest ; n_best = n_best + 1 ; % reinitialize fprintf('reinitializing...\n') runbest = cone_map.initX ; runbest.LL_history = X.LL_history ; runbest.N_cones_history = X.N_cones_history ; runbest.cputime = X.cputime ; runbest.iteration = X.iteration ; runbest.i = jj ; n_runs = n_runs + 1 ; X = runbest ; end % DISPLAY to stdout if ~mod(jj,display_every) fprintf('Iter%4d of %d %4d cones %6.0f L %6.0f best %8.2f sec\n',... jj,N_iterations,numel(find(X.state>0)),X.ll,... runbest.ll,toc) tic end % PLOT if ~mod(jj,plot_every) figure(h) - plot_cones( X.state , cone_map ) ; + plot_cones_matlab( X.state , cone_map ) ; title( sprintf('After %d MCMC iterations',jj),'FontSize' , 24 ) % set(get(gca,'Title'),'Visible','on') drawnow end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time if save_disk_space % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X,{'contact'}) ; try to_save.X = rmfield(X,{'invWW'}) ; end else to_save = cone_map ; to_save.X = X ; end if ~mod(jj,save_every) save(sprintf('result_%d',ID), 'to_save' ) end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end diff --git a/greedy_regular.m b/greedy_regular.m index b1a87af..a2add01 100644 --- a/greedy_regular.m +++ b/greedy_regular.m @@ -1,105 +1,105 @@ function [X,done] = greedy_regular( X , PROB ) % if X.N_cones == 0 % profile clear % profile on % elseif mod(X.N_cones,10) == 0 % p = profile('info'); % save(sprintf('profdat_%d',X.N_cones),'p') % profile clear % end M0 = PROB.M0 * PROB.SS ; M1 = PROB.M1 * PROB.SS ; oldll = X.ll ; if ~isfield(X,'changed_x') X.greedy_ll = PROB.LL ; else X = update_changed(X,PROB) ; % figure(3) % ll = X.greedy_ll{1}(min(X.changed_x)+2:max(X.changed_x)-2,min(X.changed_y)+2:max(X.changed_y)-2) ; % imagesc(ll/max(ll(:))) % fprintf('changed greedy_ll min %f median %f max %f',min(ll(:)), median(ll(:)), max(ll(:))) end % if mod(X.N_cones , 100) == 99 % fprintf(' LL min %f max %f',min(X.greedy_ll(isfinite(X.greedy_ll))), max(X.greedy_ll(:))) % figure(1) % pe = plotable_evidence(X.greedy_ll) ; % imagesc(pe) % % figure(2) -% plot_cones(X.state,PROB) ; +% plot_cones_matlab(X.state,PROB) ; % 'word' % end [mm,I] = max(X.greedy_ll(:)) ; [mx,my,mc] = ind2sub(size(PROB.LL),I) ; if mm>0 done = false ; sx = mod(mx-1,PROB.SS)+1 ; sy = mod(my-1,PROB.SS)+1 ; % [SIZEX,SIZEY] = size(squeeze(PROB.coneConv(:,:,sx,sy))) ; % [changed_x, changed_y] = find( ones(SIZEX+40,SIZEY+40) ) ; % changed_x = changed_x-20 ; % changed_y = changed_y-20 ; [changed_x, changed_y] = find( squeeze(PROB.coneConv(:,:,sx,sy)) > 0 ) ; changed_x = changed_x + mx - sx - PROB.R ; changed_y = changed_y + my - sy - PROB.R ; keep = logical( (changed_x>0) .* (changed_x<=M0) .* (changed_y>0) .* (changed_y<=M1) ) ; X.changed_x = changed_x(keep) ; X.changed_y = changed_y(keep) ; X.last_x = mx ; X.last_y = my ; X.last_c = mc ; newX = flip_LL( X , [mx my mc] , PROB , [1 1]) ; if newX.ll>=X.ll X = update_X({newX},1,PROB.track_contacts) ; else X = update_changed(X,PROB) ; end try fprintf(' #keep_cones %d, #keep_GCs %d mm-dll %f mm-PROB.ll %f',... nnz(X.keep_cones),numel(X.keep_GCs),mm-newX.ll+oldll,mm-PROB.LL(mx,my,mc)) ; end else done = true ; X = rmfield(X,{'changed_x','changed_y','last_x','last_y'}) ; end end function X = update_changed(X,PROB) M0 = PROB.M0 * PROB.SS ; M1 = PROB.M1 * PROB.SS ; used = 0 ; inds = zeros(PROB.N_colors*numel(X.changed_x),1) ; gree = zeros(PROB.N_colors*numel(X.changed_x),1) ; for i=1:numel(X.changed_x) x = X.changed_x(i) ; y = X.changed_y(i) ; ne = not_excluded( X, x, y ) ; for c=1:3 used = used + 1 ; inds(used) = x + (y-1)*M0 + (c-1)*M0*M1 ; if ne && ~isempty(PROB.sparse_struct{x,y,c}) sample = flip_LL( X , [x y c] , PROB , [1 1]) ; gree(used) = sample.ll - X.ll ; else gree(used) = -Inf ; end end end X.greedy_ll(inds(1:used)) = gree(1:used) ; end diff --git a/plot_save_select.m b/plot_save_select.m index d60e399..71ac101 100644 --- a/plot_save_select.m +++ b/plot_save_select.m @@ -1,23 +1,23 @@ function plot_save_select(cone_map,dX,which_ones) % cone_map can be the initial cone_map produced by exact_LL_setup.m (or % equivalently , by main_CAST.m), or it can be the final cone_map after % a run, either way. % dX can be found as a field of X. % which_ones is a list of iteration numbers which we would like to % do_something with. T = [1 1] ; do = @plot_save ; function plot_save(X,PROB,i) save(sprintf('X_iteration_%d',i),'X') - plot_cones({X},PROB) ; + plot_cones_matlab({X},PROB) ; title(sprintf('Iteration %d LL%8d',i,floor(X.ll)),'FontSize',22) drawnow saveas(gcf,sprintf('X_at_iteration_%d',i),'fig') end replay_select_X(cone_map,dX,T,which_ones,do) end diff --git a/replay.m b/replay.m index b19b3c2..a8aedfa 100644 --- a/replay.m +++ b/replay.m @@ -1,99 +1,99 @@ function replay( dX, greedy, cone_map , skip, speed ) if nargin<4 , skip = 10 ; end % iterations/frame if nargin<5 , speed = 10 ; end % frames/sec [gx,gy] = find(greedy) ; M0 = cone_map.M0 * cone_map.cone_params.supersample ; M1 = cone_map.M1 * cone_map.cone_params.supersample ; NN = numel(dX) ; n = 0 ; N = 0 ; states = cell(NN,1) ; for i=1:NN n = max(n,numel(max(dX{i}(:,1:3:end)))) ; N = max(N,find(max(dX{i},[],2),1,'last')) ; states{i} = zeros(M0,M1) ; end % scrsz = get(0,'ScreenSize'); % hf = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; % % colormap('pink') % imagesc( cone_map.NICE ) ; % hold on % % symbols = {'.' ; 's' ; '*' ; 'x' ; 'p' ; 'h' ; 'd' ; 'o'} ; % colors = {'r' ; 'g' ; 'b' } ; % % h = cell(3,NN) ; % % for i=1:N % for j=0:n-1 % for ii=1:NN % if dX{ii}(i,1+3*j) % states{ii}(dX{ii}(i,1+3*j),dX{ii}(i,2+3*j)) = dX{ii}(i,3+3*j) ; % end % end % end % % if ~mod(i,skip) % tic ; % % figure(hf) % % for ii=1:NN % s = symbols{ii} ; % for cc=1:3 % c = colors{cc} ; % % [ix,iy] = find(states{ii} == cc) ; % h{cc,ii} = plot(iy,ix,sprintf('%s%s',c,s),'MarkerSize',5) ; % end % end % plot(gy,gx,'w+','MarkerSize',7) % % title(sprintf('Iteration %d',i),'FontSize',16) % drawnow expose % pause(1/speed - toc) ; % if i<N-skip , delete(cell2mat(h(:))) ; end % % end % end scrsz = get(0,'ScreenSize'); hf = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; colormap('pink') imagesc( cone_map.NICE.^(0.6) ) ; hold on for i=1:N for j=0:n-1 for ii=1:NN if dX{ii}(i,1+3*j) states{ii}(dX{ii}(i,1+3*j),dX{ii}(i,2+3*j)) = dX{ii}(i,3+3*j) ; end end end if ~mod(i,skip) tic ; figure(hf) - h = plot_cones( states , greedy ) ; + h = plot_cones_matlab( states , greedy ) ; title(sprintf('Iteration %d',i),'FontSize',16) drawnow expose pause(1/speed - toc) ; if i<N-skip , delete(cell2mat(h(:))) ; end end end \ No newline at end of file
kolia/cones_MC
e02ed569b08d199a8dd899372bb23f4a25a362fa
routine changes to main
diff --git a/main.m b/main.m index 87874b3..7095500 100644 --- a/main.m +++ b/main.m @@ -1,54 +1,56 @@ cone_map.datafolder = 'peach' ; addpath(genpath(pwd)) %% LOAD DATA load(sprintf('%s/stas', cone_map.datafolder)) % stas struct contains fields: % stas(i).spikes : the list of spike times of cell i % stas(i).spatial : the spatial component of the STA of cell i load(sprintf('%s/cone_params', cone_map.datafolder)) % cone_params struct fields: % stimulus_variance : variance of each stim pixel color chanel (usually 1) % supersample : the integer number of cone positions per pixel % width/height (usually 4) % colors : 3x3 matrix of cone color sensitivities % support_radius : radius of cone receptive field filter (usually 3.0) % repulsion_radii % restrict the stimulus to a region of interest (if memory is a problem) % stas = restrict_ROI( stas, [1 160], [1 160] ) ; %% CONE_MAP contains parameters and preprocessed data structures % calculate sparsity pattern (for MCMC) and initial LL map (for greedy) cone_map = exact_LL_setup(stas,cone_params,cone_map) ; % How many MCMC/CAST iterations? -cone_map.N_iterations = 5e5 ; +cone_map.N_iterations = 1e4 ; cone_map.max_time = 4e5 ; % in seconds % % override defaults: plot, display, and save every ? iterations (0 = never) % cone_map.plot_every = 1000 ; % cone_map.display_every = 20 ; % cone_map.save_every = 0 ; % string identifying this cone_map problem; useful for naming saved results cone_map.description = cone_map_string( cone_map ) ; %% run GREEDY, MCMC or CAST locally -% greed = GREEDY(cone_map) ; save(['greed_' cone_map.description],'greed') ; -mcmc = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'mcmc') ; -% cast = CAST(cone_map) ; save(['cast_' cone_map.description], 'cast') ; +% result = GREEDY(cone_map) ; save(['greed_' cone_map.description],'result') ; +result = MCMC(cone_map) ; save(['mcmc_' cone_map.description], 'result') ; +% result = CAST(cone_map) ; save(['cast_' cone_map.description], 'result') ; +%% some plots +make_plots( result ) - -% %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: +%% %% or RUN 1 greedy instance, N MCMC instances and N CAST on the hpc cluster: % % start by cloning AGRICOLA from https://github.com/kolia/agricola % addpath('../agricola') % N = 30 ; ids = cell(1,N) ; for i=1:length(ids) , ids{i} = {i} ; end +% cone_map.save_disk_space = true ; % strip results of large fields % % PBS.l.mem = '1500mb' ; % PBS.l.walltime = '70:00:00' ; % sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; % sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; % sow(['greed_' base_str],@( )GREEDY(cone_map)) ; \ No newline at end of file
kolia/cones_MC
53222fe6d038054fea0b284f3aebd213e4a02477
plotters save to simpler file names
diff --git a/plot_Greedy_MCMC_CAST.m b/plot_Greedy_MCMC_CAST.m index 16b521d..df84fe5 100644 --- a/plot_Greedy_MCMC_CAST.m +++ b/plot_Greedy_MCMC_CAST.m @@ -1,39 +1,39 @@ function svg = plot_Greedy_MCMC_CAST( greed , mcmc , cast , PROB ) [~,ll,states,keep] = get_best( [mcmc ; cast ; {greed}] ) ; id = [ones(numel(mcmc),1) ; 2*ones(numel(cast),1) ; 0] ; id = id(keep) ; [xG,yG,cG] = find( states{end} ) ; [x1,y1,c1] = find( states{ ll(id == 1) == max(ll(id == 1)) } ) ; [x2,y2,c2] = find( states{ ll(id == 2) == max(ll(id == 2)) } ) ; id = [ones(numel(x1),1) ; 2*ones(numel(x2),1) ; zeros(numel(xG),1)] ; c = [num2cell(c1(:)) ; num2cell(c2(:)) ; num2cell(cG(:))] ; for i=1:numel(c) cc = c{i} ; switch cc case 1 c{i} = 'red' ; case 2 c{i} = 'green' ; case 3 c{i} = 'blue' ; end end evidence = print_evidence( PROB.NICE ) ; scale = 480/max([size(PROB.NICE,1) size(PROB.NICE,2)]) ; width = min([500 500*size(PROB.NICE,2)/size(PROB.NICE,1)]) ; height = min([500 500*size(PROB.NICE,1)/size(PROB.NICE,2)])+40 ; svg = sprints('<use xlink:href="#%d" transform="translate(%f %f)" stroke="%s"/>\n', ... id,[y1(:);y2(:);yG],[x1(:);x2(:);xG],c) ; fid = fopen('plot_Greedy_MCMC_CAST_stub.svg') ; svg = sprintf(fread(fid,'*char'),width,height,width,height,scale,scale,evidence,svg) ; -save_svg_plot(svg,sprintf('Best_Greed_MCMC_CAST_%s.svg',PROB.type)) +save_svg_plot(svg,'Best_Greed_MCMC_CAST.svg') end \ No newline at end of file diff --git a/plot_LL_ncones.m b/plot_LL_ncones.m index 7da3cc1..f36258c 100644 --- a/plot_LL_ncones.m +++ b/plot_LL_ncones.m @@ -1,89 +1,89 @@ function svg = plot_LL_ncones( greed , mcmc , cast , cone_map ) if ~isempty(greed) [x,y] = get_best( [mcmc ; cast ; {greed}] ) ; id = [ones(numel(mcmc),1) ; 2*ones(numel(cast),1) ; 0] ; else [x,y] = get_best( [mcmc ; cast ] ) ; id = [ones(numel(mcmc),1) ; 2*ones(numel(cast),1) ] ; end y = bits_per_spike( y, sum(cone_map.N_spikes) ) ; minx = min(x) ; maxx = max(x) ; inds = (x>=minx) & (x<=maxx) ; id = id(inds) ; y = y(inds) ; x = x(inds) ; mx = min(x) ; Mx = max(x) ; m = min(y) ; M = max(y) ; id3 = find( y == max(y(id == 1)) ) ; id( id3 ) = 3 ; id4 = find( y == max(y(id == 2)), 1 ) ; id( id4 ) = 4 ; inds = [1:id3-1 id3+1:id4-1 id4+1:numel(x)-1 id3 id4 numel(x)] ; x = x(inds) ; y = y(inds) ; id = id(inds) ; M1 = max(y(id==1)) ; mxi = y == max(y) ; g_ncone = x(end) ; g_ll = y(end) ; mcmc_ncone = x(end-2) ; height = 220 ; y = y - m ; y = 200 * (1-y/(M-m)) ; x = 200 * (x-minx)/(max(x)-minx) ; svg = sprints('<use xlink:href="#%d" transform="translate(%f %f)"/>\n',id,x,y) ; ymax = y(find(x==max(x),1)) ; svg = [sprintf('<line x1="0" x2="%f" y1="0" y2="0" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(mxi)) ... sprintf('<text x="-5" y="0" font-size="12" text-anchor="end" baseline-shift="-45%%">%.5f</text>\n',M) ... sprintf('<line x1="%f" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',200,200,ymax,height) ... sprintf('<text x="%f" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%d</text>\n',200,height,ceil(Mx)) ... sprintf('<line x1="%f" x2="0" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end-2),y(end-2),y(end-2)) ... sprintf('<text x="-5" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%.5f</text>\n',y(end-2),M1) ... sprintf('<text x="100" y="240" font-size="15" text-anchor="middle" baseline-shift="-100%%" font-weight="bold"> number of cones</text>\n') ... sprintf('<g transform="translate(-85 25)rotate(-90)"><text font-size="15" text-anchor="end" font-weight="bold">log posterior (bits/spike)</text></g>\n') ... svg] ; if ~isempty(greed) svg = [sprintf('<line x1="0" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end),y(end),y(end)) ... sprintf('<text x="-5" y="%d" font-size="12" text-anchor="end" baseline-shift="-45%%">%.4f</text>\n',y(end),g_ll) ... sprintf('<line x1="%f" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end),x(end),y(end),height) ... sprintf('<text x="%f" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%d</text>\n',x(end),height,g_ncone)... sprintf('<text x="75" y="-35" font-size="18" text-anchor="middle"><tspan fill="green">Greedy</tspan>, <tspan fill="blue">MCMC</tspan> and <tspan fill="red">CAST</tspan></text>\n') ... svg] ; else svg = [sprintf('<line x1="%f" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end-2),x(end-2),y(end-2),height) ... sprintf('<text x="%f" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%d</text>\n',x(end-2),height,mcmc_ncone)... sprintf('<text x="75" y="-35" font-size="18" text-anchor="middle"><tspan fill="blue">MCMC</tspan> and <tspan fill="red">CAST</tspan></text>\n') ... svg] ; end svg = insert_string(svg,'plot_LL_ncones_stub.svg',-40) ; if ~isempty(greed) - save_svg_plot(svg,sprintf('LL_ncones_%s.svg',cone_map.type)) + save_svg_plot(svg,'LL_ncones.svg') else - save_svg_plot(svg,sprintf('LL_ncones_nogreed_%s.svg',cone_map.type)) + save_svg_plot(svg,'LL_ncones_nogreed.svg') end end \ No newline at end of file diff --git a/plot_cone_field.m b/plot_cone_field.m index ce8b736..55434e3 100644 --- a/plot_cone_field.m +++ b/plot_cone_field.m @@ -1,37 +1,37 @@ function svg = plot_cone_field( cc , PROB ) alpha = sqrt(sum(cc.^2,3)) ; [x,y,alpha] = find( alpha ) ; [alpha,order] = sort( alpha, 1, 'ascend' ) ; x = x(order) ; y = y(order) ; [M0,M1,~] = size(cc) ; r = floor( 255*cc(x+M0*(y-1)) ./ alpha ) ; g = floor( 255*cc( M0*M1 + x+M0*(y-1)) ./ alpha ) ; b = floor( 255*cc(2*M0*M1 + x+M0*(y-1)) ./ alpha ) ; svg = sprints('<use xlink:href="#1" transform="translate(%f %f)" stroke="rgb(%d,%d,%d)" opacity="%.2f"/>\n', ... y,x,r,g,b,alpha) ; scale = 500/max([size(PROB.NICE,1) size(PROB.NICE,2)]) ; width = min([500 500*size(PROB.NICE,2)/size(PROB.NICE,1)])+20 ; height = min([500 500*size(PROB.NICE,1)/size(PROB.NICE,2)])+20 ; % width = scale*(size(PROB.NICE,2)+ 17) ; % height = scale*(size(PROB.NICE,1)+ 85) ; % scale = 1 ; % [width,height] = size(PROB.NICE) ; evidence = print_evidence( PROB.NICE ) ; % evidence = [sprintf('<g transform="scale(%f,%f)">',scale,scale) evidence '</g>'] ; fid = fopen('plot_cones_field_stub.svg') ; svg = sprintf(fread(fid,'*char'),width,height,width,height,scale,scale,evidence,svg) ; -save_svg_plot(svg,sprintf('cones_field_%s.svg',PROB.type)) +save_svg_plot(svg,'cones_field.svg') end \ No newline at end of file
kolia/cones_MC
07e605655f6752dad644750bb88bb0096e64f1b3
greedy does not save_disk_space by default
diff --git a/greedy.m b/greedy.m index 10a1e31..a816678 100644 --- a/greedy.m +++ b/greedy.m @@ -1,80 +1,88 @@ function cone_map = GREEDY( cone_map , speed ) warning off if nargin<2 % default is regular greedy (anything but 0: 'hot' version) speed = 0 ; end % plot, display, and save every N iterations (0 = never) display_every = 1 ; -default( cone_map , 'plot_every' , 0 ) -default( cone_map , 'save_every' , 500 ) +default( cone_map , 'plot_every' , 0 ) +default( cone_map , 'save_every' , 0 ) +default( cone_map , 'save_disk_space', false ) % no need to track_contacts, greedy does not shift cones, it just adds them if ~isfield(cone_map , 'track_contacts'), cone_map.track_contacts = false ; end if speed fprintf('\n\nSTARTING ''hot'' greedy search') else fprintf('\n\nSTARTING greedy search') end % initializing variables X = cone_map.initX ; % if not tracking contacts, contact field is not needed if ~cone_map.track_contacts, try X = rmfield(X,'contact') ; end ; end if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; end % GREEDY addition of cones, one at a time t = cputime ; tic for jj=1:cone_map.initX.maxcones % try adding a cone if speed [X,done] = greedy_hot(X,cone_map) ; else [X,done] = greedy(X,cone_map) ; end N_cones = numel(find(X.state>0)) ; % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nCones:%4d, %4d %.0f\tin %8.2f sec',jj,N_cones,X.ll,toc) tic end % DISPLAY plot if plot_every && ~mod(jj,plot_every) figure(h) plot_cones( X.state , cone_map ) ; title(sprintf('Iteration %d',jj),'FontSize',16) drawnow end % SAVE to disk - save_now = done | jj/(N_cones+1)>1.1 ; - if ~mod(jj,save_every) || save_now - % use less disk space: remove large data structures - to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + really_done = done | jj/(N_cones+1)>1.1 ; + if ~mod(jj,save_every) || really_done try X = rmfield(X,'excluded') ; end X = remake_X(cone_map,X) ; - try to_save.X = rmfield(X,{'invWW'}) ; end - save('result', 'to_save' ) - if save_now , break ; + if save_disk_space + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + try to_save.X = rmfield(X,{'invWW'}) ; end + else + to_save = cone_map ; + to_save.X = X ; + end + if ~mod(jj,save_every) + save('result', 'to_save' ) + end + if really_done , break ; else clear to_save; end end end fprintf('\ndone in %.1f sec\n\n',cputime - t) ; cone_map.X = X ; -cone_map.code = file2str('greedy_cones.m') ; +cone_map.code = file2str('GREEDY.m') ; cone_map.N_cones = N_cones ; % save('results','cone_map','X') end \ No newline at end of file
kolia/cones_MC
ed00558e13b07cf4ce568c9d2e6e828d97f61346
cosmetic
diff --git a/cone_map_string.m b/cone_map_string.m index 4fa22b9..531d33c 100644 --- a/cone_map_string.m +++ b/cone_map_string.m @@ -1,7 +1,8 @@ function base_str = cone_map_string(cone_map) base_str = sprintf('%s__%.0eiters', cone_map.datafolder,cone_map.N_iterations) ; base_str(base_str=='+') = '' ; base_str(base_str=='.') = '' ; + end \ No newline at end of file diff --git a/plot_cones.m b/plot_cones.m index 1a05d6e..fac5c48 100644 --- a/plot_cones.m +++ b/plot_cones.m @@ -1,51 +1,51 @@ function h = plot_cones( states , cone_map ) if isnumeric(states) states = { states } ; end if iscell(states) && isfield(states{1},'state') for i=1:numel(states) states{i} = states{i}.state ; end end % if issparse(states{1}) % for ii=1:numel(states) % states{ii} = states{ii}( states{ii}>0 ) ; % end % end symbols = {'o' ; 's' ; '*' ; 'x' ; 'p' ; 'h' ; 'd' ; '.'} ; colors = {'r' ; 'g' ; 'b' } ; NN = numel(states) ; h = cell(3,NN) ; if nargin>1 && isfield( cone_map ,'NICE' ) colormap('pink') imagesc( cone_map.NICE.^(0.6) ) ; end hold on for ii=1:numel(states) s = symbols{ii} ; for cc=1:3 c = colors{cc} ; [ix,iy] = find(states{ii} == cc) ; - h{cc,ii} = plot(iy,ix,sprintf('%s%s',c,s),'MarkerSize',12) ; + h{cc,ii} = plot(iy,ix,sprintf('%s%s',c,s),'MarkerSize',6) ; end end if nargin>1 if isfield(cone_map,'greedy') cone_map = cone_map.greedy ; end if isnumeric(cone_map) [gx,gy] = find( cone_map ) ; plot(gy,gx,'w+','MarkerSize',7) ; end end end \ No newline at end of file diff --git a/print_evidence.m b/print_evidence.m index 667490a..ada3116 100644 --- a/print_evidence.m +++ b/print_evidence.m @@ -1,12 +1,12 @@ function svg = print_evidence( NICE ) [nx,ny,~] = size(NICE) ; f = figure('visible','off'); imshow(NICE, 'Border', 'tight'); set(gca,'position',[0 0 1 1],'units','normalized') set(gcf,'PaperPosition',[0 0 ny/80 nx/80]) set(gcf,'PaperSize',[ny nx]) -print(f, '-r80', '-dpng', 'evidence80.png'); +print(f, '-r80', '-dpng', 'evidence.png'); -svg = sprintf('<image width="%d" height="%d" xlink:href="evidence80.png"/>\n',ny,nx) ; +svg = sprintf('<image width="%d" height="%d" xlink:href="evidence.png"/>\n',ny,nx) ; end \ No newline at end of file
kolia/cones_MC
5df548c05fdd56053744c420c78c75f9a3fa77d2
svg_movie works with ROIs of varying sizes
diff --git a/dance.js b/dance.js index 6995f31..c7012d1 100644 --- a/dance.js +++ b/dance.js @@ -1,53 +1,65 @@ var svgDocument; var xmlns="http://www.w3.org/2000/svg" var xlinkns = "http://www.w3.org/1999/xlink" function startup(evt) { O=evt.target svgDocument=O.ownerDocument O.setAttribute("onmousedown","run=!run;dt()") + greedy_cones = svgDocument.getElementById("greedy_cones") cones = svgDocument.getElementById("cones") - itext = svgDocument.getElementById("itext") + itext = svgDocument.getElementById("itext") } -colors = ['red' , 'green' , '#66FF66'] ; - +colors = ['red' , 'green' , 'blue'] ; +%s run = true ; t = 0 ; function dt(){ if (!run) return ; itext.lastChild.nodeValue = 'Iteration '+t; iter() ; t = t+1 ; if (t>=data.length) { t = 0 ; - while(cones.hasChildNodes()) cones.removeChild(cones.firstChild); + for (i=0; i<4; i++){ + these_cones = svgDocument.getElementById('cones'+i) ; + while(these_cones.hasChildNodes()) these_cones.removeChild(these_cones.firstChild); + } } - window.setTimeout("dt()",10) + window.setTimeout("dt()",2) } function iter(){ for (i=0; i<data[t].length; i++){ dcone = data[t][i] ; cone = svgDocument.getElementById(dcone[0]+'_'+dcone[1]+'_'+dcone[3]) ; if (!dcone[2] && cone) { cone.parentNode.removeChild(cone) ; } if ( dcone[2]) { if (!cone) { cone = svgDocument.createElementNS(xmlns,'use') ; cone.setAttributeNS(xlinkns,'xlink:href','#m'+dcone[3]) ; cone.setAttributeNS(null,'transform','translate('+dcone[0]+' '+dcone[1]+')') ; + cone.setAttributeNS(null,'class','m'+dcone[3]) ; cone.setAttributeNS(null,'id',dcone[0]+'_'+dcone[1]+'_'+dcone[3]) ; } cone.setAttribute('stroke',colors[dcone[2]-1]) ; cone.setAttribute('fill','none') ; - cones.appendChild(cone) ; + these_cones = svgDocument.getElementById('cones'+dcone[3]) ; + these_cones.appendChild(cone) ; } } } function toggle(id){ - instance = svgDocument.getElementById(id) ; - instance.setAttributeNS(null,'visibility','hidden') ; + run = !run ; + instance = svgDocument.getElementById('cones'+id[1]) ; + if (instance.getAttribute("visibility")=="visible"){ + instance.setAttributeNS(null,'visibility','hidden') ; + } + else { + instance.setAttributeNS(null,'visibility','visible') ; + } } diff --git a/dancing_cones_source.svg b/dancing_cones_source.svg index 99f03f8..3bf4077 100644 --- a/dancing_cones_source.svg +++ b/dancing_cones_source.svg @@ -1,39 +1,45 @@ -<svg width="100%" height="100%" - xmlns="http://www.w3.org/2000/svg" version="1.1" +<svg width="%f" height="%f" viewBox="0 0 %f %f" + xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" onload="startup(evt)" > + <script> <![CDATA[ - +%s //]]> </script> <defs> - <circle id="m0" cx="0" cy="0" r="0.7" stroke-width="0.6" fill="white"/> - <circle id="m1" cx="0" cy="0" r="4.7" stroke-width="0.1"/> - <circle id="m2" cx="0" cy="0" r="4.0" stroke-width="0.3" stroke-dasharray="0.5 1.5"/> + <circle id="m0" cx="0" cy="0" r="1.0" stroke-width="1.1" fill="white"/> + <circle id="m1" cx="0" cy="0" r="3.5" stroke-width="1.5"/> + <circle id="m2" cx="0" cy="0" r="4.5" stroke-width="1." stroke-dasharray="3.5 2.5"/> <circle id="m3" cx="0" cy="0" r="3.0" stroke-width="0.8" stroke-dasharray="0 1 0.5 1.65"/> <circle id="m4" cx="0" cy="0" r="2.0" stroke-width="0.9" stroke-dasharray="0 1.5 1 2"/> </defs> -<g transform="scale(5,5)translate(10,24)"> - <g transform="translate(5,-15)"> +<g transform="scale(3,3)"> + <g transform="translate(5,10)"> <text font-size="7"> <tspan>Greedy</tspan> - <tspan dx="20">Parallel tempering MCMC (3 runs)</tspan> + <tspan dx="20">MCMC</tspan> + <tspan dx="30" id="itext">Iteration 0</tspan> </text> - <use xlink:href="#m0" transform="translate(14 8)" stroke="red" fill="white" onclick="toggle('m0')"/> - <use xlink:href="#m1" transform="translate(85 8)" stroke="red" fill="white" onclick="toggle('m1')"/> - <use xlink:href="#m2" transform="translate(100 8)" stroke="red" fill="white" onclick="toggle('m2')"/> - <use xlink:href="#m3" transform="translate(115 8)" stroke="red" fill="white" onclick="toggle('m3')"/> + <text dx="165" dy="8" font-size="3">Click to play/pause</text> + <use xlink:href="#m0" visibility="visible" transform="translate(30 -3)" stroke="red" fill="white" onclick="toggle('m0')"/> + <use xlink:href="#m1" visibility="visible" transform="translate(78 -3)" stroke="red" fill="white" onclick="toggle('m1')"/> + <!-- <use xlink:href="#m2" transform="translate(100 8)" stroke="red" fill="white" onclick="toggle('m2')"/> + <use xlink:href="#m3" transform="translate(115 8)" stroke="red" fill="white" onclick="toggle('m3')"/> --> + </g> + + <g transform="scale(%f,%f)translate(5,65)" id="cones"> + %s + <g id="cones0" visibility="visible"></g> + <g id="cones1" visibility="visible"></g> + <g id="cones2" visibility="visible"></g> + <g id="cones3" visibility="visible"></g> </g> - <image width="184" height="104" xlink:href="evidence.png" filter="#Matrix"/> - <g id="cones"></g> - <text x="4" y="115" font-size="6">Click to play/pause</text> - <text id="itext" x="180" y="115" text-anchor="end" font-size="8">Iteration 0</text> - <text x="4" y="125" font-size="6">(Allow 1600 iterations to burn in)</text> </g> </svg> diff --git a/svg_movie.m b/svg_movie.m index 83238f1..7ba2c9b 100644 --- a/svg_movie.m +++ b/svg_movie.m @@ -1,58 +1,78 @@ -function svg = svg_movie( init , dX , greedy ) +function svg = svg_movie( init , dX , greedy, NICE ) data = 'data = [' ; -for i=1:1e10 - idata = cell(numel(dX),4) ; run = 0 ; +iterations = zeros(numel(dX),1) ; +for j=1:numel(iterations) + iterations(j) = size(dX{j},1) ; +end + +for i=[1 nnz(greedy):max(iterations)] + idata = cell(numel(dX),4) ; for j=1:numel(dX) if size(dX{j},1)>=i - if i == 1 , idata(j,:) = state2xyc( init{j} , j ) ; end for jj=1:3 , idata{j,jj} = [idata{j,jj} dX{j}(i,jj:3:end)] ; end idata{j,4} = [idata{j,4} repmat(j,[1 numel(idata{j,1})])] ; - run = 1 ; + if i == 1 , idata(j,:) = state2xyc( init{j} , j ) ; end + end + end + if i==max(iterations), break ; end + if i == 1 + ss = state2xyc(greedy,0) ; + for k=1:4 + idata{k} = [idata{k} ss{k}] ; end end - if ~run , break ; end - if i == 1 , idata = [idata ; state2xyc(greedy,0)] ; end - ith = xycs2js( idata ) ; - if ~isempty( ith ) +% if ~isempty( ith ) data = [data '[' ith sprintf('],\n')] ; - end +% end +% if ~mod(i,100), fprintf('%d\n',i) ; end end data = [data(1:end-1) ']'] ; -svg = insert_string( data , which('dance.js') , 356 ) ; -svg = insert_string( svg , which('dancing_cones_source.svg') , 172 ) ; - -try - lsres = ls('dancing_cones.svg') ; - user_input = input('\nWarning: rm old dancing_cones.svg? (y/n):','s') ; - switch user_input - case 'y' - delete('dancing_cones.svg') - otherwise - return - end -end +scale = 200/max([size(NICE,1) size(NICE,2)]) ; +width = min([200 200*size(NICE,2)/size(NICE,1)])+20 ; +height = min([200 200*size(NICE,1)/size(NICE,2)])+20 ; + +evidence = print_evidence( NICE ) ; + +fid = fopen('dance.js') ; +js = sprintf(fread(fid,'*char'),data) ; +fclose(fid) ; + +fid = fopen('dancing_cones_source.svg') ; +svg = sprintf(fread(fid,'*char'),3*width,3*height,3*width,3*height,js,scale,scale,evidence) ; +fclose(fid) ; + +% try +% lsres = ls('dancing_cones.svg') ; +% user_input = input('\nWarning: rm old dancing_cones.svg? (y/n): ','s') ; +% switch user_input +% case 'y' +% delete('dancing_cones.svg') +% otherwise +% return +% end +% end fid = fopen('dancing_cones.svg','w') ; fwrite(fid,svg) ; fclose(fid) ; end function xyc = state2xyc(state,ii) [x,y,c] = find( state ) ; xyc = {x(:)' y(:)' c(:)' repmat(ii,[1 numel(x)])} ; end function js = xycs2js( xycs ) js = '' ; for i=1:size(xycs,1) inds = find(xycs{i,1}) ; for j=inds js = [js '[ ' num2str(xycs{i,2}(j)) ' , ' num2str(xycs{i,1}(j)) ' , ' ... num2str(xycs{i,3}(j)) ' , ' num2str(xycs{i,4}(j)) '] , '] ; end end if ~isempty(js) , js = js(1:end-5) ; end end \ No newline at end of file
kolia/cones_MC
f32eebaf3db77cbdf539dcd27ae19f0c5b99f2e0
new make_plots plot whatever it can using results from CAST and MCMC
diff --git a/make_plots.m b/make_plots.m index fcbba5d..2d34a5e 100644 --- a/make_plots.m +++ b/make_plots.m @@ -1,42 +1,80 @@ -function make_plots(greed,mcmc,cast,cone_map) +function make_plots( result, varargin ) +% make_plots( X ) +% or make_plots( X, cone_map ) +% or make_plots( result ) +% where X = result.X and cone_map = result +% as returned by GREEDY, MCMC, and CAST +% +% makes whatever plots it can, saves them in folder +% ['plots_for_' cone_map_string(result)] -% if nargin<4 -% cone_map = remake_cone_map(mcmc{1}) ; -% end +if iscell(result) + result = result{1} ; +end + +bestX = [] ; +if isfield(result,bestX) + bestX = result.bestX ; +end + +if isfield(result,'state') % result is an X + X = result ; + if ~isempty(varargin) + cone_map = result ; + else + cone_map = remake_cone_map( X ) ; + end +else % result is a cone_map + X = result.X ; + if iscell(X), X = X{1} ; end + cone_map = rmfield(result,'X') ; +end +clear result folder_name = cone_map_string(cone_map); +% place all plots in a folder filename = ['plots_for_' folder_name] ; mkdir( filename ) - here = pwd ; - cd(filename) -% [~,ll] = get_best( cast ) ; -% -% try load(['../confident_' folder_name]) -% catch -% ['making ../confident_' folder_name] -% selector = @(n) (n>10000) && (mod(n,20) == 0) ; -% dX = cast{find(ll==max(ll),1)}.X.dX ; -% confident = confident_cones( cone_map.initX , dX , cone_map , selector ) ; -% end -% save(['../confident_' folder_name], 'confident') ; -% plot_cone_field( confident , cone_map ) -% -% plot_LL_ncones( greed , mcmc , cast , cone_map ) -plot_LL_ncones( {} , mcmc , cast , cone_map ) -% plot_Greedy_MCMC_CAST( greed , mcmc , cast , cone_map ) - -if strcmp(cone_map.type,'george') - timeline(greed,mcmc,cast,cone_map.initX, sum(cone_map.N_spikes)) -end +try + % if possible, make cone field plot and movie; this requires dX + % CAST runs have a dX field that records all moves + if isfield( X, 'dX' ) + try load('./confident') + catch + cone_map = remake_initX( cone_map, true ) ; + fprintf('making confident.mat\n') + % select which iterations to use; 10000 burnin, then every 20 iters + selector = @(n) (n>1000) && (mod(n,20) == 0) ; + confident = confident_cones( cone_map.initX , X.dX , cone_map , selector ) ; + end + save('confident','confident') ; + + svg_movie( {cone_map.initX.state} , {X.dX} , cone_map.initX.state, cone_map.NICE ) ; + + plot_cone_field( confident , cone_map ) + end + if ~isempty(bestX) + for k=1:numel(bestX) + plot_cones( bestX{k}.state, cone_map ) ; + saveas(gcf,sprintf('best_cone_configuration_%d',k),'jpg') + end + else + plot_cones( X.state, cone_map ) ; + saveas(gcf,'final_cone_configuration','jpg') + end -% % [sta,invww] = denoised_sta( greed.initX , cast{1}.X.dX , cone_map, selector ) ; -% % make_sta_plots( sta , invww, 'denoised' ) + % % [sta,invww] = denoised_sta( X.initX , X.dX , cone_map, selector ) ; + % % make_sta_plots( sta , invww, 'denoised' ) -cd(here) + cd(here) +catch err + cd(here) + rethrow(err); +end end \ No newline at end of file
kolia/cones_MC
76faaef3208e6cb2935546d6a9f3b24ee1352e10
exact_L_setup and remake_cone_map use transfer_info
diff --git a/exact_LL_setup.m b/exact_LL_setup.m index 322862a..d481509 100644 --- a/exact_LL_setup.m +++ b/exact_LL_setup.m @@ -1,224 +1,228 @@ function cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) %% cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) % Expand data and parameters into variables used to calculate likelihoods. % Mainly, spatial supersampling by a factor of cone_map.supersample is % applied to the STAs, and the convolution of the STAs with the cone % receptive fields is used to calculate the sparsity structure of % connections between cones and GCs, as well as a map of LL increases. if nargin < 3 , cone_map = struct ; end % size of data [M0,M1,cone_map.N_colors] = size(GC_stas(1).spatial) ; %% unpack data from GC_stas % supersample factor SS = cone_params.supersample ; % radius used for convolutions with cone RFs R = ceil( cone_params.support_radius * SS ) ; cone_params.support_radius = ceil(cone_params.support_radius) ; % copy cone_params cone_map.cone_params = cone_params ; % set up Region of Interest if it doesn't already exist % these are fractional (x,y) coordinates, due to supersampling if ~isfield(cone_map,'ROI') x = repmat( 1/(2*SS):1/SS:M0-1/(2*SS) , 1 , M1*SS ) ; y = repmat( 1/(2*SS):1/SS:M1-1/(2*SS) , M0*SS , 1 ) ; cone_map.ROI = [x' y(:)] ; clear x y end % total number of possible cone positions cone_map.NROI = size(cone_map.ROI,1) ; % unpack GC_stas into: supersampled STAs, norms of STAs and N_spikes N_GC = length(GC_stas) ; STA_norm = zeros(N_GC,1) ; cone_map.N_spikes = zeros(N_GC,1) ; STA = zeros(cone_map.N_colors,M0,M1,N_GC) ; for i=1:N_GC cone_map.N_spikes(i) = length(GC_stas(i).spikes) ; STA(:,:,:,i) = reshape(permute(GC_stas(i).spatial,[3 1 2]), cone_map.N_colors, M0, M1 ) ; STA_norm(i) = norm(reshape(STA(:,:,:,i),1,[])) ; end %% calculate some constants etc in advance, to speed up actual calculations % memoized function returning gaussian mass in a square pixel box cone_map.gaus_boxed = gaus_in_a_box_memo( cone_params.sigma, SS, cone_params.support_radius ) ; % constants used to calculate the log-likelihood cone_map.cell_consts = cone_map.N_spikes * cone_params.stimulus_variance ; cone_map.prior_covs = (cone_params.stimulus_variance ./ STA_norm ).^2 ; cone_map.cov_factors = cone_map.cell_consts+cone_map.prior_covs ; cone_map.N_cones_terms = log( cone_map.prior_covs ) - log( cone_map.cov_factors) ; cone_map.quad_factors = cone_map.N_spikes.^2 ./ cone_map.cov_factors ; % for fast lookup of legal shift moves in move.m cone_map.outofbounds = sparse([],[],[],M0*SS,M1*SS,2*(M0+M1)*SS) ; cone_map.outofbounds(:,[1 M1*SS]) = 1 ; cone_map.outofbounds([1 M0*SS],:) = cone_map.outofbounds([1 M0*SS],:) + 1 ; % copy params cone_map.M0 = M0 ; cone_map.M1 = M1 ; cone_map.N_GC = N_GC ; cone_map.SS = SS ; cone_map.R = R ; cone_map.STA = single( STA ) ; cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; cone_map.colorDot = cone_params.colors * cone_params.colors' ; %% make lookup table for dot products of cone RFs in all possible positions cone_map.coneConv = zeros( 2*R+SS , 2*R+SS , SS , SS ) ; WW = zeros(SS,SS) ; f = 1/(2*SS):1/SS:2*R/SS+1 ; for xx=1:2*R+SS x = f(xx) ; for yy=1:2*R+SS y = f(yy) ; a = make_filter_new(4*R/SS+1,4*R/SS+1,x+R/SS,y+R/SS,cone_map.gaus_boxed,... cone_map.cone_params.support_radius) ; for ss=1:SS s = (ss-0.5)/SS ; for tt=1:SS t = (tt-0.5)/SS ; b = make_filter_new(4*R/SS+1,4*R/SS+1,2*R/SS+s,2*R/SS+t,... cone_map.gaus_boxed,cone_map.cone_params.support_radius) ; cone_map.coneConv(xx,yy,ss,tt) = dot(a(:),b(:)) ; end end if (xx<=SS) && (yy<=SS) WW(xx,yy) = dot(a(:),a(:)) ; end end end %% calculate sparsity structure and map of LL increases [cone_map.sparse_struct,cone_map.LL] = ... make_sparse_struct(cone_map,STA,WW,cone_map.gaus_boxed) ; %% cone_map.NICE is a pretty visualizable version of cone_map.LL IC = inv(cone_params.colors) ; QC = reshape( reshape(cone_map.LL,[],3) * IC', size(cone_map.LL) ) ; cone_map.NICE = plotable_evidence( QC ) ; % imagesc( cone_map.NICE ) %% some default values -cone_map.N_iterations = 100000; -cone_map.max_time = 200000; -cone_map.N_fast = 1 ; -cone_map.q = 0.5 ; -cone_map.ID = 0 ; +cone_map.N_iterations = 100000 ; +cone_map.max_time = 200000 ; +cone_map.N_fast = 1 ; +cone_map.q = 0.5 ; +cone_map.ID = 0 ; +cone_map.save_disk_space = false ; %% initial empty X cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... cone_map.N_colors, cone_map.SS, ... cone_map.cone_params.replusion_radii, ... 1, 1) ; +%% transfer all info from cone_map to cone_map.initX +cone_map.initX = transfer_info( cone_map, cone_map.initX ) ; + %% quick sanity check: compare cone_map.make_STA_W with make_LL mLL = max(cone_map.LL(:)) ; mx = 63 ; my = 32 ; mc = 1 ; tX = flip_LL( cone_map.initX , [mx my mc] , cone_map , [1 1] ) ; fprintf('\nLL and flip_ll: %f,%f, at x%d,y%d,c%d\n',mLL,tX.ll,mx,my,mc) ; range_x = mx+(-4:5) ; range_y = my+(-4:5) ; test = zeros(numel(range_x),numel(range_y)) ; for iii=range_x for jjj=range_y tX = flip_LL( cone_map.initX , [iii jjj 1] , cone_map , [1 1] ) ; test(iii,jjj) = tX.ll ; end end fprintf('\n') disp(test(range_x,range_y)) disp(cone_map.LL(range_x,range_y,1)) disp( test(range_x,range_y) - cone_map.LL(range_x,range_y,1) ) fprintf('\n') - + end function [sparse_struct, LL] = make_sparse_struct(cone_map,STA,WW,gaus_boxed) % calculate sparsity structure of connections between all possible cone % locations and GCs, as well as the map of log-likelihoods of all % single-cone configurations M0 = cone_map.M0 ; M1 = cone_map.M1 ; SS = cone_map.SS ; support = cone_map.cone_params.support_radius ; colors = cone_map.cone_params.colors ; LL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; supersamples = 1/(2*SS):1/SS:1 ; gs = cell(SS) ; sparse_struct = cell( M0*SS, M1*SS, cone_map.N_colors ) ; % for every supersampled location within one pixel, calculate the cone RF for ii=1:SS for jj=1:SS i = supersamples(ii) ; j = supersamples(jj) ; g = reshape( gaus_boxed(i,j), [2*support+1 2*support+1]) ; gs{ii,jj} = g(end:-1:1,end:-1:1) ; end end fprintf('making sparse struct and LL for GC number') for gc=1:cone_map.N_GC gcLL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; % convolve all cone RFs with all GC STAs for ii=1:SS for jj=1:SS CC = zeros(M0*M1,cone_map.N_colors) ; for color=1:cone_map.N_colors CCC = conv2( squeeze(STA(color,:,:,gc)), gs{ii,jj} ) ; CCC = CCC(support+1:M0+support,support+1:M1+support) ; CC(:,color) = CCC(:) ; end C = 0.5 * cone_map.quad_factors(gc) * (CC * colors').^2 / WW(ii,jj) ; % the max here defines the sparsity C = max(0,C+0.5*cone_map.N_cones_terms(gc)) ; gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) = ... gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) + reshape(C,[M0 M1 3]) ; end end % record sparsity in sparse_struct [x,yc] = find( gcLL>0 ) ; y = 1+mod(yc-1,M1*SS) ; c = ceil( yc/(M1*SS) ) ; for i=1:numel(x) sparse_struct{x(i),y(i),c(i)} = int16([sparse_struct{x(i),y(i),c(i)} gc]) ; end LL = LL + gcLL ; fprintf(' %d',gc) end end function filter = make_filter_new(M0,M1,i,j,gaus_boxed, support) % make cone RF centered at (i,j), being careful about boundaries filter = zeros(M0,M1) ; [g,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) ; filter(t:b,l:r) = g ; % filter is inverted; doesn't matter for the dot product calculation though % filter = filter(end:-1:1,end:-1:1) ; % uncomment to uninvert end \ No newline at end of file diff --git a/remake_cone_map.m b/remake_cone_map.m index 8ef6dfa..4d1bd99 100644 --- a/remake_cone_map.m +++ b/remake_cone_map.m @@ -1,38 +1,9 @@ function cone_map = remake_cone_map( X ) +% Use information in X to reconstruct cone_map. -if strcmp(X.type,'peach') - type = 'peach' ; - load peach/peach_data % contains 'stas' - load peach/cone_params -else - type = 'george' ; - load george/stas % contains 'stas' - load george/cone_params % contains 'cone_params' -end - -% stas = restrict_ROI( stas, X.ROI{1}, X.ROI{2} ) ; - -cone_map = exact_LL_setup(stas,cone_params) ; % cone_map, aka PROB or data - -cone_map.initX.rois = X.rois ; -cone_map.rois = X.rois ; -cone_map.initX.NROI = X.NROI ; -try - cone_map.initX.NROIs = numel(X.ROI) ; - cone_map.NROIs = numel(X.ROI) ; - cone_map.initX.ROI = X.ROI ; -catch - cone_map.initX.NROIs = 2 ; - cone_map.NROIs = 2 ; -end -cone_map.initX.type = X.type ; -cone_map.type = X.type ; -cone_map.initX.supersample = cone_params.supersample ; -cone_map.initX.support_radius = cone_params.support_radius ; -cone_map.min_beta = min(X.betas) ; -cone_map.min_delta = min(X.deltas) ; -cone_map.initX.betas = X.betas ; -cone_map.initX.deltas = X.deltas ; -cone_map.initX.N_iterations = X.N_iterations ; +load(sprintf('%s/stas', X.datafolder)) +load(sprintf('%s/cone_params', X.datafolder)) +cone_map = transfer_info( X, struct ) ; +cone_map = exact_LL_setup(stas,cone_params,cone_map) ; end \ No newline at end of file
kolia/cones_MC
250f32b38c66bc0ce2aeec4e580bd5578b1730c1
CAST and MCMC do not save_disk_space by default anymore
diff --git a/CAST.m b/CAST.m index eeec76f..1cc0c8d 100644 --- a/CAST.m +++ b/CAST.m @@ -1,184 +1,192 @@ function to_save = CAST( cone_map , ID ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('CAST.m') ; % defaults -default( cone_map , 'N_iterations' , 1000000) -default( cone_map , 'max_time' , 200000 ) -default( cone_map , 'plot_every' , 1000 ) -default( cone_map , 'display_every' , 50 ) -default( cone_map , 'save_every' , 0 ) -default( cone_map , 'profile_every' , 0 ) -default( cone_map , 'ID' , 0 ) -default( cone_map , 'N_fast' , 1 ) +default( cone_map , 'N_iterations' , 1000000) +default( cone_map , 'max_time' , 200000 ) +default( cone_map , 'plot_every' , 1000 ) +default( cone_map , 'display_every' , 50 ) +default( cone_map , 'save_every' , 0 ) +default( cone_map , 'profile_every' , 0 ) +default( cone_map , 'ID' , 0 ) +default( cone_map , 'N_fast' , 1 ) +default( cone_map , 'save_disk_space', false ) % default progression of inverse temperatures cone_map.min_delta = 0.1 ; cone_map.min_beta = 0.2 ; cone_map.betas = make_deltas( cone_map.min_beta , 1, 1, 20 ) ; cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, 20 ) ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end %% initializations % initialize with 'hot' greedy configuration cone_map.track_contacts = true ; -greed_hot = greedy_cones(cone_map, 'hot') ; +greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; -% reduce memory footprint: LL is only used by greedy -cone_map = rmfield(cone_map,'LL') +% % reduce memory footprint: LL is only used by greedy +% cone_map = rmfield(cone_map,'LL') % initialize slow chain X{1} and fast chain X{2} X = cell(1+cone_map.N_fast,1) ; for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end initial_iterations = cone_map.initX.iteration ; % initialize current best configuration bestX = X{1} ; % tell udate_swap to record iterations where a swap was accepted X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; % tell update_X to record accepted moves; used to chain replay and plots X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; % tell update_X to record X{1}.ll at each iteration X{1}.LL_history = zeros(cone_map.N_iterations,1) ; % ST.T = the fixed progression of temperatures, ST.i = current temps N_temp = length(cone_map.betas) ; ST.T = cell(N_temp,1) ; ST.i = ones(cone_map.N_fast,1) ; ST.n = 1 ; for i=1:N_temp ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; end % ST.g is used by Wang-Landau scheme in SimTempMCMC.m ST.g = exp(-3.1035+0.2268*(1:N_temp)) ; % from converged g of previous runs % X{2}.STi_history records the complete history of ST.i for j=1:cone_map.N_fast X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; end %% MAIN CAST LOOP fprintf('\n\nSTARTING CAST with' ) fprintf('\n\n+ different inverse temperatures beta:\n') fprintf('%4.2f ',cone_map.betas ) fprintf('\n\n+ different powers delta:\n') fprintf('%4.2f ',cone_map.deltas) fprintf('\n\nCAST progress:') t = cputime ; tic jj = 1 ; while 1 % regular MCMC move at temperature [1 1] for slow chain X{1} X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} for j=1:cone_map.N_fast X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... cone_map, {ST.T{ST.i(j)}} ) ; end for j=1:cone_map.N_fast % swap move if X{1+j} is at T=1 if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 old_ll = X{1}.ll ; [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end end % update temperature step ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; % save current ST.STi to X{2}.STi_history X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; end if X{1}.ll>bestX.ll , bestX = X{1} ; end % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) fprintf('%2d ',ST.i) fprintf('%6.2f sec',toc) tic end % DISPLAY plot if ~mod(jj,plot_every) if ishandle(h) clf iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; iters = iters(X{1}.LL_history(iters)>0) ; subplot(5,1,1:3) plot_cones( X{1}.state , cone_map ) ; title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) subplot(5,1,4) ; plot(iters,X{1}.LL_history(iters)) ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) subplot(5,1,5) ; hold on plotme = zeros(cone_map.N_fast,length(iters)) ; for j=1:cone_map.N_fast plotme(j,:) = X{1+j}.STi_history(iters) ; end plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) ylabel( sprintf('fast temp.'),'FontSize' , 18 ) xlabel('Iterations','FontSize' , 18) drawnow ; hold off end end % PROFILING info saved to disk every profile_every iterations if profile_every if jj==1 profile clear profile on elseif ~mod(jj,profile_every) p = profile('info'); save(sprintf('profdat_%d',floor(jj/profile_every)),'p') profile clear end end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time - % use less disk space: remove large data structures - to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; - to_save.X = rmfield(X{1},{'contact'}) ; - try to_save.X = rmfield(X{1},{'invWW'}) ; end + if save_disk_space + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + to_save.X = rmfield(X{1},{'contact'}) ; + try to_save.X = rmfield(X{1},{'invWW'}) ; end + else + to_save = cone_map ; + to_save.X = X ; + end to_save.bestX = rmfield(bestX,{'contact'}) ; try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end to_save.ST = ST ; - save(sprintf('cast_result_%d',ID), 'to_save' ) + if ~mod(jj,save_every) + save(sprintf('cast_result_%d',ID), 'to_save' ) + end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end diff --git a/MCMC.m b/MCMC.m index b22eb6c..4c79cd4 100644 --- a/MCMC.m +++ b/MCMC.m @@ -1,119 +1,130 @@ function to_save = MCMC( cone_map , ID ) % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'plot_every' , 0 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'max_time' , 200000 ) +default( cone_map , 'save_disk_space', false ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('MCMC.m') ; % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end % MAIN MCMC LOOP fprintf('\n\nMCMC progress:') t = cputime ; tic n_runs = 1 ; %% initialization with 'hot' greedy configuration cone_map.track_contacts = true ; -greed_hot = greedy_cones(cone_map, 'hot') ; +greed_hot = GREEDY(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; -% reduce memory footprint: LL is only used by greedy -cone_map = rmfield(cone_map,'LL') +% % reduce memory footprint: LL is only used by greedy +% cone_map = rmfield(cone_map,'LL') ; % initialize MCMC loop X = cone_map.initX ; runbest = X ; runbest.i = 1 ; jj = 1 ; cone_map.bestX = {} ; n_best = 1 ; +% tell update_X to record accepted moves; used to replay chain and plots +X.dX = sparse([],[],[],N_iterations,3*X.maxcones) ; + %% main MCMC loop while 1 % trials{i} is a proposed new configuration; each contains a new ll trials = move(X, cone_map, [1 1]) ; % choose one of the candidates, update_X its data structures X = flip_MCMC( X, trials, cone_map, {[1 1]} ) ; % keep track of best configuration encountered if X.ll>runbest.ll runbest = X ; runbest.i = jj ; end % reinitialize to cone_map.initX if MCMC becomes stuck if jj - runbest.i > cone_map.M0*cone_map.M1/3 % use less disk space and memory: remove large data structures runbest = rmfield(runbest,{'masks','contact'}) ; try runbest = rmfield(runbest,'invWW') ; end try runbest = rmfield(runbest,{'LL_history','cputime','N_cones_history','dX','excluded','sparse_STA_W_state'}) ; end % record current best confguration before reinitializing cone_map.bestX{n_best} = runbest ; n_best = n_best + 1 ; % reinitialize fprintf('reinitializing...\n') runbest = cone_map.initX ; runbest.LL_history = X.LL_history ; runbest.N_cones_history = X.N_cones_history ; runbest.cputime = X.cputime ; runbest.iteration = X.iteration ; runbest.i = jj ; n_runs = n_runs + 1 ; X = runbest ; end % DISPLAY to stdout if ~mod(jj,display_every) fprintf('Iter%4d of %d %4d cones %6.0f L %6.0f best %8.2f sec\n',... jj,N_iterations,numel(find(X.state>0)),X.ll,... runbest.ll,toc) tic end % PLOT if ~mod(jj,plot_every) figure(h) plot_cones( X.state , cone_map ) ; title( sprintf('After %d MCMC iterations',jj),'FontSize' , 24 ) % set(get(gca,'Title'),'Visible','on') drawnow end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time - % use less disk space: remove large data structures - to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; - to_save.X = rmfield(X,{'contact'}) ; - try to_save.X = rmfield(X,{'invWW'}) ; end - save(sprintf('result_%d',ID), 'to_save' ) + if save_disk_space + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + to_save.X = rmfield(X,{'contact'}) ; + try to_save.X = rmfield(X,{'invWW'}) ; end + else + to_save = cone_map ; + to_save.X = X ; + end + if ~mod(jj,save_every) + save(sprintf('result_%d',ID), 'to_save' ) + end if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end
kolia/cones_MC
79e6a54579452dab234a59bdcc7740c8e8dc2d5b
renamed old make_plots to make_paper_plots
diff --git a/make_paper_plots.m b/make_paper_plots.m new file mode 100644 index 0000000..fcbba5d --- /dev/null +++ b/make_paper_plots.m @@ -0,0 +1,42 @@ +function make_plots(greed,mcmc,cast,cone_map) + +% if nargin<4 +% cone_map = remake_cone_map(mcmc{1}) ; +% end + +folder_name = cone_map_string(cone_map); + +filename = ['plots_for_' folder_name] ; +mkdir( filename ) + +here = pwd ; + +cd(filename) + +% [~,ll] = get_best( cast ) ; +% +% try load(['../confident_' folder_name]) +% catch +% ['making ../confident_' folder_name] +% selector = @(n) (n>10000) && (mod(n,20) == 0) ; +% dX = cast{find(ll==max(ll),1)}.X.dX ; +% confident = confident_cones( cone_map.initX , dX , cone_map , selector ) ; +% end +% save(['../confident_' folder_name], 'confident') ; +% plot_cone_field( confident , cone_map ) +% +% plot_LL_ncones( greed , mcmc , cast , cone_map ) +plot_LL_ncones( {} , mcmc , cast , cone_map ) +% plot_Greedy_MCMC_CAST( greed , mcmc , cast , cone_map ) + +if strcmp(cone_map.type,'george') + timeline(greed,mcmc,cast,cone_map.initX, sum(cone_map.N_spikes)) +end + + +% % [sta,invww] = denoised_sta( greed.initX , cast{1}.X.dX , cone_map, selector ) ; +% % make_sta_plots( sta , invww, 'denoised' ) + +cd(here) + +end \ No newline at end of file
kolia/cones_MC
fee3ec36c0b01c0f71c3d84c5cf51300786f6ee2
remake_initX restores initX as necessary
diff --git a/remake_initX.m b/remake_initX.m new file mode 100644 index 0000000..89ccdee --- /dev/null +++ b/remake_initX.m @@ -0,0 +1,23 @@ +function cone_map = remake_initX( cone_map, hot ) +% remake cone_map.initX if it was deleted + +if ~isfield(cone_map,'initX') + if nargin<2, hot = false ; end + + %% initial empty X + cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... + cone_map.N_colors, cone_map.SS, ... + cone_map.cone_params.replusion_radii, ... + 1, 1) ; + + if hot + % rerun 'hot' greedy algorithm, to initialize X replay + greed_hot = GREEDY(cone_map, 'hot') ; + cone_map.initX = greed_hot.X ; + end + + %% transfer all info from cone_map to cone_map.initX + cone_map.initX = transfer_info( cone_map, cone_map.initX ) ; +end + +end \ No newline at end of file
kolia/cones_MC
f206b5ceb29ccec70729acb3874d4d1c6e1b320b
transfer_info transfers all fields with fewer than 10000 bytes
diff --git a/transfer_info.m b/transfer_info.m new file mode 100644 index 0000000..73a5e96 --- /dev/null +++ b/transfer_info.m @@ -0,0 +1,22 @@ +function B = transfer_info( A, B, byte_cutoff ) +% Transfer all fields that are in a but not in b into b, only if their +% contents are smaller than byte_cutoff bytes (default is 10000). + +if nargin<3, byte_cutoff = 1e4 ; end + +names = fieldnames(A) ; + +for i=1:numel(names) + name = names{i} ; + if ~isfield(B,name) + content = A.(name) ; + content_whos = whos('content') ; + content_size = content_whos.bytes ; +% fprintf('%s: %d bytes\n',name,content_size) + if content_size <= byte_cutoff + B.(name) = content ; + end + end +end + +end \ No newline at end of file
kolia/cones_MC
142a57a7c43a44488a22dca1a051acca0ee55a48
renamed cone_map.type to cone_map.datafolder
diff --git a/cone_map_string.m b/cone_map_string.m index 78c1d73..4fa22b9 100644 --- a/cone_map_string.m +++ b/cone_map_string.m @@ -1,7 +1,7 @@ function base_str = cone_map_string(cone_map) -base_str = sprintf('%s__%.0eiters', cone_map.type,cone_map.N_iterations) ; +base_str = sprintf('%s__%.0eiters', cone_map.datafolder,cone_map.N_iterations) ; base_str(base_str=='+') = '' ; base_str(base_str=='.') = '' ; end \ No newline at end of file
kolia/cones_MC
e689bf0341bb626b74cbf2ca792a9aa914298705
renamed greedy_cones to greedy, and greedy to greedy_regular
diff --git a/greedy.m b/greedy.m index f19bbf1..10a1e31 100644 --- a/greedy.m +++ b/greedy.m @@ -1,105 +1,80 @@ -function [X,done] = greedy( X , PROB ) +function cone_map = GREEDY( cone_map , speed ) -% if X.N_cones == 0 -% profile clear -% profile on -% elseif mod(X.N_cones,10) == 0 -% p = profile('info'); -% save(sprintf('profdat_%d',X.N_cones),'p') -% profile clear -% end +warning off +if nargin<2 % default is regular greedy (anything but 0: 'hot' version) + speed = 0 ; +end + +% plot, display, and save every N iterations (0 = never) +display_every = 1 ; +default( cone_map , 'plot_every' , 0 ) +default( cone_map , 'save_every' , 500 ) -M0 = PROB.M0 * PROB.SS ; -M1 = PROB.M1 * PROB.SS ; +% no need to track_contacts, greedy does not shift cones, it just adds them +if ~isfield(cone_map , 'track_contacts'), cone_map.track_contacts = false ; end -oldll = X.ll ; -if ~isfield(X,'changed_x') - X.greedy_ll = PROB.LL ; +if speed + fprintf('\n\nSTARTING ''hot'' greedy search') else - X = update_changed(X,PROB) ; -% figure(3) -% ll = X.greedy_ll{1}(min(X.changed_x)+2:max(X.changed_x)-2,min(X.changed_y)+2:max(X.changed_y)-2) ; -% imagesc(ll/max(ll(:))) -% fprintf('changed greedy_ll min %f median %f max %f',min(ll(:)), median(ll(:)), max(ll(:))) + fprintf('\n\nSTARTING greedy search') end -% if mod(X.N_cones , 100) == 99 -% fprintf(' LL min %f max %f',min(X.greedy_ll(isfinite(X.greedy_ll))), max(X.greedy_ll(:))) -% figure(1) -% pe = plotable_evidence(X.greedy_ll) ; -% imagesc(pe) -% -% figure(2) -% plot_cones(X.state,PROB) ; -% 'word' -% end +% initializing variables +X = cone_map.initX ; -[mm,I] = max(X.greedy_ll(:)) ; -[mx,my,mc] = ind2sub(size(PROB.LL),I) ; +% if not tracking contacts, contact field is not needed +if ~cone_map.track_contacts, try X = rmfield(X,'contact') ; end ; end -if mm>0 - done = false ; - - sx = mod(mx-1,PROB.SS)+1 ; - sy = mod(my-1,PROB.SS)+1 ; +if plot_every +scrsz = get(0,'ScreenSize'); +h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; +end -% [SIZEX,SIZEY] = size(squeeze(PROB.coneConv(:,:,sx,sy))) ; -% [changed_x, changed_y] = find( ones(SIZEX+40,SIZEY+40) ) ; -% changed_x = changed_x-20 ; -% changed_y = changed_y-20 ; - [changed_x, changed_y] = find( squeeze(PROB.coneConv(:,:,sx,sy)) > 0 ) ; - - changed_x = changed_x + mx - sx - PROB.R ; - changed_y = changed_y + my - sy - PROB.R ; - - keep = logical( (changed_x>0) .* (changed_x<=M0) .* (changed_y>0) .* (changed_y<=M1) ) ; - - X.changed_x = changed_x(keep) ; - X.changed_y = changed_y(keep) ; - X.last_x = mx ; - X.last_y = my ; - X.last_c = mc ; - - newX = flip_LL( X , [mx my mc] , PROB , [1 1]) ; - if newX.ll>=X.ll - X = update_X({newX},1,PROB.track_contacts) ; +% GREEDY addition of cones, one at a time +t = cputime ; +tic +for jj=1:cone_map.initX.maxcones + + % try adding a cone + if speed + [X,done] = greedy_hot(X,cone_map) ; else - X = update_changed(X,PROB) ; + [X,done] = greedy(X,cone_map) ; end - - try - fprintf(' #keep_cones %d, #keep_GCs %d mm-dll %f mm-PROB.ll %f',... - nnz(X.keep_cones),numel(X.keep_GCs),mm-newX.ll+oldll,mm-PROB.LL(mx,my,mc)) ; + N_cones = numel(find(X.state>0)) ; + + % DISPLAY stdout + if ~mod(jj,display_every) + fprintf('\nCones:%4d, %4d %.0f\tin %8.2f sec',jj,N_cones,X.ll,toc) + tic end -else - done = true ; - X = rmfield(X,{'changed_x','changed_y','last_x','last_y'}) ; -end - -end - -function X = update_changed(X,PROB) - -M0 = PROB.M0 * PROB.SS ; -M1 = PROB.M1 * PROB.SS ; -used = 0 ; -inds = zeros(PROB.N_colors*numel(X.changed_x),1) ; -gree = zeros(PROB.N_colors*numel(X.changed_x),1) ; -for i=1:numel(X.changed_x) - x = X.changed_x(i) ; - y = X.changed_y(i) ; - ne = not_excluded( X, x, y ) ; - for c=1:3 - used = used + 1 ; - inds(used) = x + (y-1)*M0 + (c-1)*M0*M1 ; - if ne && ~isempty(PROB.sparse_struct{x,y,c}) - sample = flip_LL( X , [x y c] , PROB , [1 1]) ; - gree(used) = sample.ll - X.ll ; - else - gree(used) = -Inf ; - end + + % DISPLAY plot + if plot_every && ~mod(jj,plot_every) + figure(h) + plot_cones( X.state , cone_map ) ; + title(sprintf('Iteration %d',jj),'FontSize',16) + drawnow + end + + % SAVE to disk + save_now = done | jj/(N_cones+1)>1.1 ; + if ~mod(jj,save_every) || save_now + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + try X = rmfield(X,'excluded') ; end + X = remake_X(cone_map,X) ; + try to_save.X = rmfield(X,{'invWW'}) ; end + save('result', 'to_save' ) + if save_now , break ; + else clear to_save; end end end -X.greedy_ll(inds(1:used)) = gree(1:used) ; +fprintf('\ndone in %.1f sec\n\n',cputime - t) ; -end +cone_map.X = X ; +cone_map.code = file2str('greedy_cones.m') ; +cone_map.N_cones = N_cones ; +% save('results','cone_map','X') + +end \ No newline at end of file diff --git a/greedy_cones.m b/greedy_cones.m deleted file mode 100644 index b331d9a..0000000 --- a/greedy_cones.m +++ /dev/null @@ -1,80 +0,0 @@ -function cone_map = greedy_cones( cone_map , speed ) - -warning off -if nargin<2 % default is regular greedy (anything but 0: 'hot' version) - speed = 0 ; -end - -% plot, display, and save every N iterations (0 = never) -display_every = 1 ; -default( cone_map , 'plot_every' , 0 ) -default( cone_map , 'save_every' , 500 ) - -% no need to track_contacts, greedy does not shift cones, it just adds them -if ~isfield(cone_map , 'track_contacts'), cone_map.track_contacts = false ; end - -if speed - fprintf('\n\nSTARTING ''hot'' greedy search') -else - fprintf('\n\nSTARTING greedy search') -end - -% initializing variables -X = cone_map.initX ; - -% if not tracking contacts, contact field is not needed -if ~cone_map.track_contacts, try X = rmfield(X,'contact') ; end ; end - -if plot_every -scrsz = get(0,'ScreenSize'); -h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; -end - -% GREEDY addition of cones, one at a time -t = cputime ; -tic -for jj=1:cone_map.initX.maxcones - - % try adding a cone - if speed - [X,done] = greedy_hot(X,cone_map) ; - else - [X,done] = greedy(X,cone_map) ; - end - N_cones = numel(find(X.state>0)) ; - - % DISPLAY stdout - if ~mod(jj,display_every) - fprintf('\nCones:%4d, %4d %.0f\tin %8.2f sec',jj,N_cones,X.ll,toc) - tic - end - - % DISPLAY plot - if plot_every && ~mod(jj,plot_every) - figure(h) - plot_cones( X.state , cone_map ) ; - title(sprintf('Iteration %d',jj),'FontSize',16) - drawnow - end - - % SAVE to disk - save_now = done | jj/(N_cones+1)>1.1 ; - if ~mod(jj,save_every) || save_now - % use less disk space: remove large data structures - to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; - try X = rmfield(X,'excluded') ; end - X = remake_X(cone_map,X) ; - try to_save.X = rmfield(X,{'invWW'}) ; end - save('result', 'to_save' ) - if save_now , break ; - else clear to_save; end - end -end -fprintf('\ndone in %.1f sec\n\n',cputime - t) ; - -cone_map.X = X ; -cone_map.code = file2str('greedy_cones.m') ; -cone_map.N_cones = N_cones ; -% save('results','cone_map','X') - -end \ No newline at end of file diff --git a/greedy_regular.m b/greedy_regular.m new file mode 100644 index 0000000..b1a87af --- /dev/null +++ b/greedy_regular.m @@ -0,0 +1,105 @@ +function [X,done] = greedy_regular( X , PROB ) + +% if X.N_cones == 0 +% profile clear +% profile on +% elseif mod(X.N_cones,10) == 0 +% p = profile('info'); +% save(sprintf('profdat_%d',X.N_cones),'p') +% profile clear +% end + +M0 = PROB.M0 * PROB.SS ; +M1 = PROB.M1 * PROB.SS ; + +oldll = X.ll ; +if ~isfield(X,'changed_x') + X.greedy_ll = PROB.LL ; +else + X = update_changed(X,PROB) ; +% figure(3) +% ll = X.greedy_ll{1}(min(X.changed_x)+2:max(X.changed_x)-2,min(X.changed_y)+2:max(X.changed_y)-2) ; +% imagesc(ll/max(ll(:))) +% fprintf('changed greedy_ll min %f median %f max %f',min(ll(:)), median(ll(:)), max(ll(:))) +end + +% if mod(X.N_cones , 100) == 99 +% fprintf(' LL min %f max %f',min(X.greedy_ll(isfinite(X.greedy_ll))), max(X.greedy_ll(:))) +% figure(1) +% pe = plotable_evidence(X.greedy_ll) ; +% imagesc(pe) +% +% figure(2) +% plot_cones(X.state,PROB) ; +% 'word' +% end + +[mm,I] = max(X.greedy_ll(:)) ; +[mx,my,mc] = ind2sub(size(PROB.LL),I) ; + +if mm>0 + done = false ; + + sx = mod(mx-1,PROB.SS)+1 ; + sy = mod(my-1,PROB.SS)+1 ; + +% [SIZEX,SIZEY] = size(squeeze(PROB.coneConv(:,:,sx,sy))) ; +% [changed_x, changed_y] = find( ones(SIZEX+40,SIZEY+40) ) ; +% changed_x = changed_x-20 ; +% changed_y = changed_y-20 ; + [changed_x, changed_y] = find( squeeze(PROB.coneConv(:,:,sx,sy)) > 0 ) ; + + changed_x = changed_x + mx - sx - PROB.R ; + changed_y = changed_y + my - sy - PROB.R ; + + keep = logical( (changed_x>0) .* (changed_x<=M0) .* (changed_y>0) .* (changed_y<=M1) ) ; + + X.changed_x = changed_x(keep) ; + X.changed_y = changed_y(keep) ; + X.last_x = mx ; + X.last_y = my ; + X.last_c = mc ; + + newX = flip_LL( X , [mx my mc] , PROB , [1 1]) ; + if newX.ll>=X.ll + X = update_X({newX},1,PROB.track_contacts) ; + else + X = update_changed(X,PROB) ; + end + + try + fprintf(' #keep_cones %d, #keep_GCs %d mm-dll %f mm-PROB.ll %f',... + nnz(X.keep_cones),numel(X.keep_GCs),mm-newX.ll+oldll,mm-PROB.LL(mx,my,mc)) ; + end +else + done = true ; + X = rmfield(X,{'changed_x','changed_y','last_x','last_y'}) ; +end + +end + +function X = update_changed(X,PROB) + +M0 = PROB.M0 * PROB.SS ; +M1 = PROB.M1 * PROB.SS ; +used = 0 ; +inds = zeros(PROB.N_colors*numel(X.changed_x),1) ; +gree = zeros(PROB.N_colors*numel(X.changed_x),1) ; +for i=1:numel(X.changed_x) + x = X.changed_x(i) ; + y = X.changed_y(i) ; + ne = not_excluded( X, x, y ) ; + for c=1:3 + used = used + 1 ; + inds(used) = x + (y-1)*M0 + (c-1)*M0*M1 ; + if ne && ~isempty(PROB.sparse_struct{x,y,c}) + sample = flip_LL( X , [x y c] , PROB , [1 1]) ; + gree(used) = sample.ll - X.ll ; + else + gree(used) = -Inf ; + end + end +end +X.greedy_ll(inds(1:used)) = gree(1:used) ; + +end
kolia/cones_MC
e0dd32ca6f8a35123c72fdc407241f7f5cb91bdc
bugfix
diff --git a/MCMC.m b/MCMC.m index 937e609..b22eb6c 100644 --- a/MCMC.m +++ b/MCMC.m @@ -1,119 +1,119 @@ function to_save = MCMC( cone_map , ID ) % defaults default( cone_map , 'N_iterations' , 1000000) default( cone_map , 'plot_every' , 0 ) default( cone_map , 'display_every' , 50 ) default( cone_map , 'save_every' , 0 ) default( cone_map , 'ID' , 0 ) default( cone_map , 'max_time' , 200000 ) % IDs for each chain on the cluster; not useful for single local execution if nargin>1 , cone_map.ID = ID ; end % has_evidence is true only where cones contribute to the likelihood cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; % archive this file into saved result, for future reference cone_map.code.string = file2str('MCMC.m') ; -% reduce memory footprint: LL is only used by greedy -cone_map = rmfield(cone_map,'LL') - % Initialize figure if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; end % MAIN MCMC LOOP fprintf('\n\nMCMC progress:') t = cputime ; tic n_runs = 1 ; %% initialization with 'hot' greedy configuration cone_map.track_contacts = true ; greed_hot = greedy_cones(cone_map, 'hot') ; cone_map.initX = greed_hot.X ; +% reduce memory footprint: LL is only used by greedy +cone_map = rmfield(cone_map,'LL') + % initialize MCMC loop X = cone_map.initX ; runbest = X ; runbest.i = 1 ; jj = 1 ; cone_map.bestX = {} ; n_best = 1 ; %% main MCMC loop while 1 % trials{i} is a proposed new configuration; each contains a new ll trials = move(X, cone_map, [1 1]) ; % choose one of the candidates, update_X its data structures X = flip_MCMC( X, trials, cone_map, {[1 1]} ) ; % keep track of best configuration encountered if X.ll>runbest.ll runbest = X ; runbest.i = jj ; end % reinitialize to cone_map.initX if MCMC becomes stuck if jj - runbest.i > cone_map.M0*cone_map.M1/3 % use less disk space and memory: remove large data structures runbest = rmfield(runbest,{'masks','contact'}) ; try runbest = rmfield(runbest,'invWW') ; end try runbest = rmfield(runbest,{'LL_history','cputime','N_cones_history','dX','excluded','sparse_STA_W_state'}) ; end % record current best confguration before reinitializing cone_map.bestX{n_best} = runbest ; n_best = n_best + 1 ; % reinitialize fprintf('reinitializing...\n') runbest = cone_map.initX ; runbest.LL_history = X.LL_history ; runbest.N_cones_history = X.N_cones_history ; runbest.cputime = X.cputime ; runbest.iteration = X.iteration ; runbest.i = jj ; n_runs = n_runs + 1 ; X = runbest ; end % DISPLAY to stdout if ~mod(jj,display_every) fprintf('Iter%4d of %d %4d cones %6.0f L %6.0f best %8.2f sec\n',... jj,N_iterations,numel(find(X.state>0)),X.ll,... runbest.ll,toc) tic end % PLOT if ~mod(jj,plot_every) figure(h) plot_cones( X.state , cone_map ) ; title( sprintf('After %d MCMC iterations',jj),'FontSize' , 24 ) % set(get(gca,'Title'),'Visible','on') drawnow end % SAVE to disk if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; to_save.X = rmfield(X,{'contact'}) ; try to_save.X = rmfield(X,{'invWW'}) ; end save(sprintf('result_%d',ID), 'to_save' ) if jj>N_iterations || cputime-t>max_time, break ; else clear to_save end end jj = jj + 1 ; end fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; end
kolia/cones_MC
b5e3157c66cacacf8bb83a8b9794aa6290ccd85c
bugfix
diff --git a/remake_X.m b/remake_X.m index 7db1483..cc395db 100644 --- a/remake_X.m +++ b/remake_X.m @@ -1,27 +1,27 @@ function Y = remake_X( cone_map, X ) Y = X ; if ~isfield(X,'WW') || ~isfield(X,'contact') Y = initialize_X( cone_map.M0, cone_map.M1, ... cone_map.N_colors, cone_map.SS, ... cone_map.cone_params.replusion_radii, ... - cone_map.naive_LL, 1, 1) ; + 1, 1) ; [x,y,c] = find(X.state) ; for i=1:numel(x) Y = flip_LL( Y , [x(i) y(i) c(i)] , cone_map , [1 1] ) ; Y = update_X({Y}) ; end end if ~isfield(X, 'excluded') Y.excluded = false(Y.M0,X.M1) ; [x,y,c] = find(Y.state) ; for i=1:numel(x) [~,indices] = not_excluded( Y, x(i), y(i) ) ; Y.excluded(indices) = true ; end end end \ No newline at end of file
kolia/cones_MC
2582da964d22b44f34d75f94ddf2d334a3379185
removed ROI info from main_CAST
diff --git a/main_CAST.m b/main_CAST.m index 2f25f18..cb3e80b 100644 --- a/main_CAST.m +++ b/main_CAST.m @@ -1,35 +1,47 @@ -% function main_CAST( type ) -type = 0 ; +type = 1 ; -cone_map = make_cone_map( type ) ; +warning off -base_str = cone_map_string( cone_map ) ; +if type==1 + type = 'peach' ; + load peach/peach_data % contains 'stas' + load peach/cone_params +else + type = 'george' ; + load george/stas % contains 'stas' + load george/cone_params % contains 'cone_params' + cone_params.stimulus_variance = 1 ; +end -% THEN RUN THIS to run on your own computer: -% try -% load(['greed_' base_str]) -% catch e -% greed = greedy_cones(cone_map) ; save(['greed_' base_str],'greed') ; -% end +cone_map = exact_LL_setup(stas,cone_params) ; % cone_map, aka PROB or data + +cone_map.N_iterations = 1e3 ; +cone_map.max_time = 4e5 ; -greed_fast = greedy_cones(cone_map, 'fast') ; -cone_map.initX = greed_fast.X ; +cone_map.initX.type = type ; +cone_map.type = type ; +cone_map.initX.N_iterations = cone_map.N_iterations ; -% mcmc = MCMC(cone_map) ; save(['mcmc_' base_str],'mcmc' ) -% cast = CAST(cone_map) ; save(['cast_' base_str],'cast' ) +cone_map.plot_every = 0 ; +base_str = cone_map_string( cone_map ) ; + +% THEN RUN THIS to run on your own computer: +greed = greedy_cones(cone_map) ; save(['greed_' base_str],'greed') ; +mcmc = MCMC(cone_map) ; save(['mcmc_' base_str],'mcmc' ) +cast = CAST(cone_map) ; save(['cast_' base_str],'cast' ) % OR THIS to run 50 MCMC instances and 50 CAST on the hpc cluster: % INSTALL AGRICOLA FIRST % N = 30 ; % ids = cell(1,N) ; % for i=1:length(ids) , ids{i} = {i} ; end % % PBS.l.mem = '1500mb' ; % PBS.l.walltime = '70:00:00' ; % sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; % % PBS.l.mem = '1500mb' ; % PBS.l.walltime = '70:00:00' ; % sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; % % sow(['greed_' base_str],@()greedy_cones(cone_map)) ;
kolia/cones_MC
0f1bffc5ead41db25ab393c8e63d6a91eec8fc59
comment in flip_LL
diff --git a/flip_LL.m b/flip_LL.m index a31e780..70f7c4e 100644 --- a/flip_LL.m +++ b/flip_LL.m @@ -1,155 +1,156 @@ function X = flip_LL( X , flips , PROB , T ) % X = flip_LL( X , flips , PROB , T ) % -% pardon my appearance, i've been optimized for speed, not prettiness +% This is where most cpu time is spent, +% pardon my appearance, i've been optimized for speed, not prettiness. % % Apply flips to configuration X, and update log-likelihood of X. % Bits in X.state are flipped, and the inverse X.invWW of WW is updated. % Some other book-keeping variables are stored in X, for speed. % The matrix inverse is not recalculated each time: % block matrix inverse update formulas are used to update X.invWW % incrementally, for speed. % % Only updates X.WW if X.invWW is not present in input X. M0 = PROB.M0 * PROB.SS ; for i=1:size(flips,1) x = flips(i,1) ; y = flips(i,2) ; c = flips(i,3) ; [posX,posY,colors] = find(X.state) ; if ~c && ~X.state(x,y) error('deleting nonexistent cone...') else % cone deletion k = x + M0*(y-1) ; end j = sum( posX + M0*(posY-1) <= k ) ; % block matrix inverse update if ~c % update inverse by deleting jth row/column inds = [1:j-1 j+1:X.N_cones] ; X.N_cones = X.N_cones - 1 ; STA_W_state_j = X.sparse_STA_W_state(:, j) ; keep_GCs = find(PROB.quad_factors .* STA_W_state_j.^2 / double(X.WW(j,j)) ... + PROB.N_cones_terms > 0) ; if isfield(X,'invWW') invWW = X.invWW(inds,inds) - ... X.invWW(inds,j)*X.invWW(j,inds)/X.invWW(j,j) ; X.invWW = invWW ; end if isfield(X,'WW') X.WW = X.WW(inds,inds) ; end X.sparse_STA_W_state = X.sparse_STA_W_state(:, inds ) ; keep_cones = sum(X.sparse_STA_W_state(keep_GCs,:),1)>0 ; X.contributions(keep_GCs) = ... sum((double(X.WW(keep_cones,keep_cones))\... X.sparse_STA_W_state(keep_GCs,keep_cones)')' ... .* X.sparse_STA_W_state(keep_GCs,keep_cones),2) ; X.state(x,y)= 0 ; X.diff = [X.diff ; x y 0] ; else % update inverse by adding row/column j = j + 1 ; X.N_cones = X.N_cones + 1 ; inds = [1:j-1 j+1:X.N_cones] ; Wkinds = [posX'-x ; posY'-y] ; ssx = 1+mod(x-1,PROB.SS) ; ssy = 1+mod(y-1,PROB.SS) ; Wkstate = zeros(1,X.N_cones-1) ; where = find( max(abs(Wkinds),[],1) <= PROB.R ) ; if ~isempty(where) xx = Wkinds(1,where)+PROB.R+ssx ; yy = Wkinds(2,where)+PROB.R+ssy ; for kk=1:length(where) Wkstate(where(kk)) = PROB.coneConv(xx(kk),yy(kk),ssx,ssy) ... .* PROB.colorDot(c,colors(where(kk))) ; end end Wkkc = PROB.coneConv(PROB.R+ssx,PROB.R+ssy,ssx,ssy) * PROB.colorDot(c,c) ; if isfield(X,'invWW') invWW = X.invWW ; r = Wkstate * invWW ; X.invWW = zeros(X.N_cones) ; if ~isempty(r) q = 1/( Wkkc - r*Wkstate' ) ; cc = invWW * Wkstate' * q ; X.invWW(inds,inds) = invWW+cc*r ; X.invWW(inds,j) = -cc ; X.invWW(j,inds) = -r*q ; else q = 1/Wkkc ; end X.invWW(j,j) = q ; else if ~issparse(X.WW) ; X.WW = sparse(double(X.WW)) ; end [wwx,wwy,wwv] = find(X.WW) ; wwx = [inds(wwx) j*ones(1,numel(Wkstate)+1) inds] ; wwy = [inds(wwy) inds j*ones(1,numel(Wkstate)+1)] ; wwv = [wwv' Wkstate Wkkc Wkstate] ; X.WW = sparse(wwx,wwy,wwv,X.N_cones,X.N_cones) ; end sparse_STA_W_state = X.sparse_STA_W_state ; X.sparse_STA_W_state = sparse([],[],[],PROB.N_GC,X.N_cones) ; if ~isempty(inds) X.sparse_STA_W_state(:,inds) = sparse_STA_W_state ; end xi = (x-0.5)/PROB.SS ; yi = (y-0.5)/PROB.SS ; [filter,tt,rr,bb,ll] = filter_bounds( xi, yi, PROB.M0,PROB.M1,PROB.gaus_boxed,... PROB.cone_params.support_radius) ; keep_GCs = PROB.sparse_struct{x,y,c} ; if ~isfield(X,'contributions') X.contributions = zeros(PROB.N_GC,1) ; end if ~isempty(keep_GCs) sta = PROB.STA(:,tt:bb,ll:rr,keep_GCs) ; sta = reshape( sta, [], numel(keep_GCs) ) ; STA_W_state_j = sta' * kron(filter(:),PROB.cone_params.colors(c,:)') ; X.sparse_STA_W_state( keep_GCs, j ) = STA_W_state_j ; keep_cones = sum(abs(X.sparse_STA_W_state(keep_GCs,:)),1)>0 ; if ~isempty(keep_GCs) X.contributions(keep_GCs) = ... sum((double(X.WW(keep_cones,keep_cones))\... X.sparse_STA_W_state(keep_GCs,keep_cones)')'... .* X.sparse_STA_W_state(keep_GCs,keep_cones),2) ; end X.keep_cones = keep_cones ; end X.keep_GCs = keep_GCs ; X.state(x,y) = c ; X.diff = [X.diff ; x y c] ; end end % recalculate data log-likelihood ll = calculate_LL( X , PROB , T ) ; X.T = T ; X.ll = ll ; end \ No newline at end of file
kolia/cones_MC
02d7c3e3395d0cf7ca421f064bacc7eb270fc868
cone_map_string only uses type and N_iterations
diff --git a/cone_map_string.m b/cone_map_string.m index 75310aa..78c1d73 100644 --- a/cone_map_string.m +++ b/cone_map_string.m @@ -1,15 +1,7 @@ function base_str = cone_map_string(cone_map) -% log_iters = round( log(cone_map.N_iterations)/log(10) ) ; - -base_str = sprintf('%s_NROI%d_ROI%d%d_support%d_SS%d_beta%.1f_delta%.1f_%.0eiters',... - cone_map.type,cone_map.NROIs,... - cone_map.rois(1),cone_map.rois(2),... - cone_map.cone_params.support_radius,... - cone_map.cone_params.supersample,... - cone_map.min_beta,cone_map.min_delta,... - cone_map.N_iterations) ; +base_str = sprintf('%s__%.0eiters', cone_map.type,cone_map.N_iterations) ; base_str(base_str=='+') = '' ; base_str(base_str=='.') = '' ; end \ No newline at end of file
kolia/cones_MC
3ab2e66d155993e9411bb2c6fc0e7cef843fbd64
commented exact_LL_setup
diff --git a/exact_LL_setup.m b/exact_LL_setup.m index ce58ff3..322862a 100644 --- a/exact_LL_setup.m +++ b/exact_LL_setup.m @@ -1,216 +1,224 @@ function cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) %% cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) % Expand data and parameters into variables used to calculate likelihoods. % Mainly, spatial supersampling by a factor of cone_map.supersample is % applied to the STAs, and the convolution of the STAs with the cone % receptive fields is used to calculate the sparsity structure of % connections between cones and GCs, as well as a map of LL increases. if nargin < 3 , cone_map = struct ; end % size of data [M0,M1,cone_map.N_colors] = size(GC_stas(1).spatial) ; %% unpack data from GC_stas % supersample factor SS = cone_params.supersample ; % radius used for convolutions with cone RFs R = ceil( cone_params.support_radius * SS ) ; cone_params.support_radius = ceil(cone_params.support_radius) ; % copy cone_params cone_map.cone_params = cone_params ; % set up Region of Interest if it doesn't already exist % these are fractional (x,y) coordinates, due to supersampling if ~isfield(cone_map,'ROI') x = repmat( 1/(2*SS):1/SS:M0-1/(2*SS) , 1 , M1*SS ) ; y = repmat( 1/(2*SS):1/SS:M1-1/(2*SS) , M0*SS , 1 ) ; - ROI = [x' y(:)] ; + cone_map.ROI = [x' y(:)] ; clear x y -else - ROI = cone_map.ROI ; end % total number of possible cone positions -cone_map.NROI = size(ROI,1) ; +cone_map.NROI = size(cone_map.ROI,1) ; % unpack GC_stas into: supersampled STAs, norms of STAs and N_spikes N_GC = length(GC_stas) ; STA_norm = zeros(N_GC,1) ; cone_map.N_spikes = zeros(N_GC,1) ; STA = zeros(cone_map.N_colors,M0,M1,N_GC) ; for i=1:N_GC cone_map.N_spikes(i) = length(GC_stas(i).spikes) ; STA(:,:,:,i) = reshape(permute(GC_stas(i).spatial,[3 1 2]), cone_map.N_colors, M0, M1 ) ; STA_norm(i) = norm(reshape(STA(:,:,:,i),1,[])) ; end %% calculate some constants etc in advance, to speed up actual calculations % memoized function returning gaussian mass in a square pixel box cone_map.gaus_boxed = gaus_in_a_box_memo( cone_params.sigma, SS, cone_params.support_radius ) ; % constants used to calculate the log-likelihood cone_map.cell_consts = cone_map.N_spikes * cone_params.stimulus_variance ; cone_map.prior_covs = (cone_params.stimulus_variance ./ STA_norm ).^2 ; cone_map.cov_factors = cone_map.cell_consts+cone_map.prior_covs ; cone_map.N_cones_terms = log( cone_map.prior_covs ) - log( cone_map.cov_factors) ; cone_map.quad_factors = cone_map.N_spikes.^2 ./ cone_map.cov_factors ; % for fast lookup of legal shift moves in move.m cone_map.outofbounds = sparse([],[],[],M0*SS,M1*SS,2*(M0+M1)*SS) ; cone_map.outofbounds(:,[1 M1*SS]) = 1 ; cone_map.outofbounds([1 M0*SS],:) = cone_map.outofbounds([1 M0*SS],:) + 1 ; % copy params cone_map.M0 = M0 ; cone_map.M1 = M1 ; cone_map.N_GC = N_GC ; cone_map.SS = SS ; cone_map.R = R ; cone_map.STA = single( STA ) ; cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; cone_map.colorDot = cone_params.colors * cone_params.colors' ; %% make lookup table for dot products of cone RFs in all possible positions cone_map.coneConv = zeros( 2*R+SS , 2*R+SS , SS , SS ) ; WW = zeros(SS,SS) ; f = 1/(2*SS):1/SS:2*R/SS+1 ; for xx=1:2*R+SS x = f(xx) ; for yy=1:2*R+SS y = f(yy) ; a = make_filter_new(4*R/SS+1,4*R/SS+1,x+R/SS,y+R/SS,cone_map.gaus_boxed,... cone_map.cone_params.support_radius) ; for ss=1:SS s = (ss-0.5)/SS ; for tt=1:SS t = (tt-0.5)/SS ; b = make_filter_new(4*R/SS+1,4*R/SS+1,2*R/SS+s,2*R/SS+t,... cone_map.gaus_boxed,cone_map.cone_params.support_radius) ; cone_map.coneConv(xx,yy,ss,tt) = dot(a(:),b(:)) ; end end if (xx<=SS) && (yy<=SS) WW(xx,yy) = dot(a(:),a(:)) ; end end end %% calculate sparsity structure and map of LL increases [cone_map.sparse_struct,cone_map.LL] = ... make_sparse_struct(cone_map,STA,WW,cone_map.gaus_boxed) ; %% cone_map.NICE is a pretty visualizable version of cone_map.LL IC = inv(cone_params.colors) ; QC = reshape( reshape(cone_map.LL,[],3) * IC', size(cone_map.LL) ) ; cone_map.NICE = plotable_evidence( QC ) ; % imagesc( cone_map.NICE ) %% some default values cone_map.N_iterations = 100000; cone_map.max_time = 200000; cone_map.N_fast = 1 ; cone_map.q = 0.5 ; cone_map.ID = 0 ; +%% initial empty X cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... cone_map.N_colors, cone_map.SS, ... cone_map.cone_params.replusion_radii, ... 1, 1) ; - -% sanity check: compare cone_map.make_STA_W with make_LL +%% quick sanity check: compare cone_map.make_STA_W with make_LL mLL = max(cone_map.LL(:)) ; mx = 63 ; my = 32 ; mc = 1 ; tX = flip_LL( cone_map.initX , [mx my mc] , cone_map , [1 1] ) ; fprintf('\nLL and flip_ll: %f,%f, at x%d,y%d,c%d\n',mLL,tX.ll,mx,my,mc) ; range_x = mx+(-4:5) ; range_y = my+(-4:5) ; test = zeros(numel(range_x),numel(range_y)) ; for iii=range_x for jjj=range_y tX = flip_LL( cone_map.initX , [iii jjj 1] , cone_map , [1 1] ) ; test(iii,jjj) = tX.ll ; end end fprintf('\n') disp(test(range_x,range_y)) disp(cone_map.LL(range_x,range_y,1)) disp( test(range_x,range_y) - cone_map.LL(range_x,range_y,1) ) fprintf('\n') end + function [sparse_struct, LL] = make_sparse_struct(cone_map,STA,WW,gaus_boxed) +% calculate sparsity structure of connections between all possible cone +% locations and GCs, as well as the map of log-likelihoods of all +% single-cone configurations M0 = cone_map.M0 ; M1 = cone_map.M1 ; SS = cone_map.SS ; support = cone_map.cone_params.support_radius ; colors = cone_map.cone_params.colors ; LL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; supersamples = 1/(2*SS):1/SS:1 ; gs = cell(SS) ; sparse_struct = cell( M0*SS, M1*SS, cone_map.N_colors ) ; +% for every supersampled location within one pixel, calculate the cone RF for ii=1:SS for jj=1:SS i = supersamples(ii) ; j = supersamples(jj) ; g = reshape( gaus_boxed(i,j), [2*support+1 2*support+1]) ; gs{ii,jj} = g(end:-1:1,end:-1:1) ; end end fprintf('making sparse struct and LL for GC number') for gc=1:cone_map.N_GC gcLL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; + % convolve all cone RFs with all GC STAs for ii=1:SS for jj=1:SS CC = zeros(M0*M1,cone_map.N_colors) ; for color=1:cone_map.N_colors CCC = conv2( squeeze(STA(color,:,:,gc)), gs{ii,jj} ) ; CCC = CCC(support+1:M0+support,support+1:M1+support) ; CC(:,color) = CCC(:) ; end C = 0.5 * cone_map.quad_factors(gc) * (CC * colors').^2 / WW(ii,jj) ; + % the max here defines the sparsity C = max(0,C+0.5*cone_map.N_cones_terms(gc)) ; gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) = ... gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) + reshape(C,[M0 M1 3]) ; end end + % record sparsity in sparse_struct [x,yc] = find( gcLL>0 ) ; y = 1+mod(yc-1,M1*SS) ; c = ceil( yc/(M1*SS) ) ; for i=1:numel(x) sparse_struct{x(i),y(i),c(i)} = int16([sparse_struct{x(i),y(i),c(i)} gc]) ; end LL = LL + gcLL ; fprintf(' %d',gc) end end function filter = make_filter_new(M0,M1,i,j,gaus_boxed, support) +% make cone RF centered at (i,j), being careful about boundaries + filter = zeros(M0,M1) ; [g,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) ; filter(t:b,l:r) = g ; % filter is inverted; doesn't matter for the dot product calculation though % filter = filter(end:-1:1,end:-1:1) ; % uncomment to uninvert end \ No newline at end of file
kolia/cones_MC
97cf816ecc685e3f671417ace204d705282f1019
cosmetic
diff --git a/exact_LL_setup.m b/exact_LL_setup.m index b13faed..ce58ff3 100644 --- a/exact_LL_setup.m +++ b/exact_LL_setup.m @@ -1,216 +1,216 @@ function cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) %% cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) % Expand data and parameters into variables used to calculate likelihoods. % Mainly, spatial supersampling by a factor of cone_map.supersample is % applied to the STAs, and the convolution of the STAs with the cone % receptive fields is used to calculate the sparsity structure of % connections between cones and GCs, as well as a map of LL increases. if nargin < 3 , cone_map = struct ; end % size of data [M0,M1,cone_map.N_colors] = size(GC_stas(1).spatial) ; %% unpack data from GC_stas % supersample factor SS = cone_params.supersample ; % radius used for convolutions with cone RFs R = ceil( cone_params.support_radius * SS ) ; cone_params.support_radius = ceil(cone_params.support_radius) ; % copy cone_params cone_map.cone_params = cone_params ; % set up Region of Interest if it doesn't already exist % these are fractional (x,y) coordinates, due to supersampling if ~isfield(cone_map,'ROI') x = repmat( 1/(2*SS):1/SS:M0-1/(2*SS) , 1 , M1*SS ) ; y = repmat( 1/(2*SS):1/SS:M1-1/(2*SS) , M0*SS , 1 ) ; ROI = [x' y(:)] ; clear x y else ROI = cone_map.ROI ; end % total number of possible cone positions cone_map.NROI = size(ROI,1) ; % unpack GC_stas into: supersampled STAs, norms of STAs and N_spikes N_GC = length(GC_stas) ; STA_norm = zeros(N_GC,1) ; cone_map.N_spikes = zeros(N_GC,1) ; STA = zeros(cone_map.N_colors,M0,M1,N_GC) ; for i=1:N_GC cone_map.N_spikes(i) = length(GC_stas(i).spikes) ; STA(:,:,:,i) = reshape(permute(GC_stas(i).spatial,[3 1 2]), cone_map.N_colors, M0, M1 ) ; STA_norm(i) = norm(reshape(STA(:,:,:,i),1,[])) ; end %% calculate some constants etc in advance, to speed up actual calculations % memoized function returning gaussian mass in a square pixel box cone_map.gaus_boxed = gaus_in_a_box_memo( cone_params.sigma, SS, cone_params.support_radius ) ; % constants used to calculate the log-likelihood cone_map.cell_consts = cone_map.N_spikes * cone_params.stimulus_variance ; cone_map.prior_covs = (cone_params.stimulus_variance ./ STA_norm ).^2 ; cone_map.cov_factors = cone_map.cell_consts+cone_map.prior_covs ; cone_map.N_cones_terms = log( cone_map.prior_covs ) - log( cone_map.cov_factors) ; cone_map.quad_factors = cone_map.N_spikes.^2 ./ cone_map.cov_factors ; % for fast lookup of legal shift moves in move.m cone_map.outofbounds = sparse([],[],[],M0*SS,M1*SS,2*(M0+M1)*SS) ; cone_map.outofbounds(:,[1 M1*SS]) = 1 ; cone_map.outofbounds([1 M0*SS],:) = cone_map.outofbounds([1 M0*SS],:) + 1 ; % copy params cone_map.M0 = M0 ; cone_map.M1 = M1 ; cone_map.N_GC = N_GC ; cone_map.SS = SS ; cone_map.R = R ; cone_map.STA = single( STA ) ; cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; cone_map.colorDot = cone_params.colors * cone_params.colors' ; %% make lookup table for dot products of cone RFs in all possible positions cone_map.coneConv = zeros( 2*R+SS , 2*R+SS , SS , SS ) ; WW = zeros(SS,SS) ; f = 1/(2*SS):1/SS:2*R/SS+1 ; for xx=1:2*R+SS x = f(xx) ; for yy=1:2*R+SS y = f(yy) ; a = make_filter_new(4*R/SS+1,4*R/SS+1,x+R/SS,y+R/SS,cone_map.gaus_boxed,... cone_map.cone_params.support_radius) ; for ss=1:SS s = (ss-0.5)/SS ; for tt=1:SS t = (tt-0.5)/SS ; b = make_filter_new(4*R/SS+1,4*R/SS+1,2*R/SS+s,2*R/SS+t,... cone_map.gaus_boxed,cone_map.cone_params.support_radius) ; cone_map.coneConv(xx,yy,ss,tt) = dot(a(:),b(:)) ; end end if (xx<=SS) && (yy<=SS) WW(xx,yy) = dot(a(:),a(:)) ; end end end -% calculate sparsity structure and map of LL increases +%% calculate sparsity structure and map of LL increases [cone_map.sparse_struct,cone_map.LL] = ... make_sparse_struct(cone_map,STA,WW,cone_map.gaus_boxed) ; -% cone_map.NICE is a pretty visualizable version of cone_map.LL +%% cone_map.NICE is a pretty visualizable version of cone_map.LL IC = inv(cone_params.colors) ; QC = reshape( reshape(cone_map.LL,[],3) * IC', size(cone_map.LL) ) ; cone_map.NICE = plotable_evidence( QC ) ; % imagesc( cone_map.NICE ) -% Some default values +%% some default values cone_map.N_iterations = 100000; cone_map.max_time = 200000; cone_map.N_fast = 1 ; cone_map.q = 0.5 ; cone_map.ID = 0 ; cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... cone_map.N_colors, cone_map.SS, ... cone_map.cone_params.replusion_radii, ... 1, 1) ; % sanity check: compare cone_map.make_STA_W with make_LL mLL = max(cone_map.LL(:)) ; mx = 63 ; my = 32 ; mc = 1 ; tX = flip_LL( cone_map.initX , [mx my mc] , cone_map , [1 1] ) ; fprintf('\nLL and flip_ll: %f,%f, at x%d,y%d,c%d\n',mLL,tX.ll,mx,my,mc) ; range_x = mx+(-4:5) ; range_y = my+(-4:5) ; test = zeros(numel(range_x),numel(range_y)) ; for iii=range_x for jjj=range_y tX = flip_LL( cone_map.initX , [iii jjj 1] , cone_map , [1 1] ) ; test(iii,jjj) = tX.ll ; end end fprintf('\n') disp(test(range_x,range_y)) disp(cone_map.LL(range_x,range_y,1)) disp( test(range_x,range_y) - cone_map.LL(range_x,range_y,1) ) fprintf('\n') end function [sparse_struct, LL] = make_sparse_struct(cone_map,STA,WW,gaus_boxed) M0 = cone_map.M0 ; M1 = cone_map.M1 ; SS = cone_map.SS ; support = cone_map.cone_params.support_radius ; colors = cone_map.cone_params.colors ; LL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; supersamples = 1/(2*SS):1/SS:1 ; gs = cell(SS) ; sparse_struct = cell( M0*SS, M1*SS, cone_map.N_colors ) ; for ii=1:SS for jj=1:SS i = supersamples(ii) ; j = supersamples(jj) ; g = reshape( gaus_boxed(i,j), [2*support+1 2*support+1]) ; gs{ii,jj} = g(end:-1:1,end:-1:1) ; end end fprintf('making sparse struct and LL for GC number') for gc=1:cone_map.N_GC gcLL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; for ii=1:SS for jj=1:SS CC = zeros(M0*M1,cone_map.N_colors) ; for color=1:cone_map.N_colors CCC = conv2( squeeze(STA(color,:,:,gc)), gs{ii,jj} ) ; CCC = CCC(support+1:M0+support,support+1:M1+support) ; CC(:,color) = CCC(:) ; end C = 0.5 * cone_map.quad_factors(gc) * (CC * colors').^2 / WW(ii,jj) ; C = max(0,C+0.5*cone_map.N_cones_terms(gc)) ; gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) = ... gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) + reshape(C,[M0 M1 3]) ; end end [x,yc] = find( gcLL>0 ) ; y = 1+mod(yc-1,M1*SS) ; c = ceil( yc/(M1*SS) ) ; for i=1:numel(x) sparse_struct{x(i),y(i),c(i)} = int16([sparse_struct{x(i),y(i),c(i)} gc]) ; end LL = LL + gcLL ; fprintf(' %d',gc) end end function filter = make_filter_new(M0,M1,i,j,gaus_boxed, support) filter = zeros(M0,M1) ; [g,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) ; filter(t:b,l:r) = g ; % filter is inverted; doesn't matter for the dot product calculation though % filter = filter(end:-1:1,end:-1:1) ; % uncomment to uninvert end \ No newline at end of file
kolia/cones_MC
27c7bb5ada3a066095cc3414d0feec0cb457d01f
X.connections was unused
diff --git a/exact_LL_setup.m b/exact_LL_setup.m index 1d0dc95..b13faed 100644 --- a/exact_LL_setup.m +++ b/exact_LL_setup.m @@ -1,219 +1,216 @@ function cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) %% cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) % Expand data and parameters into variables used to calculate likelihoods. % Mainly, spatial supersampling by a factor of cone_map.supersample is % applied to the STAs, and the convolution of the STAs with the cone % receptive fields is used to calculate the sparsity structure of % connections between cones and GCs, as well as a map of LL increases. if nargin < 3 , cone_map = struct ; end % size of data [M0,M1,cone_map.N_colors] = size(GC_stas(1).spatial) ; %% unpack data from GC_stas % supersample factor SS = cone_params.supersample ; % radius used for convolutions with cone RFs R = ceil( cone_params.support_radius * SS ) ; cone_params.support_radius = ceil(cone_params.support_radius) ; % copy cone_params cone_map.cone_params = cone_params ; % set up Region of Interest if it doesn't already exist % these are fractional (x,y) coordinates, due to supersampling if ~isfield(cone_map,'ROI') x = repmat( 1/(2*SS):1/SS:M0-1/(2*SS) , 1 , M1*SS ) ; y = repmat( 1/(2*SS):1/SS:M1-1/(2*SS) , M0*SS , 1 ) ; ROI = [x' y(:)] ; clear x y else ROI = cone_map.ROI ; end % total number of possible cone positions cone_map.NROI = size(ROI,1) ; % unpack GC_stas into: supersampled STAs, norms of STAs and N_spikes N_GC = length(GC_stas) ; STA_norm = zeros(N_GC,1) ; cone_map.N_spikes = zeros(N_GC,1) ; STA = zeros(cone_map.N_colors,M0,M1,N_GC) ; for i=1:N_GC cone_map.N_spikes(i) = length(GC_stas(i).spikes) ; STA(:,:,:,i) = reshape(permute(GC_stas(i).spatial,[3 1 2]), cone_map.N_colors, M0, M1 ) ; STA_norm(i) = norm(reshape(STA(:,:,:,i),1,[])) ; end %% calculate some constants etc in advance, to speed up actual calculations % memoized function returning gaussian mass in a square pixel box cone_map.gaus_boxed = gaus_in_a_box_memo( cone_params.sigma, SS, cone_params.support_radius ) ; % constants used to calculate the log-likelihood cone_map.cell_consts = cone_map.N_spikes * cone_params.stimulus_variance ; cone_map.prior_covs = (cone_params.stimulus_variance ./ STA_norm ).^2 ; cone_map.cov_factors = cone_map.cell_consts+cone_map.prior_covs ; cone_map.N_cones_terms = log( cone_map.prior_covs ) - log( cone_map.cov_factors) ; cone_map.quad_factors = cone_map.N_spikes.^2 ./ cone_map.cov_factors ; % for fast lookup of legal shift moves in move.m cone_map.outofbounds = sparse([],[],[],M0*SS,M1*SS,2*(M0+M1)*SS) ; cone_map.outofbounds(:,[1 M1*SS]) = 1 ; cone_map.outofbounds([1 M0*SS],:) = cone_map.outofbounds([1 M0*SS],:) + 1 ; % copy params cone_map.M0 = M0 ; cone_map.M1 = M1 ; cone_map.N_GC = N_GC ; cone_map.SS = SS ; cone_map.R = R ; cone_map.STA = single( STA ) ; cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; cone_map.colorDot = cone_params.colors * cone_params.colors' ; %% make lookup table for dot products of cone RFs in all possible positions cone_map.coneConv = zeros( 2*R+SS , 2*R+SS , SS , SS ) ; WW = zeros(SS,SS) ; f = 1/(2*SS):1/SS:2*R/SS+1 ; for xx=1:2*R+SS x = f(xx) ; for yy=1:2*R+SS y = f(yy) ; a = make_filter_new(4*R/SS+1,4*R/SS+1,x+R/SS,y+R/SS,cone_map.gaus_boxed,... cone_map.cone_params.support_radius) ; for ss=1:SS s = (ss-0.5)/SS ; for tt=1:SS t = (tt-0.5)/SS ; b = make_filter_new(4*R/SS+1,4*R/SS+1,2*R/SS+s,2*R/SS+t,... cone_map.gaus_boxed,cone_map.cone_params.support_radius) ; cone_map.coneConv(xx,yy,ss,tt) = dot(a(:),b(:)) ; end end if (xx<=SS) && (yy<=SS) WW(xx,yy) = dot(a(:),a(:)) ; end end end % calculate sparsity structure and map of LL increases [cone_map.sparse_struct,cone_map.LL] = ... make_sparse_struct(cone_map,STA,WW,cone_map.gaus_boxed) ; % cone_map.NICE is a pretty visualizable version of cone_map.LL IC = inv(cone_params.colors) ; QC = reshape( reshape(cone_map.LL,[],3) * IC', size(cone_map.LL) ) ; cone_map.NICE = plotable_evidence( QC ) ; % imagesc( cone_map.NICE ) % Some default values cone_map.N_iterations = 100000; cone_map.max_time = 200000; cone_map.N_fast = 1 ; cone_map.q = 0.5 ; cone_map.ID = 0 ; cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... cone_map.N_colors, cone_map.SS, ... cone_map.cone_params.replusion_radii, ... 1, 1) ; -if ~isfield(cone_map.initX,'connections') - cone_map.init.connections = zeros(N_GC,1) ; -end % sanity check: compare cone_map.make_STA_W with make_LL mLL = max(cone_map.LL(:)) ; mx = 63 ; my = 32 ; mc = 1 ; tX = flip_LL( cone_map.initX , [mx my mc] , cone_map , [1 1] ) ; fprintf('\nLL and flip_ll: %f,%f, at x%d,y%d,c%d\n',mLL,tX.ll,mx,my,mc) ; range_x = mx+(-4:5) ; range_y = my+(-4:5) ; test = zeros(numel(range_x),numel(range_y)) ; for iii=range_x for jjj=range_y tX = flip_LL( cone_map.initX , [iii jjj 1] , cone_map , [1 1] ) ; test(iii,jjj) = tX.ll ; end end fprintf('\n') disp(test(range_x,range_y)) disp(cone_map.LL(range_x,range_y,1)) disp( test(range_x,range_y) - cone_map.LL(range_x,range_y,1) ) fprintf('\n') end function [sparse_struct, LL] = make_sparse_struct(cone_map,STA,WW,gaus_boxed) M0 = cone_map.M0 ; M1 = cone_map.M1 ; SS = cone_map.SS ; support = cone_map.cone_params.support_radius ; colors = cone_map.cone_params.colors ; LL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; supersamples = 1/(2*SS):1/SS:1 ; gs = cell(SS) ; sparse_struct = cell( M0*SS, M1*SS, cone_map.N_colors ) ; for ii=1:SS for jj=1:SS i = supersamples(ii) ; j = supersamples(jj) ; g = reshape( gaus_boxed(i,j), [2*support+1 2*support+1]) ; gs{ii,jj} = g(end:-1:1,end:-1:1) ; end end fprintf('making sparse struct and LL for GC number') for gc=1:cone_map.N_GC gcLL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; for ii=1:SS for jj=1:SS CC = zeros(M0*M1,cone_map.N_colors) ; for color=1:cone_map.N_colors CCC = conv2( squeeze(STA(color,:,:,gc)), gs{ii,jj} ) ; CCC = CCC(support+1:M0+support,support+1:M1+support) ; CC(:,color) = CCC(:) ; end C = 0.5 * cone_map.quad_factors(gc) * (CC * colors').^2 / WW(ii,jj) ; C = max(0,C+0.5*cone_map.N_cones_terms(gc)) ; gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) = ... gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) + reshape(C,[M0 M1 3]) ; end end [x,yc] = find( gcLL>0 ) ; y = 1+mod(yc-1,M1*SS) ; c = ceil( yc/(M1*SS) ) ; for i=1:numel(x) sparse_struct{x(i),y(i),c(i)} = int16([sparse_struct{x(i),y(i),c(i)} gc]) ; end LL = LL + gcLL ; fprintf(' %d',gc) end end function filter = make_filter_new(M0,M1,i,j,gaus_boxed, support) filter = zeros(M0,M1) ; [g,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) ; filter(t:b,l:r) = g ; % filter is inverted; doesn't matter for the dot product calculation though % filter = filter(end:-1:1,end:-1:1) ; % uncomment to uninvert end \ No newline at end of file diff --git a/flip_LL.m b/flip_LL.m index aff16c5..a31e780 100644 --- a/flip_LL.m +++ b/flip_LL.m @@ -1,159 +1,155 @@ function X = flip_LL( X , flips , PROB , T ) % X = flip_LL( X , flips , PROB , T ) % % pardon my appearance, i've been optimized for speed, not prettiness % % Apply flips to configuration X, and update log-likelihood of X. % Bits in X.state are flipped, and the inverse X.invWW of WW is updated. % Some other book-keeping variables are stored in X, for speed. % The matrix inverse is not recalculated each time: % block matrix inverse update formulas are used to update X.invWW % incrementally, for speed. % % Only updates X.WW if X.invWW is not present in input X. M0 = PROB.M0 * PROB.SS ; -if ~isfield(X,'connections') - X.connections = zeros(PROB.N_GC,1) ; -end - for i=1:size(flips,1) x = flips(i,1) ; y = flips(i,2) ; c = flips(i,3) ; [posX,posY,colors] = find(X.state) ; if ~c && ~X.state(x,y) error('deleting nonexistent cone...') else % cone deletion k = x + M0*(y-1) ; end j = sum( posX + M0*(posY-1) <= k ) ; % block matrix inverse update if ~c % update inverse by deleting jth row/column inds = [1:j-1 j+1:X.N_cones] ; X.N_cones = X.N_cones - 1 ; STA_W_state_j = X.sparse_STA_W_state(:, j) ; keep_GCs = find(PROB.quad_factors .* STA_W_state_j.^2 / double(X.WW(j,j)) ... + PROB.N_cones_terms > 0) ; if isfield(X,'invWW') invWW = X.invWW(inds,inds) - ... X.invWW(inds,j)*X.invWW(j,inds)/X.invWW(j,j) ; X.invWW = invWW ; end if isfield(X,'WW') X.WW = X.WW(inds,inds) ; end X.sparse_STA_W_state = X.sparse_STA_W_state(:, inds ) ; keep_cones = sum(X.sparse_STA_W_state(keep_GCs,:),1)>0 ; X.contributions(keep_GCs) = ... sum((double(X.WW(keep_cones,keep_cones))\... X.sparse_STA_W_state(keep_GCs,keep_cones)')' ... .* X.sparse_STA_W_state(keep_GCs,keep_cones),2) ; X.state(x,y)= 0 ; X.diff = [X.diff ; x y 0] ; else % update inverse by adding row/column j = j + 1 ; X.N_cones = X.N_cones + 1 ; inds = [1:j-1 j+1:X.N_cones] ; Wkinds = [posX'-x ; posY'-y] ; ssx = 1+mod(x-1,PROB.SS) ; ssy = 1+mod(y-1,PROB.SS) ; Wkstate = zeros(1,X.N_cones-1) ; where = find( max(abs(Wkinds),[],1) <= PROB.R ) ; if ~isempty(where) xx = Wkinds(1,where)+PROB.R+ssx ; yy = Wkinds(2,where)+PROB.R+ssy ; for kk=1:length(where) Wkstate(where(kk)) = PROB.coneConv(xx(kk),yy(kk),ssx,ssy) ... .* PROB.colorDot(c,colors(where(kk))) ; end end Wkkc = PROB.coneConv(PROB.R+ssx,PROB.R+ssy,ssx,ssy) * PROB.colorDot(c,c) ; if isfield(X,'invWW') invWW = X.invWW ; r = Wkstate * invWW ; X.invWW = zeros(X.N_cones) ; if ~isempty(r) q = 1/( Wkkc - r*Wkstate' ) ; cc = invWW * Wkstate' * q ; X.invWW(inds,inds) = invWW+cc*r ; X.invWW(inds,j) = -cc ; X.invWW(j,inds) = -r*q ; else q = 1/Wkkc ; end X.invWW(j,j) = q ; else if ~issparse(X.WW) ; X.WW = sparse(double(X.WW)) ; end [wwx,wwy,wwv] = find(X.WW) ; wwx = [inds(wwx) j*ones(1,numel(Wkstate)+1) inds] ; wwy = [inds(wwy) inds j*ones(1,numel(Wkstate)+1)] ; wwv = [wwv' Wkstate Wkkc Wkstate] ; X.WW = sparse(wwx,wwy,wwv,X.N_cones,X.N_cones) ; end sparse_STA_W_state = X.sparse_STA_W_state ; X.sparse_STA_W_state = sparse([],[],[],PROB.N_GC,X.N_cones) ; if ~isempty(inds) X.sparse_STA_W_state(:,inds) = sparse_STA_W_state ; end xi = (x-0.5)/PROB.SS ; yi = (y-0.5)/PROB.SS ; [filter,tt,rr,bb,ll] = filter_bounds( xi, yi, PROB.M0,PROB.M1,PROB.gaus_boxed,... PROB.cone_params.support_radius) ; keep_GCs = PROB.sparse_struct{x,y,c} ; if ~isfield(X,'contributions') X.contributions = zeros(PROB.N_GC,1) ; end if ~isempty(keep_GCs) sta = PROB.STA(:,tt:bb,ll:rr,keep_GCs) ; sta = reshape( sta, [], numel(keep_GCs) ) ; STA_W_state_j = sta' * kron(filter(:),PROB.cone_params.colors(c,:)') ; X.sparse_STA_W_state( keep_GCs, j ) = STA_W_state_j ; keep_cones = sum(abs(X.sparse_STA_W_state(keep_GCs,:)),1)>0 ; if ~isempty(keep_GCs) X.contributions(keep_GCs) = ... sum((double(X.WW(keep_cones,keep_cones))\... X.sparse_STA_W_state(keep_GCs,keep_cones)')'... .* X.sparse_STA_W_state(keep_GCs,keep_cones),2) ; end X.keep_cones = keep_cones ; end X.keep_GCs = keep_GCs ; X.state(x,y) = c ; X.diff = [X.diff ; x y c] ; end end % recalculate data log-likelihood ll = calculate_LL( X , PROB , T ) ; X.T = T ; X.ll = ll ; end \ No newline at end of file
kolia/cones_MC
b17a78a451afab7bc2d631d61bd22b85f1f9d8f3
cleaned up greedy_cones and main
diff --git a/greedy_cones.m b/greedy_cones.m index f19b7ce..b331d9a 100644 --- a/greedy_cones.m +++ b/greedy_cones.m @@ -1,86 +1,80 @@ function cone_map = greedy_cones( cone_map , speed ) warning off if nargin<2 % default is regular greedy (anything but 0: 'hot' version) speed = 0 ; end -%% PARAMS from cone_map -M0 = cone_map.M0 ; -M1 = cone_map.M1 ; -cone_map.SS = cone_map.cone_params.supersample ; -SS = cone_map.SS ; -N_colors = cone_map.N_colors ; -maxcones = cone_map.initX.maxcones ; - % plot, display, and save every N iterations (0 = never) display_every = 1 ; default( cone_map , 'plot_every' , 0 ) default( cone_map , 'save_every' , 500 ) % no need to track_contacts, greedy does not shift cones, it just adds them if ~isfield(cone_map , 'track_contacts'), cone_map.track_contacts = false ; end -fprintf('\n\nSTARTING greedy search') - +if speed + fprintf('\n\nSTARTING ''hot'' greedy search') +else + fprintf('\n\nSTARTING greedy search') +end % initializing variables -N_cones = 0 ; X = cone_map.initX ; % if not tracking contacts, contact field is not needed if ~cone_map.track_contacts, try X = rmfield(X,'contact') ; end ; end if plot_every scrsz = get(0,'ScreenSize'); h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; end % GREEDY addition of cones, one at a time t = cputime ; tic -for jj=1:maxcones +for jj=1:cone_map.initX.maxcones % try adding a cone if speed [X,done] = greedy_hot(X,cone_map) ; else [X,done] = greedy(X,cone_map) ; end N_cones = numel(find(X.state>0)) ; % DISPLAY stdout if ~mod(jj,display_every) fprintf('\nCones:%4d, %4d %.0f\tin %8.2f sec',jj,N_cones,X.ll,toc) tic end % DISPLAY plot if plot_every && ~mod(jj,plot_every) figure(h) plot_cones( X.state , cone_map ) ; title(sprintf('Iteration %d',jj),'FontSize',16) drawnow end % SAVE to disk save_now = done | jj/(N_cones+1)>1.1 ; if ~mod(jj,save_every) || save_now % use less disk space: remove large data structures to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; try X = rmfield(X,'excluded') ; end X = remake_X(cone_map,X) ; try to_save.X = rmfield(X,{'invWW'}) ; end save('result', 'to_save' ) if save_now , break ; else clear to_save; end end end fprintf('\ndone in %.1f sec\n\n',cputime - t) ; cone_map.X = X ; cone_map.code = file2str('greedy_cones.m') ; cone_map.N_cones = N_cones ; % save('results','cone_map','X') end \ No newline at end of file diff --git a/main.m b/main.m index 2407632..d948b5d 100644 --- a/main.m +++ b/main.m @@ -1,82 +1,42 @@ -% add subfolders to path addpath(genpath(pwd)) - %% LOAD DATA -load george/stas -% load peach/peach_data +% load george/stas +load peach/peach_data % stas(i).spikes : the list of spike times of cell i % stas(i).spatial : the spatial component of the STA of cell i -load george/cone_params -% load peach/cone_params -% cone_params.stimulus_variance : variance of each stim pixel color chanel -% (usually 1) -% -% cone_params.supersample : the integer number of cone positions per -% pixel width/height -% (usually 4) -% -% cone_params.colors : 3x3 matrix of cone color sensitivities -% -% cone_params.support_radius : radius of cone receptive field filter -% (usually 3.0) -% -% cone_params.repulsion_radii +% load george/cone_params +load peach/cone_params % contains struct cone_params with fields: +% stimulus_variance : variance of each stim pixel color chanel (usually 1) +% supersample : the integer number of cone positions per pixel +% width/height (usually 4) +% colors : 3x3 matrix of cone color sensitivities +% support_radius : radius of cone receptive field filter (usually 3.0) +% repulsion_radii % restrict the stimulus to a region of interest (if memory is a problem) % stas = restrict_ROI( stas, [1 160], [1 160] ) ; - %% CONE_MAP contains parameters and preprocessed data structures % calculate sparsity pattern (for MCMC) and initial LL map (for greedy) cone_map = exact_LL_setup(stas,cone_params) ; % How many MCMC/CAST iterations? cone_map.N_iterations = 1e4 ; cone_map.max_time = 4e5 ; % in seconds -% Define the progression of inverse temperatures for CAST -cone_map.min_delta = 0.1 ; -cone_map.min_beta = 0.2 ; -cone_map.betas = make_deltas( cone_map.min_beta, 1, 1, 20 ) ; -cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, length(cone_map.betas) ) ; - -% plot, display, and save every N iterations (0 = never) -cone_map.plot_every = 0 ; -cone_map.display_every = 20 ; -cone_map.save_every = 0 ; - +% % override defaults: plot, display, and save every ? iterations (0 = never) +% cone_map.plot_every = 1000 ; +% cone_map.display_every = 20 ; +% cone_map.save_every = 0 ; -%% GREEDY +%% run GREEDY, MCMC or CAST % greed = greedy_cones(cone_map) ; save('greed','greed') ; - - - -%% MCMC and CAST initialization - -% track contacts during 'hot' greedy method -cone_map.track_contacts = true ; - -% run 'hot' greedy method -greed_hot = greedy_cones(cone_map, 'hot') ; - -% initialize MCMC and CAST with 'hot' greedy configuration -cone_map.initX = greed_hot.X ; - -% plots are nice for MCMC and CAST -cone_map.plot_every = 100 ; - - -%% MCMC or CAST - -% % run MCMC % mcmc = MCMC(cone_map) ; save('mcmc' ,'mcmc' ) ; - -% run CAST cast = CAST(cone_map) ; save('cast' ,'cast' ) ; \ No newline at end of file
kolia/cones_MC
88fdf820539556887d86c368f8123cff8b71fda2
cleaned exact_LL_setup up a bit
diff --git a/exact_LL_setup.m b/exact_LL_setup.m index 926d4d1..1d0dc95 100644 --- a/exact_LL_setup.m +++ b/exact_LL_setup.m @@ -1,224 +1,219 @@ function cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) %% cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) % Expand data and parameters into variables used to calculate likelihoods. % Mainly, spatial supersampling by a factor of cone_map.supersample is % applied to the STAs, and the convolution of the STAs with the cone % receptive fields is used to calculate the sparsity structure of % connections between cones and GCs, as well as a map of LL increases. if nargin < 3 , cone_map = struct ; end % size of data [M0,M1,cone_map.N_colors] = size(GC_stas(1).spatial) ; %% unpack data from GC_stas % supersample factor SS = cone_params.supersample ; % radius used for convolutions with cone RFs R = ceil( cone_params.support_radius * SS ) ; cone_params.support_radius = ceil(cone_params.support_radius) ; % copy cone_params cone_map.cone_params = cone_params ; % set up Region of Interest if it doesn't already exist % these are fractional (x,y) coordinates, due to supersampling if ~isfield(cone_map,'ROI') x = repmat( 1/(2*SS):1/SS:M0-1/(2*SS) , 1 , M1*SS ) ; y = repmat( 1/(2*SS):1/SS:M1-1/(2*SS) , M0*SS , 1 ) ; ROI = [x' y(:)] ; clear x y else ROI = cone_map.ROI ; end % total number of possible cone positions cone_map.NROI = size(ROI,1) ; % unpack GC_stas into: supersampled STAs, norms of STAs and N_spikes N_GC = length(GC_stas) ; STA_norm = zeros(N_GC,1) ; cone_map.N_spikes = zeros(N_GC,1) ; STA = zeros(cone_map.N_colors,M0,M1,N_GC) ; for i=1:N_GC cone_map.N_spikes(i) = length(GC_stas(i).spikes) ; STA(:,:,:,i) = reshape(permute(GC_stas(i).spatial,[3 1 2]), cone_map.N_colors, M0, M1 ) ; STA_norm(i) = norm(reshape(STA(:,:,:,i),1,[])) ; end %% calculate some constants etc in advance, to speed up actual calculations % memoized function returning gaussian mass in a square pixel box cone_map.gaus_boxed = gaus_in_a_box_memo( cone_params.sigma, SS, cone_params.support_radius ) ; % constants used to calculate the log-likelihood cone_map.cell_consts = cone_map.N_spikes * cone_params.stimulus_variance ; cone_map.prior_covs = (cone_params.stimulus_variance ./ STA_norm ).^2 ; cone_map.cov_factors = cone_map.cell_consts+cone_map.prior_covs ; cone_map.N_cones_terms = log( cone_map.prior_covs ) - log( cone_map.cov_factors) ; cone_map.quad_factors = cone_map.N_spikes.^2 ./ cone_map.cov_factors ; % for fast lookup of legal shift moves in move.m cone_map.outofbounds = sparse([],[],[],M0*SS,M1*SS,2*(M0+M1)*SS) ; cone_map.outofbounds(:,[1 M1*SS]) = 1 ; cone_map.outofbounds([1 M0*SS],:) = cone_map.outofbounds([1 M0*SS],:) + 1 ; % copy params cone_map.M0 = M0 ; cone_map.M1 = M1 ; cone_map.N_GC = N_GC ; cone_map.SS = SS ; +cone_map.R = R ; +cone_map.STA = single( STA ) ; +cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; +cone_map.colorDot = cone_params.colors * cone_params.colors' ; %% make lookup table for dot products of cone RFs in all possible positions cone_map.coneConv = zeros( 2*R+SS , 2*R+SS , SS , SS ) ; WW = zeros(SS,SS) ; f = 1/(2*SS):1/SS:2*R/SS+1 ; for xx=1:2*R+SS x = f(xx) ; for yy=1:2*R+SS y = f(yy) ; a = make_filter_new(4*R/SS+1,4*R/SS+1,x+R/SS,y+R/SS,cone_map.gaus_boxed,... cone_map.cone_params.support_radius) ; for ss=1:SS s = (ss-0.5)/SS ; for tt=1:SS t = (tt-0.5)/SS ; b = make_filter_new(4*R/SS+1,4*R/SS+1,2*R/SS+s,2*R/SS+t,... cone_map.gaus_boxed,cone_map.cone_params.support_radius) ; cone_map.coneConv(xx,yy,ss,tt) = dot(a(:),b(:)) ; end end if (xx<=SS) && (yy<=SS) WW(xx,yy) = dot(a(:),a(:)) ; end end end % calculate sparsity structure and map of LL increases [cone_map.sparse_struct,cone_map.LL] = ... - make_sparse_struct(cone_map,STA,WW,gaus_in_box_memo) ; + make_sparse_struct(cone_map,STA,WW,cone_map.gaus_boxed) ; -% +% cone_map.NICE is a pretty visualizable version of cone_map.LL IC = inv(cone_params.colors) ; QC = reshape( reshape(cone_map.LL,[],3) * IC', size(cone_map.LL) ) ; cone_map.NICE = plotable_evidence( QC ) ; - % imagesc( cone_map.NICE ) -cone_map.R = R ; -cone_map.STA = single( STA ) ; -cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; -cone_map.colorDot = cone_params.colors * cone_params.colors' ; - % Some default values cone_map.N_iterations = 100000; -cone_map.q = 0.5 ; -cone_map.plot_every = 0 ; -cone_map.plot_skip = 100 ; -cone_map.display_every = 500 ; -cone_map.ID = 0 ; cone_map.max_time = 200000; cone_map.N_fast = 1 ; +cone_map.q = 0.5 ; +cone_map.ID = 0 ; cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... cone_map.N_colors, cone_map.SS, ... cone_map.cone_params.replusion_radii, ... 1, 1) ; if ~isfield(cone_map.initX,'connections') cone_map.init.connections = zeros(N_GC,1) ; end % sanity check: compare cone_map.make_STA_W with make_LL mLL = max(cone_map.LL(:)) ; mx = 63 ; my = 32 ; mc = 1 ; tX = flip_LL( cone_map.initX , [mx my mc] , cone_map , [1 1] ) ; fprintf('\nLL and flip_ll: %f,%f, at x%d,y%d,c%d\n',mLL,tX.ll,mx,my,mc) ; range_x = mx+(-4:5) ; range_y = my+(-4:5) ; test = zeros(numel(range_x),numel(range_y)) ; for iii=range_x for jjj=range_y tX = flip_LL( cone_map.initX , [iii jjj 1] , cone_map , [1 1] ) ; test(iii,jjj) = tX.ll ; end end fprintf('\n') disp(test(range_x,range_y)) disp(cone_map.LL(range_x,range_y,1)) disp( test(range_x,range_y) - cone_map.LL(range_x,range_y,1) ) fprintf('\n') end function [sparse_struct, LL] = make_sparse_struct(cone_map,STA,WW,gaus_boxed) M0 = cone_map.M0 ; M1 = cone_map.M1 ; SS = cone_map.SS ; support = cone_map.cone_params.support_radius ; colors = cone_map.cone_params.colors ; LL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; supersamples = 1/(2*SS):1/SS:1 ; gs = cell(SS) ; sparse_struct = cell( M0*SS, M1*SS, cone_map.N_colors ) ; for ii=1:SS for jj=1:SS i = supersamples(ii) ; j = supersamples(jj) ; g = reshape( gaus_boxed(i,j), [2*support+1 2*support+1]) ; gs{ii,jj} = g(end:-1:1,end:-1:1) ; end end fprintf('making sparse struct and LL for GC number') for gc=1:cone_map.N_GC gcLL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; for ii=1:SS for jj=1:SS CC = zeros(M0*M1,cone_map.N_colors) ; for color=1:cone_map.N_colors CCC = conv2( squeeze(STA(color,:,:,gc)), gs{ii,jj} ) ; CCC = CCC(support+1:M0+support,support+1:M1+support) ; CC(:,color) = CCC(:) ; end C = 0.5 * cone_map.quad_factors(gc) * (CC * colors').^2 / WW(ii,jj) ; C = max(0,C+0.5*cone_map.N_cones_terms(gc)) ; gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) = ... gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) + reshape(C,[M0 M1 3]) ; end end [x,yc] = find( gcLL>0 ) ; y = 1+mod(yc-1,M1*SS) ; c = ceil( yc/(M1*SS) ) ; for i=1:numel(x) sparse_struct{x(i),y(i),c(i)} = int16([sparse_struct{x(i),y(i),c(i)} gc]) ; end LL = LL + gcLL ; fprintf(' %d',gc) end end function filter = make_filter_new(M0,M1,i,j,gaus_boxed, support) filter = zeros(M0,M1) ; [g,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) ; filter(t:b,l:r) = g ; % filter is inverted; doesn't matter for the dot product calculation though % filter = filter(end:-1:1,end:-1:1) ; % uncomment to uninvert end \ No newline at end of file
kolia/cones_MC
61ea22a8f9ae50ff1062c86b2560cf5d3fead7a8
deleted dead comments
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1bc82e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +*.mat +*.jpg +*.pdf +*.png +*.eps +*.jar +*.log +batik +figs +*.m~ +.unison.* +cluster__* +plots_for_* +LL_ncones.svg +evidence.png +Best_Greed_MCMC_CAST.svg +timeline__*.svg +*.DS_Store diff --git a/CAST.m b/CAST.m new file mode 100644 index 0000000..eeec76f --- /dev/null +++ b/CAST.m @@ -0,0 +1,184 @@ +function to_save = CAST( cone_map , ID ) + +% IDs for each chain on the cluster; not useful for single local execution +if nargin>1 , cone_map.ID = ID ; end + +% has_evidence is true only where cones contribute to the likelihood +cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; + +% archive this file into saved result, for future reference +cone_map.code.string = file2str('CAST.m') ; + +% defaults +default( cone_map , 'N_iterations' , 1000000) +default( cone_map , 'max_time' , 200000 ) +default( cone_map , 'plot_every' , 1000 ) +default( cone_map , 'display_every' , 50 ) +default( cone_map , 'save_every' , 0 ) +default( cone_map , 'profile_every' , 0 ) +default( cone_map , 'ID' , 0 ) +default( cone_map , 'N_fast' , 1 ) + +% default progression of inverse temperatures +cone_map.min_delta = 0.1 ; +cone_map.min_beta = 0.2 ; +cone_map.betas = make_deltas( cone_map.min_beta , 1, 1, 20 ) ; +cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, 20 ) ; + +% Initialize figure +if plot_every +scrsz = get(0,'ScreenSize'); +h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; +end + +%% initializations + +% initialize with 'hot' greedy configuration +cone_map.track_contacts = true ; +greed_hot = greedy_cones(cone_map, 'hot') ; +cone_map.initX = greed_hot.X ; + +% reduce memory footprint: LL is only used by greedy +cone_map = rmfield(cone_map,'LL') + +% initialize slow chain X{1} and fast chain X{2} +X = cell(1+cone_map.N_fast,1) ; +for i=1:1+cone_map.N_fast , X{i} = cone_map.initX ; end + +initial_iterations = cone_map.initX.iteration ; + +% initialize current best configuration +bestX = X{1} ; + +% tell udate_swap to record iterations where a swap was accepted +X{1}.swap = logical( sparse([],[],[],N_iterations,1) ) ; + +% tell update_X to record accepted moves; used to chain replay and plots +X{1}.dX = sparse([],[],[],N_iterations,3*X{1}.maxcones) ; + +% tell update_X to record X{1}.ll at each iteration +X{1}.LL_history = zeros(cone_map.N_iterations,1) ; + +% ST.T = the fixed progression of temperatures, ST.i = current temps +N_temp = length(cone_map.betas) ; +ST.T = cell(N_temp,1) ; +ST.i = ones(cone_map.N_fast,1) ; +ST.n = 1 ; +for i=1:N_temp + ST.T{i} = [cone_map.betas(i) cone_map.deltas(i)] ; +end + +% ST.g is used by Wang-Landau scheme in SimTempMCMC.m +ST.g = exp(-3.1035+0.2268*(1:N_temp)) ; % from converged g of previous runs + +% X{2}.STi_history records the complete history of ST.i +for j=1:cone_map.N_fast + X{1+j}.STi_history = zeros(cone_map.N_iterations,1) ; +end + + +%% MAIN CAST LOOP +fprintf('\n\nSTARTING CAST with' ) +fprintf('\n\n+ different inverse temperatures beta:\n') +fprintf('%4.2f ',cone_map.betas ) +fprintf('\n\n+ different powers delta:\n') +fprintf('%4.2f ',cone_map.deltas) +fprintf('\n\nCAST progress:') +t = cputime ; +tic + +jj = 1 ; +while 1 + + % regular MCMC move at temperature [1 1] for slow chain X{1} + X{1} = flip_MCMC( X{1}, move( X{1}, cone_map , [1 1]), cone_map, {[1 1]} ) ; + + % regular MCMC move at temperature ST.T{ST.i(j)} for fast chain X{2} + for j=1:cone_map.N_fast + X{1+j} = flip_MCMC( X{1+j}, move( X{1+j}, cone_map , ST.T{ST.i(j)}), ... + cone_map, {ST.T{ST.i(j)}} ) ; + end + + for j=1:cone_map.N_fast + % swap move if X{1+j} is at T=1 + if ST.i(j)==1 && X{1}.N_cones>10 && X{1+j}.N_cones>10 + old_ll = X{1}.ll ; + [X{1},X{1+j}] = swap_step( X{1}, [1 1], X{1+j}, [1 1], cone_map ) ; + if old_ll ~= X{1}.ll , fprintf(' swap dll : %.2f',X{1}.ll-old_ll) ; end + end + + % update temperature step + ST = SimTempMCMC( X{1+j}, cone_map, @get_LL, ST , j ) ; + + % save current ST.STi to X{2}.STi_history + X{1+j}.STi_history(X{1+j}.iteration) = ST.i(j) ; + end + + if X{1}.ll>bestX.ll , bestX = X{1} ; end + + % DISPLAY stdout + if ~mod(jj,display_every) + fprintf('\nIteration:%4d of %d %4d cones %6.0f ST.i: ', ... + jj,N_iterations,numel(find(X{1}.state>0)),X{1}.ll) + fprintf('%2d ',ST.i) + fprintf('%6.2f sec',toc) + tic + end + + % DISPLAY plot + if ~mod(jj,plot_every) + if ishandle(h) + clf + iters = max(initial_iterations,X{1}.iteration-2000)+(1:2000) ; + iters = iters(X{1}.LL_history(iters)>0) ; + subplot(5,1,1:3) + plot_cones( X{1}.state , cone_map ) ; + title( sprintf('After %d CAST iterations',jj),'FontSize' , 21 ) + subplot(5,1,4) ; + plot(iters,X{1}.LL_history(iters)) + ylabel( sprintf('X(1) LL'),'FontSize' , 18 ) + subplot(5,1,5) ; + hold on + plotme = zeros(cone_map.N_fast,length(iters)) ; + for j=1:cone_map.N_fast + plotme(j,:) = X{1+j}.STi_history(iters) ; + end + plot( repmat(iters,cone_map.N_fast,1)' , plotme' ) + ylabel( sprintf('fast temp.'),'FontSize' , 18 ) + xlabel('Iterations','FontSize' , 18) + drawnow ; hold off + end + end + + % PROFILING info saved to disk every profile_every iterations + if profile_every + if jj==1 + profile clear + profile on + elseif ~mod(jj,profile_every) + p = profile('info'); + save(sprintf('profdat_%d',floor(jj/profile_every)),'p') + profile clear + end + end + + % SAVE to disk + if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + to_save.X = rmfield(X{1},{'contact'}) ; + try to_save.X = rmfield(X{1},{'invWW'}) ; end + to_save.bestX = rmfield(bestX,{'contact'}) ; + try to_save.bestX = rmfield(bestX,{'invWW','LL_history','cputime',... + 'N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; end + to_save.ST = ST ; + save(sprintf('cast_result_%d',ID), 'to_save' ) + if jj>N_iterations || cputime-t>max_time, break ; + else clear to_save + end + end + jj = jj + 1 ; +end +fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; + +end diff --git a/MCMC.m b/MCMC.m new file mode 100644 index 0000000..937e609 --- /dev/null +++ b/MCMC.m @@ -0,0 +1,119 @@ +function to_save = MCMC( cone_map , ID ) + +% defaults +default( cone_map , 'N_iterations' , 1000000) +default( cone_map , 'plot_every' , 0 ) +default( cone_map , 'display_every' , 50 ) +default( cone_map , 'save_every' , 0 ) +default( cone_map , 'ID' , 0 ) +default( cone_map , 'max_time' , 200000 ) + +% IDs for each chain on the cluster; not useful for single local execution +if nargin>1 , cone_map.ID = ID ; end + +% has_evidence is true only where cones contribute to the likelihood +cone_map.has_evidence = logical(squeeze(sum(abs(cone_map.LL),3))>0) ; + +% archive this file into saved result, for future reference +cone_map.code.string = file2str('MCMC.m') ; + +% reduce memory footprint: LL is only used by greedy +cone_map = rmfield(cone_map,'LL') + +% Initialize figure +if plot_every +scrsz = get(0,'ScreenSize'); +h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*1]) ; +end + +% MAIN MCMC LOOP +fprintf('\n\nMCMC progress:') +t = cputime ; +tic + +n_runs = 1 ; + +%% initialization with 'hot' greedy configuration +cone_map.track_contacts = true ; +greed_hot = greedy_cones(cone_map, 'hot') ; +cone_map.initX = greed_hot.X ; + +% initialize MCMC loop +X = cone_map.initX ; +runbest = X ; +runbest.i = 1 ; +jj = 1 ; +cone_map.bestX = {} ; +n_best = 1 ; + +%% main MCMC loop +while 1 + + % trials{i} is a proposed new configuration; each contains a new ll + trials = move(X, cone_map, [1 1]) ; + + % choose one of the candidates, update_X its data structures + X = flip_MCMC( X, trials, cone_map, {[1 1]} ) ; + + % keep track of best configuration encountered + if X.ll>runbest.ll + runbest = X ; + runbest.i = jj ; + end + + % reinitialize to cone_map.initX if MCMC becomes stuck + if jj - runbest.i > cone_map.M0*cone_map.M1/3 + % use less disk space and memory: remove large data structures + runbest = rmfield(runbest,{'masks','contact'}) ; + try runbest = rmfield(runbest,'invWW') ; end + try runbest = rmfield(runbest,{'LL_history','cputime','N_cones_history','dX','excluded','sparse_STA_W_state'}) ; end + + % record current best confguration before reinitializing + cone_map.bestX{n_best} = runbest ; + n_best = n_best + 1 ; + + % reinitialize + fprintf('reinitializing...\n') + runbest = cone_map.initX ; + runbest.LL_history = X.LL_history ; + runbest.N_cones_history = X.N_cones_history ; + runbest.cputime = X.cputime ; + runbest.iteration = X.iteration ; + runbest.i = jj ; + n_runs = n_runs + 1 ; + X = runbest ; + end + + % DISPLAY to stdout + if ~mod(jj,display_every) + fprintf('Iter%4d of %d %4d cones %6.0f L %6.0f best %8.2f sec\n',... + jj,N_iterations,numel(find(X.state>0)),X.ll,... + runbest.ll,toc) + tic + end + + % PLOT + if ~mod(jj,plot_every) + figure(h) + plot_cones( X.state , cone_map ) ; + title( sprintf('After %d MCMC iterations',jj),'FontSize' , 24 ) + % set(get(gca,'Title'),'Visible','on') + drawnow + end + + % SAVE to disk + if ~mod(jj,save_every) || jj>N_iterations || cputime-t>max_time + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + to_save.X = rmfield(X,{'contact'}) ; + try to_save.X = rmfield(X,{'invWW'}) ; end + save(sprintf('result_%d',ID), 'to_save' ) + if jj>N_iterations || cputime-t>max_time, break ; + else clear to_save + end + end + jj = jj + 1 ; +end +fprintf('\n\ndone in %.1f sec\n\n',cputime - t) ; + +end diff --git a/MCMC_step.m b/MCMC_step.m new file mode 100644 index 0000000..53fb1b0 --- /dev/null +++ b/MCMC_step.m @@ -0,0 +1,4 @@ +function X = MCMC_step(X,PROB,T) +LL = @(x)get_LL(x,PROB,T) ; +X = flip_MCMC( X, move( X, PROB , T), @update_X, LL ) ; +end diff --git a/README.md b/README.md new file mode 100644 index 0000000..d5af7f1 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +USEAGE +------ + + +Place `peach_data.mat` and `cone_params.mat` in the folder where the code lives. + +cd to that folder in matlab and run `main_CAST.m` +This just sets up 'cone_map' for the first time. + +Now run: +`cone_map = CAST(cone_map) ;` \ No newline at end of file diff --git a/SimTempMCMC.m b/SimTempMCMC.m new file mode 100644 index 0000000..ecbdb09 --- /dev/null +++ b/SimTempMCMC.m @@ -0,0 +1,41 @@ +function ST = SimTempMCMC( X, PROB, LL, ST , j ) +% Simulated Tempering + Wang-Landau update +% simTempMCMC : We update the state, and then update the temperature +% ST (Simulated Tempering) is a structure that contains fields: +% T : cell array of temperatures +% i : index of current temperature +% g : current weights +% n : number of current iteration + +if ~isfield(ST,'n' ) , ST.n = 1 ; end +if ~isfield(ST,'i' ) , ST.i = length(ST.T) ; end +if ~isfield(ST,'g' ) , ST.g = ones(length(ST.T),1) ; end + +%step 4 (sample T) +% proposed change in temperature index is +1 or -1 with prob 0.5 +di = 2* ( unifrnd(0,1)>0.5 ) - 1 ; +% make sure proposed_i is between 1 and length(ST.T) +proposed_i = min( max( 1 , ST.i(j) + di ) , length(ST.T) ) ; + +%calculate probability of accepting new T +paccept = min(1, LL(X, PROB, ST.T{proposed_i})* ST.g(ST.i(j) ) ... + /(LL(X, PROB, ST.T{ST.i(j) })* ST.g(proposed_i))); + +%accept new state with probability p +if unifrnd(0,1) < paccept + ST.i(j) = proposed_i ; +end + +%step 5 update adaptive weights MAY NEED TO MAKE A LIST INSTEAD OF A +%NUMBER (use log g) +%logG = log(g); +%logGnew = logG; +%logGnew(ind) = logG(ind) + log(1+gamma); +%gnew(ind) = exp(logGnew(ind)); +ST.g(ST.i(j)) = ST.g(ST.i(j))*(1 + 1/sqrt(1+ST.n)); +ST.n = ST.n + 1 ; + +% renormalize ST.g every 100 iterations, for sanity +if ~mod(ST.n,100) , ST.g = ST.g * length(ST.g) / sum(ST.g) ; end + +end \ No newline at end of file diff --git a/action_LL_shift.m b/action_LL_shift.m new file mode 100644 index 0000000..8b7d2bb --- /dev/null +++ b/action_LL_shift.m @@ -0,0 +1,23 @@ +function X = action_LL_shift(X,oxy,d,PROB,T) + +ox = 1 + mod(oxy-1,X.M0) ; +oy = 1 + floor((oxy-1)/X.M0) ; + +% new cone location +x = ox+X.masks{1,1}.shift{d}(1) ; +y = oy+X.masks{1,1}.shift{d}(2) ; +c = X.state(ox,oy) ; + +% fprintf('\n\nMOVING cone %d at %d,%d',id,ox,oy) + +% delete old cone +X = flip_LL( X , [ox oy 0] , PROB , T ) ; +% check_X(X) + +% if new cone location is within bounds, add new cone +if x>0 && x<=X.M0 && y>0 && y<=X.M1 + X = flip_LL( X , [x y c] , PROB , T ) ; +% check_X(X) +end + +end \ No newline at end of file diff --git a/bits_per_spike.m b/bits_per_spike.m new file mode 100644 index 0000000..4509d62 --- /dev/null +++ b/bits_per_spike.m @@ -0,0 +1,5 @@ +function ll = bits_per_spike( ll, total_spikes ) + +ll = ll / ( total_spikes * log(2) ) ; + +end \ No newline at end of file diff --git a/calculate_LL.m b/calculate_LL.m new file mode 100644 index 0000000..6ad3583 --- /dev/null +++ b/calculate_LL.m @@ -0,0 +1,10 @@ +function ll = calculate_LL( X , PROB , T ) + +if X.N_cones>0 + ll = 0.5 * T(1) * (sum( PROB.N_cones_terms .* sum(abs(X.sparse_STA_W_state)>0,2)) + ... + sum( PROB.quad_factors .* X.contributions.^T(2) ) ) ; +else + ll = 0 ; +end + +end \ No newline at end of file diff --git a/check_X.m b/check_X.m new file mode 100644 index 0000000..94dbb69 --- /dev/null +++ b/check_X.m @@ -0,0 +1,98 @@ +function check_X( Y ) + +% global cone_map + +X = Y ; +[x,y,c] = find( X.state ) ; + +if numel(find(X.state>0)) ~= size(X.WW,1) + disp('X.state and X.WW have inconsistent sizes.') +end + +if size(X.sparse_STA_W_state) ~= size(X.WW,1) + disp('X.STA_W_state and X.WW have inconsistent sizes.') +end + + +% % check X.contact +% for d=1:2 +% X.contact{d} = X.contact{d} * 0 ; +% +% for i=1:length(x) +% X = make_contacts( X , [x(i) y(i) c(i)]) ; +% end +% +% dX = Y.contact{d} - X.contact{d} ; +% if dX +% % X.diff.added +% % X.diff.deleted +% X.contact{d} +% Y.contact{d} +% dX +% d +% end +% end + +% check that X.contact only concerns existing cones +for d=1:2 + try + cones = logical( max( max( X.contact{d} ,[],1) , max( X.contact{d} ,[],2)') ) ; + catch + 'asdfafsddfa' + end +% if ~min(X.state(cones)) +% X.state +% cones +% end +% if ~cones(X.state(:)>0) +% cones +% X.state +% end +end + +% % check that ll is consistent % NEEDS cone_map TO BE GLOBAL +% if isfield(X,'contact') , X = rmfield(X,'contact') ; end +% X.N_cones = 0 ; +% X.invWW = [] ; +% X.state = 0 * X.state ; +% for k=1:length(x) +% X = flip_LL( X , [x(k) y(k) c(k)] , cone_map ) ; +% end +% +% if abs(X.ll - Y.ll)>1e-8 +% X.ll - Y.ll +% X.diff +% [x y c] +% 'll is off' +% end + +for i=1:length(x) +% X = make_contacts( X , x(i) , y(i) , X.id(x(i),y(i)) , LL ) ; +% check exclusion + [dummy,indices] = place_mask( X.M0 , X.M1 , x(i) , y(i) , X.masks{1,1}.exclusion ) ; + + overlap = find( X.state(indices)>0 , 1) ; + if ~isempty( overlap ) && indices(overlap) ~= x(i) + X.M0*(y(i)-1) + [x(i) y(i) c(i)] + end +end + +% % check that localLL is consistent with LL(inds) +% [Xx,Xy,Xc] = find(Y.state) ; +% [x,y,v] = find(Y.id ) ; +% inds = Xx + Y.M0*(Xy-1) + Y.M0*Y.M1*(Xc-1) ; +% if ~isempty(find( Y.localLL(v) - LL(inds) , 1)) +% 'ha!' +% end + +% check if N_cones if consistent with id, state and taken_ids +% counts = [Y.N_cones numel(find(Y.id)) numel(find(Y.state)) ... +% numel(find(Y.taken_ids)) size(Y.invWW,1)] ; +counts = [numel(find(Y.state)) size(Y.WW,1)] ; +if ~isempty(find(diff(counts))) + counts + 'N_cones is off' +end + + +end \ No newline at end of file diff --git a/cone_map_string.m b/cone_map_string.m new file mode 100644 index 0000000..75310aa --- /dev/null +++ b/cone_map_string.m @@ -0,0 +1,15 @@ +function base_str = cone_map_string(cone_map) + +% log_iters = round( log(cone_map.N_iterations)/log(10) ) ; + +base_str = sprintf('%s_NROI%d_ROI%d%d_support%d_SS%d_beta%.1f_delta%.1f_%.0eiters',... + cone_map.type,cone_map.NROIs,... + cone_map.rois(1),cone_map.rois(2),... + cone_map.cone_params.support_radius,... + cone_map.cone_params.supersample,... + cone_map.min_beta,cone_map.min_delta,... + cone_map.N_iterations) ; + +base_str(base_str=='+') = '' ; +base_str(base_str=='.') = '' ; +end \ No newline at end of file diff --git a/cones.m b/cones.m new file mode 100644 index 0000000..d0d6a57 --- /dev/null +++ b/cones.m @@ -0,0 +1,33 @@ +function [cone_map,results] = cones( cone_map , ID ) +%% cone_map = cones( cone_map , ID ) +% Run MCMC to find cone locations. + +cone_map = rmfield(cone_map,'ROI') ; + +if nargin<2 , ID = 0 ; end +M0 = cone_map.M0 ; +M1 = cone_map.M1 ; + +%% PARAMETERS FOR MCMC + cone_map.N_iterations = 10000 ; %6 * M0 * M1 ; % number of trials + cone_map.start_swap = 10 ; %1/2 * M0 * M1 ; % iteration w/ swapping starts + +% betas temperatures of independent instances run simultaneously + cone_map.betas = make_deltas(0.1,1,1,20) ; + +% deltas temperatures of independent instances run simultaneously + cone_map.deltas = make_deltas(0.75,1,2,length(cone_map.betas)) ; + +% q probability of trying to move an existing cone vs. placing +% a new one. +% cone_map.q = 0.99 ; + +% moves sequence of moves at each iteration, currently: +% - a regular MC move for each instance +% cone_map.moves = [num2cell(1:N_instances) ... +% num2cell(1:N_instances) ... +% num2cell([1:N_instances-1 ; 2:N_instances],1)] ; + +[cone_map,results] = MCMC_parallel_tempering( cone_map , ID ) ; + +end \ No newline at end of file diff --git a/confident_cones.m b/confident_cones.m new file mode 100644 index 0000000..afa159f --- /dev/null +++ b/confident_cones.m @@ -0,0 +1,48 @@ +function cc = confident_cones( X , dX , PROB , selector ) +% [sta,samples] = denoised_sta( X , dX , PROB , truecolor ) +% Integrate over MCMC sample path starting at X with moves dX, to produce +% denoised STAs for all ganglion cells. PROB contains parameters, as +% output by exact_LL_setup.m +% If the optional truecolor is true, then true RGB STAs are output, +% otherwise + + +if nargin<4 + selector = @(n) (n>10000) && (mod(n,20) == 0) ; +end + +N = PROB.M0 * PROB.SS ; +M = PROB.M1 * PROB.SS ; +r = cell(3,1) ; +r{1} = zeros(N,M,3) ; +r{2} = 0 ; +r{3} = 0 ; + +r = fold_X(X,dX,PROB,[1 1],r,@(r,x)accumulate_stas(r,x,selector)) ; + +fprintf(' done\n') + +cc = r{1}/r{2} ; + +end + + +function r = accumulate_stas( r , X , selector ) + +% only accumulate when selector is true +if selector(r{3}) + for c=1:3 + r{1}(:,:,c) = r{1}(:,:,c) + (X.state==c) ; + end + + % update number of samples accumulated so far + r{2} = r{2} + 1 ; +end +% update number of samples replayed so far +r{3} = r{3} + 1 ; + +if ~mod(r{3},1000) + fprintf('.') +end + +end \ No newline at end of file diff --git a/dance.js b/dance.js new file mode 100644 index 0000000..6995f31 --- /dev/null +++ b/dance.js @@ -0,0 +1,53 @@ +var svgDocument; +var xmlns="http://www.w3.org/2000/svg" +var xlinkns = "http://www.w3.org/1999/xlink" +function startup(evt) { + O=evt.target + svgDocument=O.ownerDocument + O.setAttribute("onmousedown","run=!run;dt()") + cones = svgDocument.getElementById("cones") + itext = svgDocument.getElementById("itext") +} + +colors = ['red' , 'green' , '#66FF66'] ; + + + +run = true ; +t = 0 ; + +function dt(){ + if (!run) return ; + itext.lastChild.nodeValue = 'Iteration '+t; + iter() ; + t = t+1 ; + if (t>=data.length) { + t = 0 ; + while(cones.hasChildNodes()) cones.removeChild(cones.firstChild); + } + window.setTimeout("dt()",10) +} +function iter(){ + for (i=0; i<data[t].length; i++){ + dcone = data[t][i] ; + cone = svgDocument.getElementById(dcone[0]+'_'+dcone[1]+'_'+dcone[3]) ; + if (!dcone[2] && cone) { + cone.parentNode.removeChild(cone) ; + } + if ( dcone[2]) { + if (!cone) { + cone = svgDocument.createElementNS(xmlns,'use') ; + cone.setAttributeNS(xlinkns,'xlink:href','#m'+dcone[3]) ; + cone.setAttributeNS(null,'transform','translate('+dcone[0]+' '+dcone[1]+')') ; + cone.setAttributeNS(null,'id',dcone[0]+'_'+dcone[1]+'_'+dcone[3]) ; + } + cone.setAttribute('stroke',colors[dcone[2]-1]) ; + cone.setAttribute('fill','none') ; + cones.appendChild(cone) ; + } + } +} +function toggle(id){ + instance = svgDocument.getElementById(id) ; + instance.setAttributeNS(null,'visibility','hidden') ; +} diff --git a/dancing_cones_source.svg b/dancing_cones_source.svg new file mode 100644 index 0000000..99f03f8 --- /dev/null +++ b/dancing_cones_source.svg @@ -0,0 +1,39 @@ +<svg width="100%" height="100%" + xmlns="http://www.w3.org/2000/svg" version="1.1" + xmlns:xlink="http://www.w3.org/1999/xlink" + onload="startup(evt)" +> +<script> +<![CDATA[ + +//]]> +</script> + +<defs> + <circle id="m0" cx="0" cy="0" r="0.7" stroke-width="0.6" fill="white"/> + <circle id="m1" cx="0" cy="0" r="4.7" stroke-width="0.1"/> + <circle id="m2" cx="0" cy="0" r="4.0" stroke-width="0.3" stroke-dasharray="0.5 1.5"/> + <circle id="m3" cx="0" cy="0" r="3.0" stroke-width="0.8" stroke-dasharray="0 1 0.5 1.65"/> + <circle id="m4" cx="0" cy="0" r="2.0" stroke-width="0.9" stroke-dasharray="0 1.5 1 2"/> +</defs> + +<g transform="scale(5,5)translate(10,24)"> + <g transform="translate(5,-15)"> + <text font-size="7"> + <tspan>Greedy</tspan> + <tspan dx="20">Parallel tempering MCMC (3 runs)</tspan> + </text> + <use xlink:href="#m0" transform="translate(14 8)" stroke="red" fill="white" onclick="toggle('m0')"/> + <use xlink:href="#m1" transform="translate(85 8)" stroke="red" fill="white" onclick="toggle('m1')"/> + <use xlink:href="#m2" transform="translate(100 8)" stroke="red" fill="white" onclick="toggle('m2')"/> + <use xlink:href="#m3" transform="translate(115 8)" stroke="red" fill="white" onclick="toggle('m3')"/> + </g> + + <image width="184" height="104" xlink:href="evidence.png" filter="#Matrix"/> + <g id="cones"></g> + <text x="4" y="115" font-size="6">Click to play/pause</text> + <text id="itext" x="180" y="115" text-anchor="end" font-size="8">Iteration 0</text> + <text x="4" y="125" font-size="6">(Allow 1600 iterations to burn in)</text> +</g> + +</svg> diff --git a/default.m b/default.m new file mode 100644 index 0000000..cad002f --- /dev/null +++ b/default.m @@ -0,0 +1,12 @@ +function default( s , name , default_value ) +% Set value of argout to s.(name), unless s doesn't have a field called +% 'name', in which case set it to default_value. Uses the +% matlab 'assignin' function to assign the output value to argout. + +if isfield( s , name ) + assignin( 'caller' , name , s.(name) ) ; +else + assignin( 'caller' , name , default_value ) ; +end + +end \ No newline at end of file diff --git a/denoised_sta.m b/denoised_sta.m new file mode 100644 index 0000000..1ea4efa --- /dev/null +++ b/denoised_sta.m @@ -0,0 +1,133 @@ +function [sta,invww] = denoised_sta( X , dX , PROB , selector, signif , truecolor ) +% [sta,samples] = denoised_sta( X , dX , PROB , truecolor ) +% Integrate over MCMC sample path starting at X with moves dX, to produce +% denoised STAs for all ganglion cells. PROB contains parameters, as +% output by exact_LL_setup.m +% If the optional truecolor is true, then true RGB STAs are output, +% otherwise + + +if nargin<6 + truecolor = false ; +end + +if nargin<5 + signif = 0 ; +end + +if nargin<4 + selector = @(n) (n>10000) && (mod(n,20) == 0) ; +end + +N = PROB.M0 * PROB.SS ; +M = PROB.M1 * PROB.SS ; +r = cell(5,1) ; +for c=1:3 + r{c} = cell(PROB.N_GC,2) ; + for i=1:PROB.N_GC + r{c}{1,i} = zeros(N,M) ; + r{c}{2,i} = zeros(N,M) ; + end +end +r{4} = 0 ; +r{5} = 0 ; +r{6} = 0 ; + +% gauscdf = gaus_in_a_box( cone_params.sigma ) ; + +if ~isfield(X,'invWW') && X.N_cones==0 + X.invWW = [] ; + if isfield(X,'WW') + X = rmfield(X,'WW') ; + end +end + +R = ceil( PROB.cone_params.support_radius * PROB.SS ) ; +x = -R:1/PROB.SS:R ; +nn = length(x) ; +n = floor(length(x)/2) ; +x = repmat(x,[length(x) 1]) ; +xx = x' ; +gausfilter = mvnpdf([xx(:) x(:)],[], PROB.cone_params.sigma.*[1 1] ) ; +gausfilter = reshape( gausfilter , [nn nn] ) ; +% gausfilter = gausfilter/sum(gausfilter(:)) ; + +r = fold_X(X,dX,PROB,[1 1],r,@(r,x)accumulate_stas(r,x,PROB,gausfilter,n,selector,signif)) ; + +sta = cell(2,PROB.N_GC) ; +for i=1:PROB.N_GC + sta{1,i} = zeros(N,M,3) ; + sta{2,i} = zeros(N,M,3) ; + for c=1:3 + contrib_c = r{c}{1,i}/r{4} ; + contrib_sq = r{c}{2,i}/r{4} ; + if truecolor + for cc=1:3 + sta{1,i}(:,:,cc) = sta{1,i}(:,:,cc) + ... + contrib_c .* PROB.cone_params.colors(c,cc) ; + sta{2,i}(:,:,cc) = sta{2,i}(:,:,cc) + ... + contrib_sq .* PROB.cone_params.colors(c,cc) ; + end + else + sta{1,i}(:,:,c) = sta{1,i}(:,:,c) + contrib_c ; + sta{2,i}(:,:,c) = sta{2,i}(:,:,c) + contrib_sq ; + end + end +end + +invww = r{6}/(r{4}*PROB.cov_factor) ; + +end + + +function r = accumulate_stas( r , X , PROB , gausfilter, n, selector, signif ) + +% only accumulate when selector is true +if selector(r{5}) + + invWW = X.invWW ; + invWW(abs(invWW)<abs(invWW(1,1))*1e-17) = 0 ; + + invWW = sparse(invWW) ; + + [x,y,c] = find(X.state) ; + +% inds = x+PROB.M0*PROB.SS*(y-1)+PROB.M0*PROB.M1*PROB.SS*PROB.SS*(c-1) ; +% STA_W_state = PROB.STA_W( inds , : ) ; + + factor = repmat( PROB.cell_consts' ./ PROB.cov_factor' , [numel(x) 1] ) ; + A = (invWW * X.STA_W_state') .* factor ; + + STD = sqrt(diag(invWW) * (1./PROB.cov_factor')) ; + B = A ./ STD ; + + A( abs(B) < signif ) = 0 ; + + % for each GC, add sample contribution. + for i=1:PROB.N_GC + for cc=1:3 + I = c == cc ; + if sum(I)>0 + pixels = zeros(PROB.M0*PROB.SS,PROB.M1*PROB.SS) ; + pixels(x(I)+PROB.M0*PROB.SS*(y(I)-1)) = A(I,i) ; + pixels = conv2(gausfilter,pixels) ; + pixels = pixels(n+1:end-n,n+1:end-n); + r{cc}{1,i} = r{cc}{1,i} + pixels ; + r{cc}{2,i} = r{cc}{2,i} + pixels.^2 ; + % r{cc}{1,i}(x(I)+PROB.M0*PROB.SS*(y(I)-1)) = ... + % r{cc}{1,i}(x(I)+PROB.M0*PROB.SS*(y(I)-1)) + pixels ; + % r{cc}{2,i}(x(I)+PROB.M0*PROB.SS*(y(I)-1)) = ... + % r{cc}{2,i}(x(I)+PROB.M0*PROB.SS*(y(I)-1)) + a.^2 ; + end + end + end + + % accumulate mean of diag( invWW ) + r{6} = r{6} + mean(diag(invWW)) ; + + % update number of samples accumulated so far + r{4} = r{4} + 1 ; +end +% update number of samples replayed so far +r{5} = r{5} + 1 ; +end \ No newline at end of file diff --git a/equivalence_classes_direct.m b/equivalence_classes_direct.m new file mode 100644 index 0000000..77ffbc4 --- /dev/null +++ b/equivalence_classes_direct.m @@ -0,0 +1,56 @@ +function [classes,sizes] = equivalence_classes_direct(R,max_classes) +% for binary relation R, a boolean matrix +% calculate equivalence classes, i.e. groups of indices which are related +% through the transitive closure of R, as well as the sizes of these +% groups. + + +classes = cell(max_classes,1) ; +sizes = zeros(max_classes,1) ; + +N_x = size(R,1) ; + +inds_x = find(sum(R,2)>0) ; +inds_y = find(sum(R,1)>0)' ; + +R = R(:,inds_y) ; +R = R(inds_x,:) ; + +seen_x = zeros(numel(inds_x),1) ; +seen_y = zeros(numel(inds_y),1) ; + +if ~isempty(inds_y) + perm = randperm(numel(inds_y)) ; + + i=perm(1) ; + k=1 ; + while ~isempty(i) + new_inds = i ; + seen_y(i) = k ; + while ~isempty(new_inds) + s_x = sum(R(:,new_inds),2)>0 ; + seen_x(s_x) = k ; + s_y = sum(R(s_x,:),1)>0 ; + new_inds = find(s_y' .* (seen_y==0)) ; + seen_y(new_inds) = k ; + end + + s_x = seen_x==k ; + s_y = seen_y==k ; + + classes{k} = [inds_x(s_x) ; N_x+inds_y(s_y)] ; + sizes(k) = numel(classes{k}) ; + + if k >= max_classes + break + end + k = k+1 ; + i = perm( find(~seen_y(perm),1) ) ; + end + classes = classes(1:k) ; + sizes = sizes(1:k) ; +else + classes = {} ; + sizes = [] ; +end +end \ No newline at end of file diff --git a/exact_LL_setup.m b/exact_LL_setup.m new file mode 100644 index 0000000..926d4d1 --- /dev/null +++ b/exact_LL_setup.m @@ -0,0 +1,224 @@ +function cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) +%% cone_map = exact_LL_setup( GC_stas , cone_params , cone_map ) +% Expand data and parameters into variables used to calculate likelihoods. +% Mainly, spatial supersampling by a factor of cone_map.supersample is +% applied to the STAs, and the convolution of the STAs with the cone +% receptive fields is used to calculate the sparsity structure of +% connections between cones and GCs, as well as a map of LL increases. + +if nargin < 3 , cone_map = struct ; end + +% size of data +[M0,M1,cone_map.N_colors] = size(GC_stas(1).spatial) ; + + +%% unpack data from GC_stas + +% supersample factor +SS = cone_params.supersample ; + +% radius used for convolutions with cone RFs +R = ceil( cone_params.support_radius * SS ) ; +cone_params.support_radius = ceil(cone_params.support_radius) ; + +% copy cone_params +cone_map.cone_params = cone_params ; + +% set up Region of Interest if it doesn't already exist +% these are fractional (x,y) coordinates, due to supersampling +if ~isfield(cone_map,'ROI') + x = repmat( 1/(2*SS):1/SS:M0-1/(2*SS) , 1 , M1*SS ) ; + y = repmat( 1/(2*SS):1/SS:M1-1/(2*SS) , M0*SS , 1 ) ; + ROI = [x' y(:)] ; + clear x y +else + ROI = cone_map.ROI ; +end + +% total number of possible cone positions +cone_map.NROI = size(ROI,1) ; + +% unpack GC_stas into: supersampled STAs, norms of STAs and N_spikes +N_GC = length(GC_stas) ; +STA_norm = zeros(N_GC,1) ; +cone_map.N_spikes = zeros(N_GC,1) ; +STA = zeros(cone_map.N_colors,M0,M1,N_GC) ; +for i=1:N_GC + cone_map.N_spikes(i) = length(GC_stas(i).spikes) ; + STA(:,:,:,i) = reshape(permute(GC_stas(i).spatial,[3 1 2]), cone_map.N_colors, M0, M1 ) ; + STA_norm(i) = norm(reshape(STA(:,:,:,i),1,[])) ; +end + +%% calculate some constants etc in advance, to speed up actual calculations + +% memoized function returning gaussian mass in a square pixel box +cone_map.gaus_boxed = gaus_in_a_box_memo( cone_params.sigma, SS, cone_params.support_radius ) ; + +% constants used to calculate the log-likelihood +cone_map.cell_consts = cone_map.N_spikes * cone_params.stimulus_variance ; +cone_map.prior_covs = (cone_params.stimulus_variance ./ STA_norm ).^2 ; +cone_map.cov_factors = cone_map.cell_consts+cone_map.prior_covs ; +cone_map.N_cones_terms = log( cone_map.prior_covs ) - log( cone_map.cov_factors) ; +cone_map.quad_factors = cone_map.N_spikes.^2 ./ cone_map.cov_factors ; + +% for fast lookup of legal shift moves in move.m +cone_map.outofbounds = sparse([],[],[],M0*SS,M1*SS,2*(M0+M1)*SS) ; +cone_map.outofbounds(:,[1 M1*SS]) = 1 ; +cone_map.outofbounds([1 M0*SS],:) = cone_map.outofbounds([1 M0*SS],:) + 1 ; + +% copy params +cone_map.M0 = M0 ; +cone_map.M1 = M1 ; +cone_map.N_GC = N_GC ; +cone_map.SS = SS ; + +%% make lookup table for dot products of cone RFs in all possible positions +cone_map.coneConv = zeros( 2*R+SS , 2*R+SS , SS , SS ) ; +WW = zeros(SS,SS) ; + +f = 1/(2*SS):1/SS:2*R/SS+1 ; +for xx=1:2*R+SS + x = f(xx) ; + for yy=1:2*R+SS + y = f(yy) ; + + a = make_filter_new(4*R/SS+1,4*R/SS+1,x+R/SS,y+R/SS,cone_map.gaus_boxed,... + cone_map.cone_params.support_radius) ; + + for ss=1:SS + s = (ss-0.5)/SS ; + for tt=1:SS + t = (tt-0.5)/SS ; + + b = make_filter_new(4*R/SS+1,4*R/SS+1,2*R/SS+s,2*R/SS+t,... + cone_map.gaus_boxed,cone_map.cone_params.support_radius) ; + + cone_map.coneConv(xx,yy,ss,tt) = dot(a(:),b(:)) ; + end + end + if (xx<=SS) && (yy<=SS) + WW(xx,yy) = dot(a(:),a(:)) ; + end + end +end + +% calculate sparsity structure and map of LL increases +[cone_map.sparse_struct,cone_map.LL] = ... + make_sparse_struct(cone_map,STA,WW,gaus_in_box_memo) ; + +% +IC = inv(cone_params.colors) ; +QC = reshape( reshape(cone_map.LL,[],3) * IC', size(cone_map.LL) ) ; +cone_map.NICE = plotable_evidence( QC ) ; + +% imagesc( cone_map.NICE ) + + +cone_map.R = R ; +cone_map.STA = single( STA ) ; +cone_map.min_STA_W = -0.2 ; %min(STA_W(:)) ; +cone_map.colorDot = cone_params.colors * cone_params.colors' ; + +% Some default values +cone_map.N_iterations = 100000; +cone_map.q = 0.5 ; +cone_map.plot_every = 0 ; +cone_map.plot_skip = 100 ; +cone_map.display_every = 500 ; +cone_map.ID = 0 ; +cone_map.max_time = 200000; +cone_map.N_fast = 1 ; + +cone_map.initX = initialize_X( cone_map.M0, cone_map.M1, ... + cone_map.N_colors, cone_map.SS, ... + cone_map.cone_params.replusion_radii, ... + 1, 1) ; +if ~isfield(cone_map.initX,'connections') + cone_map.init.connections = zeros(N_GC,1) ; +end + + +% sanity check: compare cone_map.make_STA_W with make_LL +mLL = max(cone_map.LL(:)) ; +mx = 63 ; +my = 32 ; +mc = 1 ; +tX = flip_LL( cone_map.initX , [mx my mc] , cone_map , [1 1] ) ; +fprintf('\nLL and flip_ll: %f,%f, at x%d,y%d,c%d\n',mLL,tX.ll,mx,my,mc) ; +range_x = mx+(-4:5) ; +range_y = my+(-4:5) ; +test = zeros(numel(range_x),numel(range_y)) ; +for iii=range_x + for jjj=range_y + tX = flip_LL( cone_map.initX , [iii jjj 1] , cone_map , [1 1] ) ; + test(iii,jjj) = tX.ll ; + end +end + +fprintf('\n') +disp(test(range_x,range_y)) +disp(cone_map.LL(range_x,range_y,1)) +disp( test(range_x,range_y) - cone_map.LL(range_x,range_y,1) ) +fprintf('\n') + +end + +function [sparse_struct, LL] = make_sparse_struct(cone_map,STA,WW,gaus_boxed) + +M0 = cone_map.M0 ; +M1 = cone_map.M1 ; +SS = cone_map.SS ; +support = cone_map.cone_params.support_radius ; +colors = cone_map.cone_params.colors ; + +LL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; + +supersamples = 1/(2*SS):1/SS:1 ; +gs = cell(SS) ; +sparse_struct = cell( M0*SS, M1*SS, cone_map.N_colors ) ; + +for ii=1:SS + for jj=1:SS + i = supersamples(ii) ; + j = supersamples(jj) ; + g = reshape( gaus_boxed(i,j), [2*support+1 2*support+1]) ; + gs{ii,jj} = g(end:-1:1,end:-1:1) ; + end +end + +fprintf('making sparse struct and LL for GC number') +for gc=1:cone_map.N_GC + gcLL = zeros(M0*SS,M1*SS,cone_map.N_colors) ; + for ii=1:SS + for jj=1:SS + CC = zeros(M0*M1,cone_map.N_colors) ; + for color=1:cone_map.N_colors + CCC = conv2( squeeze(STA(color,:,:,gc)), gs{ii,jj} ) ; + CCC = CCC(support+1:M0+support,support+1:M1+support) ; + CC(:,color) = CCC(:) ; + end + C = 0.5 * cone_map.quad_factors(gc) * (CC * colors').^2 / WW(ii,jj) ; + C = max(0,C+0.5*cone_map.N_cones_terms(gc)) ; + gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) = ... + gcLL( ii:SS:M0*SS, jj:SS:M1*SS, :) + reshape(C,[M0 M1 3]) ; + end + end + [x,yc] = find( gcLL>0 ) ; + y = 1+mod(yc-1,M1*SS) ; + c = ceil( yc/(M1*SS) ) ; + for i=1:numel(x) + sparse_struct{x(i),y(i),c(i)} = int16([sparse_struct{x(i),y(i),c(i)} gc]) ; + end + LL = LL + gcLL ; + fprintf(' %d',gc) +end +end + + +function filter = make_filter_new(M0,M1,i,j,gaus_boxed, support) +filter = zeros(M0,M1) ; +[g,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) ; +filter(t:b,l:r) = g ; +% filter is inverted; doesn't matter for the dot product calculation though +% filter = filter(end:-1:1,end:-1:1) ; % uncomment to uninvert +end \ No newline at end of file diff --git a/file2str.m b/file2str.m new file mode 100644 index 0000000..a074d2e --- /dev/null +++ b/file2str.m @@ -0,0 +1,7 @@ +function s = file2str(filename) + +fid = fopen(filename,'r') ; +s = fread(fid,'*char')' ; +fclose(fid) ; + +end \ No newline at end of file diff --git a/filter_bounds.m b/filter_bounds.m new file mode 100644 index 0000000..bbdeaec --- /dev/null +++ b/filter_bounds.m @@ -0,0 +1,31 @@ +function [filter,t,r,b,l] = filter_bounds( i, j, M0, M1, gaus_boxed, support) + +filter = gaus_boxed( i, j ) ; + +b = min(M0,floor(i+support)+1) ; +r = min(M1,floor(j+support)+1) ; +t = max( 1,floor(i-support)+1) ; +l = max( 1,floor(j-support)+1) ; + +if t>floor(i-support)+1 + filter = filter(t-floor(i-support):end,:) ; +end + +if b<floor(i+support)+1 + filter = filter(1:end-(floor(i+support)+1-b),:) ; +end + +if l>floor(j-support)+1 + filter = filter(:,l-floor(j-support):end) ; +end + +if r<floor(j+support)+1 + filter = filter(:,1:end-(floor(j+support)+1-r)) ; +end + +% [n,m] = size(filter) ; +% if n ~= b-t+1 || m ~= r-l+1 +% 'asdfasdf' +% end + +end \ No newline at end of file diff --git a/filter_index.m b/filter_index.m new file mode 100644 index 0000000..c4570d5 --- /dev/null +++ b/filter_index.m @@ -0,0 +1,20 @@ +function [filter,index] = filter_index( i, j, M0, M1, gaus_boxed, support) + +filter = gaus_boxed( i, j ) ; + +ox = 1+(floor(i-support):floor(i+support)) ; +oy = 1+(floor(j-support):floor(j+support)) ; + +ix = (ox>=1) .* (ox<=M0) ; +iy = (oy>=1) .* (oy<=M1) ; +ix = repmat(ix(:),numel(iy),1) ; +iy = reshape( repmat(iy,numel(iy),1) , [] , 1 ) ; + +x = repmat(ox(:),numel(oy),1) ; +y = reshape( repmat(oy,numel(ox),1) , [] , 1 ) ; + +index = (x+(y-1)*M0)' ; +index = index((ix.*iy)>0) ; +filter = filter((ix.*iy)>0)' ; + +end \ No newline at end of file diff --git a/flip_LL.m b/flip_LL.m new file mode 100644 index 0000000..aff16c5 --- /dev/null +++ b/flip_LL.m @@ -0,0 +1,159 @@ +function X = flip_LL( X , flips , PROB , T ) +% X = flip_LL( X , flips , PROB , T ) +% +% pardon my appearance, i've been optimized for speed, not prettiness +% +% Apply flips to configuration X, and update log-likelihood of X. +% Bits in X.state are flipped, and the inverse X.invWW of WW is updated. +% Some other book-keeping variables are stored in X, for speed. +% The matrix inverse is not recalculated each time: +% block matrix inverse update formulas are used to update X.invWW +% incrementally, for speed. +% +% Only updates X.WW if X.invWW is not present in input X. + +M0 = PROB.M0 * PROB.SS ; + +if ~isfield(X,'connections') + X.connections = zeros(PROB.N_GC,1) ; +end + +for i=1:size(flips,1) + + x = flips(i,1) ; + y = flips(i,2) ; + c = flips(i,3) ; + + [posX,posY,colors] = find(X.state) ; + + if ~c && ~X.state(x,y) + error('deleting nonexistent cone...') + else % cone deletion + k = x + M0*(y-1) ; + end + j = sum( posX + M0*(posY-1) <= k ) ; + + % block matrix inverse update + if ~c % update inverse by deleting jth row/column + inds = [1:j-1 j+1:X.N_cones] ; + X.N_cones = X.N_cones - 1 ; + + STA_W_state_j = X.sparse_STA_W_state(:, j) ; + + keep_GCs = find(PROB.quad_factors .* STA_W_state_j.^2 / double(X.WW(j,j)) ... + + PROB.N_cones_terms > 0) ; + + if isfield(X,'invWW') + invWW = X.invWW(inds,inds) - ... + X.invWW(inds,j)*X.invWW(j,inds)/X.invWW(j,j) ; + X.invWW = invWW ; + end + + if isfield(X,'WW') + X.WW = X.WW(inds,inds) ; + end + + X.sparse_STA_W_state = X.sparse_STA_W_state(:, inds ) ; + + keep_cones = sum(X.sparse_STA_W_state(keep_GCs,:),1)>0 ; + X.contributions(keep_GCs) = ... + sum((double(X.WW(keep_cones,keep_cones))\... + X.sparse_STA_W_state(keep_GCs,keep_cones)')' ... + .* X.sparse_STA_W_state(keep_GCs,keep_cones),2) ; + + X.state(x,y)= 0 ; + + X.diff = [X.diff ; x y 0] ; + + else % update inverse by adding row/column + j = j + 1 ; + X.N_cones = X.N_cones + 1 ; + inds = [1:j-1 j+1:X.N_cones] ; + + Wkinds = [posX'-x ; posY'-y] ; + ssx = 1+mod(x-1,PROB.SS) ; + ssy = 1+mod(y-1,PROB.SS) ; + + Wkstate = zeros(1,X.N_cones-1) ; + where = find( max(abs(Wkinds),[],1) <= PROB.R ) ; + if ~isempty(where) + xx = Wkinds(1,where)+PROB.R+ssx ; + yy = Wkinds(2,where)+PROB.R+ssy ; + for kk=1:length(where) + Wkstate(where(kk)) = PROB.coneConv(xx(kk),yy(kk),ssx,ssy) ... + .* PROB.colorDot(c,colors(where(kk))) ; + end + end + + Wkkc = PROB.coneConv(PROB.R+ssx,PROB.R+ssy,ssx,ssy) * PROB.colorDot(c,c) ; + + if isfield(X,'invWW') + invWW = X.invWW ; + r = Wkstate * invWW ; + + X.invWW = zeros(X.N_cones) ; + if ~isempty(r) + q = 1/( Wkkc - r*Wkstate' ) ; + cc = invWW * Wkstate' * q ; + X.invWW(inds,inds) = invWW+cc*r ; + X.invWW(inds,j) = -cc ; + X.invWW(j,inds) = -r*q ; + else + q = 1/Wkkc ; + end + X.invWW(j,j) = q ; + else + if ~issparse(X.WW) ; + X.WW = sparse(double(X.WW)) ; + end + [wwx,wwy,wwv] = find(X.WW) ; + wwx = [inds(wwx) j*ones(1,numel(Wkstate)+1) inds] ; + wwy = [inds(wwy) inds j*ones(1,numel(Wkstate)+1)] ; + wwv = [wwv' Wkstate Wkkc Wkstate] ; + X.WW = sparse(wwx,wwy,wwv,X.N_cones,X.N_cones) ; + end + + sparse_STA_W_state = X.sparse_STA_W_state ; + X.sparse_STA_W_state = sparse([],[],[],PROB.N_GC,X.N_cones) ; + if ~isempty(inds) + X.sparse_STA_W_state(:,inds) = sparse_STA_W_state ; + end + xi = (x-0.5)/PROB.SS ; + yi = (y-0.5)/PROB.SS ; + + [filter,tt,rr,bb,ll] = filter_bounds( xi, yi, PROB.M0,PROB.M1,PROB.gaus_boxed,... + PROB.cone_params.support_radius) ; + keep_GCs = PROB.sparse_struct{x,y,c} ; + + if ~isfield(X,'contributions') + X.contributions = zeros(PROB.N_GC,1) ; + end + + if ~isempty(keep_GCs) + sta = PROB.STA(:,tt:bb,ll:rr,keep_GCs) ; + sta = reshape( sta, [], numel(keep_GCs) ) ; + STA_W_state_j = sta' * kron(filter(:),PROB.cone_params.colors(c,:)') ; + X.sparse_STA_W_state( keep_GCs, j ) = STA_W_state_j ; + keep_cones = sum(abs(X.sparse_STA_W_state(keep_GCs,:)),1)>0 ; + + if ~isempty(keep_GCs) + X.contributions(keep_GCs) = ... + sum((double(X.WW(keep_cones,keep_cones))\... + X.sparse_STA_W_state(keep_GCs,keep_cones)')'... + .* X.sparse_STA_W_state(keep_GCs,keep_cones),2) ; + end + X.keep_cones = keep_cones ; + end + X.keep_GCs = keep_GCs ; + + X.state(x,y) = c ; + X.diff = [X.diff ; x y c] ; + end +end + +% recalculate data log-likelihood +ll = calculate_LL( X , PROB , T ) ; +X.T = T ; +X.ll = ll ; + +end \ No newline at end of file diff --git a/flip_MCMC.m b/flip_MCMC.m new file mode 100644 index 0000000..516cf22 --- /dev/null +++ b/flip_MCMC.m @@ -0,0 +1,81 @@ +function X = flip_MCMC( X , trials , PROB, temps ) +% Propagate configuration 'X' and accumulated observable 'result' through +% one iteration of MCMC. Trials are generated by 'trial_sampler', which +% also calculates log-likelihoods, and the resulting observables +% accumulated by 'accumulate'. If 'trial_sampler' returns a single trial, +% then the metropolis-hastings rule is used. For more than one trial, the +% symmetric MC rule is used. + +% old_X = X ; + +if ~isempty(trials) + + % prepend current X to samples + trials = [{X} ; trials(:)] ; + n_trials = length(trials) ; + clear X + + % calculate the log-likelihoods of proposed trials + ll = zeros(1,n_trials) ; + for i=1:n_trials + if numel(temps)<2 + ll(i) = get_LL( trials{i}, PROB, temps{1}) ; + else + ll(i) = get_LL( trials{i}.X, PROB, temps{1}) + get_LL( trials{i}.with, PROB, temps{1}) ; + end + end + + % get likelihood vector of trials + L = exp( ll - max(ll) ) ; + L = L/sum(L) ; + + % choose next state + + % symmetric rule + trans_prior = zeros(n_trials,1) ; + for i=2:n_trials + trans_prior(i) = trials{i}.forward_prob ; + end + trans_prior(1) = sum(trans_prior)/(n_trials) ; + p = L./trans_prior' ; + p = cumsum(p) ; + p = p/p(end) ; + try + i = randiscrete( p ) ; + catch + L + L./trans_prior' + end + if numel(temps)<2 + X = update_X( trials , i ) ; + else + X = update_swap( trials , i ) ; + end +else + if numel(temps)<2 + X = update_X( {X} , 1, false ) ; + else + X = update_swap( {X} , 1 ) ; + end +end + +% if isfield(X,'state') +% check_X(old_X) +% check_X(trials{i}) +% check_X(X) +% else +% check_X(X.X) +% check_X(X.with) +% end + +% else % metropolis_hastings +% i = rand() < ( (L(2) * flip_me{1}.backward_prob) / ... +% (L(1) * flip_me{1}.forward_prob ) ) ; +% X = trials{i+1} ; +% % accumulate observable +% result = result + accumulate( y(i+1,:) ) ; +% end + +% fprintf('\nn_trials%3d (chose%4d) at %5f sec/trial',n_trials,i,toc/n_trials) + +end \ No newline at end of file diff --git a/fold_X.m b/fold_X.m new file mode 100644 index 0000000..12967ea --- /dev/null +++ b/fold_X.m @@ -0,0 +1,21 @@ +function r = fold_X( X , dX , PROB , T , r , f ) +% r = fold_states( state , dX , r , f ) +% +% Replay MCMC sequence by starting with initial state 'state' and updating +% it using dX. After each update, the function f is applied to r and +% state. fold_states folds f over the MCMC state sequence defined by +% (state,dX), starting with initial value r. Also returns final state. + +samples = size(dX,1) ; + +for i=1:samples + inds = find( dX(i,1:3:end) ~= 0 ) ; + x = full( dX(i,3*(inds-1)+1) ) ; + y = full( dX(i,3*(inds-1)+2) ) ; + c = full( dX(i,3*(inds-1)+3) ) ; + + X = flip_LL( X , [x(:) y(:) c(:)] , PROB , T ) ; + r = f(r,X) ; +end + +end \ No newline at end of file diff --git a/fullstas2stas.m b/fullstas2stas.m new file mode 100644 index 0000000..71d03d2 --- /dev/null +++ b/fullstas2stas.m @@ -0,0 +1,26 @@ +load george/full_stas +load george/time_courses +load george/datarun + +rf = zeros( 160, 160, 3 ) ; %0 * squeeze(full_stas{1}(:,:,:,1)) ; + +k = 0 ; +r = struct ; +for i=1:376 + if numel(full_stas{i})>0 + k = k+1 ; + r(k).spatial = rf ; + r(k).spikes = datarun.spikes{i} ; + r(k).cell_index = i ; + for c=1:3 + timecourse = time_courses{i}(:,c) ./ sqrt( sum(time_courses{i}(:,c).^2) ) ; + for j=1:7 + r(k).spatial(:,:,c) = r(k).spatial(:,:,c) + ... + squeeze(full_stas{i}(81:240,61:220,c,j))*timecourse(j) ; + end + end + end +end + +stas = r ; +save('george/stas','stas') \ No newline at end of file diff --git a/gaus_in_a_box.m b/gaus_in_a_box.m new file mode 100644 index 0000000..d5b93b8 --- /dev/null +++ b/gaus_in_a_box.m @@ -0,0 +1,65 @@ +function gf = gaus_in_a_box(sigma) + +% memo = sparse([],[],[],1000,1000, ceil( (SS*3*sigma)^2 ) ) ; +gf = @gib ; + + function out = gib(dx,dy) + +% out = zeros(size(in)); % preallocate output +% [tf,loc] = ismember(in,x); % find which in's already computed in x +% ft = ~tf; % ones to be computed +% out(ft) = F(in(ft)); % get output values for ones not already in +% % place new values in storage +% x = [x in(ft(:).')]; +% y = [y reshape(out(ft),1,[])]; +% out(tf) = y(loc(tf)); % fill in the rest of the output values + + dx = dx(:) ; + dy = dy(:) ; + l = ones(size(dx)) ; + O = zeros(size(dx)) ; + + out = mvncdf([dx dy] + [l l],[],sigma.*[1 1]) ... + - mvncdf([dx dy] + [O l],[],sigma.*[1 1]) ... + - mvncdf([dx dy] + [l O],[],sigma.*[1 1]) ... + + mvncdf([dx dy] ,[],sigma.*[1 1]) ; + out = out / sqrt(0.1083) ; + end +end + +% function gf = gaus_in_a_box(sigma,SS) +% +% % memo = sparse([],[],[],1000,1000, ceil( (SS*3*sigma)^2 ) ) ; +% memo = cell(30,30,100,100) ; +% gf = @gib ; +% +% function out = gib(dx,dy) +% +% % out = zeros(size(in)); % preallocate output +% % [tf,loc] = ismember(in,x); % find which in's already computed in x +% % ft = ~tf; % ones to be computed +% % out(ft) = F(in(ft)); % get output values for ones not already in +% % % place new values in storage +% % x = [x in(ft(:).')]; +% % y = [y reshape(out(ft),1,[])]; +% % out(tf) = y(loc(tf)); % fill in the rest of the output values +% +% m = memo{100+dx*SS*2,100+dy*SS*2} ; +% if isempty(m) +% dx = dx(:) ; +% dy = dy(:) ; +% l = ones(size(dx)) ; +% O = zeros(size(dx)) ; +% +% out = mvncdf([dx dy] + [l l],[],sigma.*[1 1]) ... +% - mvncdf([dx dy] + [O l],[],sigma.*[1 1]) ... +% - mvncdf([dx dy] + [l O],[],sigma.*[1 1]) ... +% + mvncdf([dx dy] ,[],sigma.*[1 1]) ; +% out = out / sqrt(0.1083) ; +% memo{100+dx*SS*2,100+dy*SS*2} = out ; +% else +% out = m ; +% end +% end +% +% end \ No newline at end of file diff --git a/gaus_in_a_box_memo.m b/gaus_in_a_box_memo.m new file mode 100644 index 0000000..eefee69 --- /dev/null +++ b/gaus_in_a_box_memo.m @@ -0,0 +1,33 @@ +function gf = gaus_in_a_box_memo(sigma,SS,supprt) + +memo = cell(ceil(supprt+2),ceil(supprt+2)) ; +gf = @gib ; + + function out = gib(i,j) + di = rem(i,1) ; + dj = rem(j,1) ; + + out = memo{0.5+di*SS,0.5+dj*SS} ; + if isempty(out) + + ox = 1+(floor(i-supprt):floor(i+supprt)) ; + oy = 1+(floor(j-supprt):floor(j+supprt)) ; + dx = repmat(ox(:),numel(oy),1) ; + dy = reshape( repmat(oy,numel(ox),1) , [] , 1 ) ; + + dx = i-dx(:) ; + dy = j-dy(:) ; + l = ones(size(dx)) ; + O = zeros(size(dx)) ; + + out = mvncdf([dx dy] + [l l],[],sigma.*[1 1]) ... + - mvncdf([dx dy] + [O l],[],sigma.*[1 1]) ... + - mvncdf([dx dy] + [l O],[],sigma.*[1 1]) ... + + mvncdf([dx dy] ,[],sigma.*[1 1]) ; + out = out / sqrt(0.1083) ; + out = reshape( out, floor(i+supprt)-floor(i-supprt)+1, ... + floor(j+supprt)-floor(j-supprt)+1 ) ; + memo{0.5+di*SS,0.5+dj*SS} = out ; + end + end +end \ No newline at end of file diff --git a/get_LL.m b/get_LL.m new file mode 100644 index 0000000..a03c4ee --- /dev/null +++ b/get_LL.m @@ -0,0 +1,8 @@ +function ll = get_LL( X , PROB , T ) +% Get the log-likelihood of X at temperature T. + +if isfield(X,'T') && T(1) == X.T(1) && T(2) == X.T(2) + ll = X.ll ; +else + ll = calculate_LL( X , PROB , T ) ; +end \ No newline at end of file diff --git a/get_best.m b/get_best.m new file mode 100644 index 0000000..03797aa --- /dev/null +++ b/get_best.m @@ -0,0 +1,46 @@ +function [x,y,states,keep] = get_best( Xs ) +% Xs: cell struct with either bestX or X field. +% Each bestX (or X) is either a struct, in which case +% x and y are taken from the 'N_cones' and 'll' fields resp. +% or bestX (or X) is a cell, in which x and y are taken from the same +% fields of the bestX (or X) with the largest 'll'. + +x = zeros(numel(Xs),1) ; +y = zeros(numel(Xs),1) ; +states = cell(numel(Xs),1) ; + +keep = false(numel(Xs),1) ; +for i=1:numel(Xs) + if isa(Xs{i},'struct') + if isfield(Xs{i},'bestX') + X = Xs{i}.bestX ; + else + X = Xs{i}.X ; + end + if isa(X, 'cell') + j = 0 ; + bestll = -1e10 ; + for k=1:numel( X ) + if X{k}.ll > bestll + j = k ; + end + end + x(i) = X{j}.N_cones ; + y(i) = X{j}.ll ; + states{i} = X{j}.state ; + else + x(i) = X.N_cones ; + y(i) = X.ll ; + states{i} = X.state ; + end + if x(i)>0 + keep(i) = true ; + end + end +end + +x = x(keep) ; +y = y(keep) ; +states = states(keep) ; + +end \ No newline at end of file diff --git a/greedy.m b/greedy.m new file mode 100644 index 0000000..f19bbf1 --- /dev/null +++ b/greedy.m @@ -0,0 +1,105 @@ +function [X,done] = greedy( X , PROB ) + +% if X.N_cones == 0 +% profile clear +% profile on +% elseif mod(X.N_cones,10) == 0 +% p = profile('info'); +% save(sprintf('profdat_%d',X.N_cones),'p') +% profile clear +% end + +M0 = PROB.M0 * PROB.SS ; +M1 = PROB.M1 * PROB.SS ; + +oldll = X.ll ; +if ~isfield(X,'changed_x') + X.greedy_ll = PROB.LL ; +else + X = update_changed(X,PROB) ; +% figure(3) +% ll = X.greedy_ll{1}(min(X.changed_x)+2:max(X.changed_x)-2,min(X.changed_y)+2:max(X.changed_y)-2) ; +% imagesc(ll/max(ll(:))) +% fprintf('changed greedy_ll min %f median %f max %f',min(ll(:)), median(ll(:)), max(ll(:))) +end + +% if mod(X.N_cones , 100) == 99 +% fprintf(' LL min %f max %f',min(X.greedy_ll(isfinite(X.greedy_ll))), max(X.greedy_ll(:))) +% figure(1) +% pe = plotable_evidence(X.greedy_ll) ; +% imagesc(pe) +% +% figure(2) +% plot_cones(X.state,PROB) ; +% 'word' +% end + +[mm,I] = max(X.greedy_ll(:)) ; +[mx,my,mc] = ind2sub(size(PROB.LL),I) ; + +if mm>0 + done = false ; + + sx = mod(mx-1,PROB.SS)+1 ; + sy = mod(my-1,PROB.SS)+1 ; + +% [SIZEX,SIZEY] = size(squeeze(PROB.coneConv(:,:,sx,sy))) ; +% [changed_x, changed_y] = find( ones(SIZEX+40,SIZEY+40) ) ; +% changed_x = changed_x-20 ; +% changed_y = changed_y-20 ; + [changed_x, changed_y] = find( squeeze(PROB.coneConv(:,:,sx,sy)) > 0 ) ; + + changed_x = changed_x + mx - sx - PROB.R ; + changed_y = changed_y + my - sy - PROB.R ; + + keep = logical( (changed_x>0) .* (changed_x<=M0) .* (changed_y>0) .* (changed_y<=M1) ) ; + + X.changed_x = changed_x(keep) ; + X.changed_y = changed_y(keep) ; + X.last_x = mx ; + X.last_y = my ; + X.last_c = mc ; + + newX = flip_LL( X , [mx my mc] , PROB , [1 1]) ; + if newX.ll>=X.ll + X = update_X({newX},1,PROB.track_contacts) ; + else + X = update_changed(X,PROB) ; + end + + try + fprintf(' #keep_cones %d, #keep_GCs %d mm-dll %f mm-PROB.ll %f',... + nnz(X.keep_cones),numel(X.keep_GCs),mm-newX.ll+oldll,mm-PROB.LL(mx,my,mc)) ; + end +else + done = true ; + X = rmfield(X,{'changed_x','changed_y','last_x','last_y'}) ; +end + +end + +function X = update_changed(X,PROB) + +M0 = PROB.M0 * PROB.SS ; +M1 = PROB.M1 * PROB.SS ; +used = 0 ; +inds = zeros(PROB.N_colors*numel(X.changed_x),1) ; +gree = zeros(PROB.N_colors*numel(X.changed_x),1) ; +for i=1:numel(X.changed_x) + x = X.changed_x(i) ; + y = X.changed_y(i) ; + ne = not_excluded( X, x, y ) ; + for c=1:3 + used = used + 1 ; + inds(used) = x + (y-1)*M0 + (c-1)*M0*M1 ; + if ne && ~isempty(PROB.sparse_struct{x,y,c}) + sample = flip_LL( X , [x y c] , PROB , [1 1]) ; + gree(used) = sample.ll - X.ll ; + else + gree(used) = -Inf ; + end + end +end +X.greedy_ll(inds(1:used)) = gree(1:used) ; + +end diff --git a/greedy_cones.m b/greedy_cones.m new file mode 100644 index 0000000..f19b7ce --- /dev/null +++ b/greedy_cones.m @@ -0,0 +1,86 @@ +function cone_map = greedy_cones( cone_map , speed ) + +warning off +if nargin<2 % default is regular greedy (anything but 0: 'hot' version) + speed = 0 ; +end + +%% PARAMS from cone_map +M0 = cone_map.M0 ; +M1 = cone_map.M1 ; +cone_map.SS = cone_map.cone_params.supersample ; +SS = cone_map.SS ; +N_colors = cone_map.N_colors ; +maxcones = cone_map.initX.maxcones ; + +% plot, display, and save every N iterations (0 = never) +display_every = 1 ; +default( cone_map , 'plot_every' , 0 ) +default( cone_map , 'save_every' , 500 ) + +% no need to track_contacts, greedy does not shift cones, it just adds them +if ~isfield(cone_map , 'track_contacts'), cone_map.track_contacts = false ; end + +fprintf('\n\nSTARTING greedy search') + + +% initializing variables +N_cones = 0 ; +X = cone_map.initX ; + +% if not tracking contacts, contact field is not needed +if ~cone_map.track_contacts, try X = rmfield(X,'contact') ; end ; end + +if plot_every +scrsz = get(0,'ScreenSize'); +h = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; +end + +% GREEDY addition of cones, one at a time +t = cputime ; +tic +for jj=1:maxcones + + % try adding a cone + if speed + [X,done] = greedy_hot(X,cone_map) ; + else + [X,done] = greedy(X,cone_map) ; + end + N_cones = numel(find(X.state>0)) ; + + % DISPLAY stdout + if ~mod(jj,display_every) + fprintf('\nCones:%4d, %4d %.0f\tin %8.2f sec',jj,N_cones,X.ll,toc) + tic + end + + % DISPLAY plot + if plot_every && ~mod(jj,plot_every) + figure(h) + plot_cones( X.state , cone_map ) ; + title(sprintf('Iteration %d',jj),'FontSize',16) + drawnow + end + + % SAVE to disk + save_now = done | jj/(N_cones+1)>1.1 ; + if ~mod(jj,save_every) || save_now + % use less disk space: remove large data structures + to_save = rmfield(cone_map,{'STA','initX','sparse_struct'}) ; + try X = rmfield(X,'excluded') ; end + X = remake_X(cone_map,X) ; + try to_save.X = rmfield(X,{'invWW'}) ; end + save('result', 'to_save' ) + if save_now , break ; + else clear to_save; end + end +end +fprintf('\ndone in %.1f sec\n\n',cputime - t) ; + +cone_map.X = X ; +cone_map.code = file2str('greedy_cones.m') ; +cone_map.N_cones = N_cones ; +% save('results','cone_map','X') + +end \ No newline at end of file diff --git a/greedy_hot.m b/greedy_hot.m new file mode 100644 index 0000000..1bb73f0 --- /dev/null +++ b/greedy_hot.m @@ -0,0 +1,34 @@ +function [X,done] = greedy_hot( X , PROB ) + +% p = log-posterior increase by adding cones at all locations/colors +p = PROB.LL-1e20*repmat(X.excluded,[1 1 3]) ; % X.excluded = hard prior + +% best cone addition location and color +[LL_increase,I] = max(p(:)) ; +[mx,my,mc] = ind2sub(size(PROB.LL),I) ; + +if LL_increase>0 + done = false ; + + % calculate true LL of new configuration (with no approximation) + newX = flip_LL( X , [mx my mc] , PROB , [1 1]) ; + + % if the LL did in fact increase, add cone + if newX.ll>=X.ll + X = update_X({newX},1,PROB.track_contacts) ; + % otherwise, poor approximation: exclude region around proposed cone + else + [~,indices] = not_excluded( X, mx, my ) ; + X.excluded(indices) = true ; + end + + % DISPLAY to stdout + try + fprintf(' #keep_cones %d, #keep_GCs %d mm-dll %f mm-PROB.ll %f',... + nnz(X.keep_cones),numel(X.keep_GCs),mm-newX.ll+oldll,mm-PROB.LL(mx,my,mc)) ; + end +else + done = true ; +end + +end \ No newline at end of file diff --git a/increment_state.m b/increment_state.m new file mode 100644 index 0000000..4877d31 --- /dev/null +++ b/increment_state.m @@ -0,0 +1,14 @@ +function state = increment_state( dX , state ) + +n = numel(max(dX(:,1:3:end))) ; +N = find(max(dX,[],2),1,'last') ; + +for i=1:N + for j=0:n-1 + if dX(i,1+3*j) + state(dX(i,1+3*j),dX(i,2+3*j)) = dX(i,3+3*j) ; + end + end +end + +end \ No newline at end of file diff --git a/initialize_X.m b/initialize_X.m new file mode 100644 index 0000000..090d70d --- /dev/null +++ b/initialize_X.m @@ -0,0 +1,63 @@ +function X = initialize_X(M0,M1,N_colors,SS,repulsion,beta,delta,maxcones) + +% a decent rule-of-thumb upper bound on the possible number of cones +if nargin<9, maxcones = floor( 0.3 * M0 * M1 ) ; end + +% masks is a data structure for calculating cone exclusion and contacts +X.masks = make_masks(repulsion*SS) ; + +% D is the exclusion distance used throughout +X.D = max(repulsion(1:2,1)*SS) ; + +X.repulsion = repulsion ; + +% size of the ROI +X.M0 = M0 * SS ; +X.M1 = M1 * SS ; + +% supersampling factor; usually 4 +X.SS = SS ; + +% 3 colors +X.N_colors = N_colors ; + +% initial configuration +X.N_cones = 0 ; +X.ll = 0 ; +X.dll = 0 ; +X.n_moves = 0 ; +X.diff = [] ; +X.version = 0 ; +X.excluded = false(X.M0,X.M1) ; + +% temperature progression, used by CAST +X.beta = beta ; +X.delta = delta ; + +% upper bound on anticipated number of cones +X.maxcones = maxcones ; + +% cone positions and colors, the most important data structure in X +X.state = sparse([],[],[],X.M0,X.M1,X.maxcones) ; + +% used by flip_LL to calculate all log-likelihoods +X.WW = [] ; +X.sparse_STA_W_state = sparse([]) ; + +% horizontal and vertical cone contact relations, used during shift moves +for d=1:2 + X.contact{d} = sparse([],[],[],X.M0*X.M1,X.M0*X.M1,floor(X.maxcones/2)) ; + X.contact{d} = logical(X.contact{d}) ; +end + +% record cputime, LL_history, and N_cones_history after each iteration +nn = ceil(M0*M1/10) ; +X.cputime = zeros(nn,1) ; +X.LL_history= zeros(nn,1) ; +X.N_cones_history = zeros(nn,1) ; + +% default temperature +X.T = [1 1] ; + + +end \ No newline at end of file diff --git a/insert_string.m b/insert_string.m new file mode 100644 index 0000000..78d638c --- /dev/null +++ b/insert_string.m @@ -0,0 +1,16 @@ +function string = insert_string(s,filename,position) + +fid = fopen(filename) ; + +% Count backwards from end of file if position < 0 +if position<0 + n_chars = numel( fread(fid, '*char') ) ; + fclose(fid) ; fid = fopen(filename) ; + position = n_chars + position ; +end + +begin = fread(fid, position , '*char')' ; +ending = fread(fid, '*char')' ; fclose(fid) ; +string = [begin s ending] ; + +end \ No newline at end of file diff --git a/load_bestX.m b/load_bestX.m new file mode 100644 index 0000000..a1d4c84 --- /dev/null +++ b/load_bestX.m @@ -0,0 +1,23 @@ +function bestX = load_bestX( dir , pattern ) + +cwd = pwd ; +cd(dir) + +lsd = ls(pattern) ; +filenames = {} ; + +if ~strcmp(lsd,'ls: ') % files exist + filenames = regexp(lsd,'\s','split') ; +end + +bestX = {} ; +for i=1:length(filenames) + if ~isempty(filenames{i}) + s = load(filenames{i}) ; + bestX = [bestX ; s.bestX(:)] ; + end +end + +cd(cwd) + +end \ No newline at end of file diff --git a/main.m b/main.m new file mode 100644 index 0000000..2407632 --- /dev/null +++ b/main.m @@ -0,0 +1,82 @@ +% add subfolders to path +addpath(genpath(pwd)) + + +%% LOAD DATA + +load george/stas +% load peach/peach_data +% stas(i).spikes : the list of spike times of cell i +% stas(i).spatial : the spatial component of the STA of cell i + +load george/cone_params +% load peach/cone_params +% cone_params.stimulus_variance : variance of each stim pixel color chanel +% (usually 1) +% +% cone_params.supersample : the integer number of cone positions per +% pixel width/height +% (usually 4) +% +% cone_params.colors : 3x3 matrix of cone color sensitivities +% +% cone_params.support_radius : radius of cone receptive field filter +% (usually 3.0) +% +% cone_params.repulsion_radii + + +% restrict the stimulus to a region of interest (if memory is a problem) +% stas = restrict_ROI( stas, [1 160], [1 160] ) ; + + + +%% CONE_MAP contains parameters and preprocessed data structures + +% calculate sparsity pattern (for MCMC) and initial LL map (for greedy) +cone_map = exact_LL_setup(stas,cone_params) ; + +% How many MCMC/CAST iterations? +cone_map.N_iterations = 1e4 ; +cone_map.max_time = 4e5 ; % in seconds + +% Define the progression of inverse temperatures for CAST +cone_map.min_delta = 0.1 ; +cone_map.min_beta = 0.2 ; +cone_map.betas = make_deltas( cone_map.min_beta, 1, 1, 20 ) ; +cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, length(cone_map.betas) ) ; + +% plot, display, and save every N iterations (0 = never) +cone_map.plot_every = 0 ; +cone_map.display_every = 20 ; +cone_map.save_every = 0 ; + + + +%% GREEDY +% greed = greedy_cones(cone_map) ; save('greed','greed') ; + + + +%% MCMC and CAST initialization + +% track contacts during 'hot' greedy method +cone_map.track_contacts = true ; + +% run 'hot' greedy method +greed_hot = greedy_cones(cone_map, 'hot') ; + +% initialize MCMC and CAST with 'hot' greedy configuration +cone_map.initX = greed_hot.X ; + +% plots are nice for MCMC and CAST +cone_map.plot_every = 100 ; + + +%% MCMC or CAST + +% % run MCMC +% mcmc = MCMC(cone_map) ; save('mcmc' ,'mcmc' ) ; + +% run CAST +cast = CAST(cone_map) ; save('cast' ,'cast' ) ; \ No newline at end of file diff --git a/main_CAST.m b/main_CAST.m new file mode 100644 index 0000000..2f25f18 --- /dev/null +++ b/main_CAST.m @@ -0,0 +1,35 @@ +% function main_CAST( type ) +type = 0 ; + +cone_map = make_cone_map( type ) ; + +base_str = cone_map_string( cone_map ) ; + +% THEN RUN THIS to run on your own computer: +% try +% load(['greed_' base_str]) +% catch e +% greed = greedy_cones(cone_map) ; save(['greed_' base_str],'greed') ; +% end + +greed_fast = greedy_cones(cone_map, 'fast') ; +cone_map.initX = greed_fast.X ; + +% mcmc = MCMC(cone_map) ; save(['mcmc_' base_str],'mcmc' ) +% cast = CAST(cone_map) ; save(['cast_' base_str],'cast' ) + +% OR THIS to run 50 MCMC instances and 50 CAST on the hpc cluster: +% INSTALL AGRICOLA FIRST +% N = 30 ; +% ids = cell(1,N) ; +% for i=1:length(ids) , ids{i} = {i} ; end +% +% PBS.l.mem = '1500mb' ; +% PBS.l.walltime = '70:00:00' ; +% sow(['cast_' base_str],@(ID)CAST(cone_map,ID),ids,PBS) ; +% +% PBS.l.mem = '1500mb' ; +% PBS.l.walltime = '70:00:00' ; +% sow(['mcmc_' base_str],@(ID)MCMC(cone_map,ID),ids,PBS) ; +% +% sow(['greed_' base_str],@()greedy_cones(cone_map)) ; diff --git a/make_ALL.m b/make_ALL.m new file mode 100644 index 0000000..08362df --- /dev/null +++ b/make_ALL.m @@ -0,0 +1,65 @@ + +% try +% load('peach/greed_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters') +% load('peach/mcmc_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters') +% load('peach/cast_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters') +% catch +% addpath('../agricola') +% reap +% +% save('peach/cast_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters',... +% 'cast_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters') +% +% save('peach/mcmc_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters',... +% 'mcmc_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters') +% +% save('peach/greed_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters',... +% 'cast_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters') +% end +% +% type = 1 ; +% main_CAST +% +% this = pwd ; +% % try +% make_plots( greed_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters,... +% mcmc_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters,... +% cast_peach_NROI2_ROI12_support3_SS4_beta02_delta01_5e05iters, cone_map ) ; +% % catch e, cd(this) ; end +% +% clear all + +% try + load('george/cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters') +% % for i=1:numel(cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters) +% % cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters{i}.bestX = ... +% % rmfield(cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters{i}.bestX,{'LL_history','cputime','N_cones_history','dX','excluded','sparse_STA_W_state','swap'}) ; +% % end + load('george/mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters') +% for i=1:numel(mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters) +% for j=1:numel(mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters{i}.bestX) +% mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters{i}.bestX{j} = ... +% rmfield(mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters{i}.bestX{j},{'LL_history','cputime','N_cones_history','excluded','sparse_STA_W_state'}) ; +% end +% end + load('george/greed_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters') +% catch +% addpath('../agricola') +% reap +% +% save('george/cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters',... +% 'cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters','-v7.3') +% +% save('george/mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters',... +% 'mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters') +% +% save('george/greed_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters',... +% 'greed_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters') +% end + +type = 0 ; +main_CAST + +make_plots( greed_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters,... + mcmc_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters,... + cast_george_NROI2_ROI12_support3_SS4_beta02_delta01_1e06iters, cone_map ) ; diff --git a/make_cone_map.m b/make_cone_map.m new file mode 100644 index 0000000..a7d40f1 --- /dev/null +++ b/make_cone_map.m @@ -0,0 +1,51 @@ +function cone_map = make_cone_map( type ) + +% PREPARE cone_map + +warning off + +if type==1 + type = 'peach' ; + load peach/peach_data % contains 'stas' + load peach/cone_params +else + type = 'george' ; + load george/stas % contains 'stas' + load george/cone_params % contains 'cone_params' + cone_params.stimulus_variance = 1 ; +end + +ROIs = {[1 size(stas(1).spatial,1)] [1 size(stas(1).spatial,2)]} ; +roi = 1 ; +roj = 2 ; +stas = restrict_ROI( stas, ROIs{roi}, ROIs{roj} ) ; + +cone_params.support_radius = 3 ; +% cone_params.supersample = 2 ; +cone_map = exact_LL_setup(stas,cone_params) ; % cone_map, aka PROB or data + +imagesc(cone_map.NICE) + +cone_map.N_iterations = 1e6 ; +cone_map.max_time = 4e5 ; +cone_map.profile_every = 0 ; +cone_map.min_delta = 0.1 ; +cone_map.min_beta = 0.2 ; +cone_map.betas = make_deltas( cone_map.min_beta, 1, 1, 20 ) ; +cone_map.deltas = make_deltas( cone_map.min_delta, 1, 1, length(cone_map.betas) ) ; + +cone_map.initX.rois = [roi roj] ; +cone_map.rois = [roi roj] ; +cone_map.initX.NROIs = numel(ROIs) ; +cone_map.NROIs = numel(ROIs) ; +cone_map.initX.ROI = {ROIs{roi} ; ROIs{roj}} ; +cone_map.initX.type = type ; +cone_map.type = type ; +cone_map.initX.supersample = cone_params.supersample ; +cone_map.initX.support_radius = cone_params.support_radius ; +cone_map.initX.N_iterations = cone_map.N_iterations ; +cone_map.initX.betas = cone_map.betas ; +cone_map.initX.deltas = cone_map.deltas ; + +cone_map.plot_every = 0 ; +cone_map.display_every = 20 ; \ No newline at end of file diff --git a/make_contacts.m b/make_contacts.m new file mode 100644 index 0000000..ff6108e --- /dev/null +++ b/make_contacts.m @@ -0,0 +1,29 @@ +function X = make_contacts( X , xyc ) + +x = xyc(1) ; +y = xyc(2) ; +c = xyc(3) ; + +for d=1:4 + shift = X.masks{1,1}.cardinal{d} ; + [dummy,inds] = place_mask( X.M0 , X.M1 , x , y , shift ) ; + contacts = inds(X.state(inds)>0) ; + + xy = x+(y-1)*X.M0 ; + + if d<=2 + X.contact{d}( xy , contacts ) = true ; + else + X.contact{1+mod(d+1,4)}( contacts , xy ) = true ; + end +% X.contact{1+mod(d+1,4)}( contacts , xy ) = true ; +% X.contact{d}( xy , xy ) = true ; + +% if ~X.state(contacts) +% X.state +% contacts +% end + +end + +end \ No newline at end of file diff --git a/make_deltas.m b/make_deltas.m new file mode 100644 index 0000000..d7b641e --- /dev/null +++ b/make_deltas.m @@ -0,0 +1,12 @@ +function deltas = make_deltas(m,M,r,N) +% make a progression of N temperatures in range [m M] with param r +% for example try: make_deltas(0.1, 1, 1, 20 ) ; + +N = max(N,4) ; + +deltas = log( 1:exp(r)/(N-1):1+exp(r) ) ; +deltas = m + deltas*(M-m)/deltas(end) ; + +deltas = deltas(end:-1:1) ; + +end \ No newline at end of file diff --git a/make_masks.m b/make_masks.m new file mode 100644 index 0000000..d9823cc --- /dev/null +++ b/make_masks.m @@ -0,0 +1,58 @@ +function masks = make_masks(repulsion) + +[n,m] = size(repulsion) ; +masks = cell( n , m ) ; + +for ii=1:n + for jj=1:m + + D = repulsion(1,1) ; + + s = floor(2*D + 5) ; + c = floor(D + 3) ; + + disks = cell(5,1) ; + for d=1:5 + disks{d} = zeros(s) ; + end + + shift = cell(5,1) ; + shift{1}= [ 0 0] ; + shift{2}= [ 1 0] ; + shift{3}= [ 0 1] ; + shift{4}= -shift{2} ; + shift{5}= -shift{3} ; + + for i=1:s + for j=1:s + for d=1:5 + if sqrt( (i-c-shift{d}(1))^2 + (j-c-shift{d}(2))^2 ) <= D + disks{d}(i,j) = 1 ; + end + end + end + end + + for d=1:4 + [x,y] = find( disks{1+d} & ~disks{1} ) ; + masks{ii,jj}.cardinal{d} = [x y] - c ; + end + + [x,y] = find( disks{1} ) ; + + masks{ii,jj}.exclusion = [x y] - c ; + + masks{ii,jj}.shift = shift(2:5) ; + + masks{ii,jj}.opposite = [3 4 1 2] ; + end +end + +% % testing with plot +% im = zeros(s,s,3) ; +% for d=1:3 +% inds = s*s*(d-1) + masks.cardinal{d}(:,1)+c + ... +% s*(masks.cardinal{d}(:,2)+c-1) ; +% im( inds ) = 1 ; +% end +% imagesc(im) \ No newline at end of file diff --git a/make_plots.m b/make_plots.m new file mode 100644 index 0000000..fcbba5d --- /dev/null +++ b/make_plots.m @@ -0,0 +1,42 @@ +function make_plots(greed,mcmc,cast,cone_map) + +% if nargin<4 +% cone_map = remake_cone_map(mcmc{1}) ; +% end + +folder_name = cone_map_string(cone_map); + +filename = ['plots_for_' folder_name] ; +mkdir( filename ) + +here = pwd ; + +cd(filename) + +% [~,ll] = get_best( cast ) ; +% +% try load(['../confident_' folder_name]) +% catch +% ['making ../confident_' folder_name] +% selector = @(n) (n>10000) && (mod(n,20) == 0) ; +% dX = cast{find(ll==max(ll),1)}.X.dX ; +% confident = confident_cones( cone_map.initX , dX , cone_map , selector ) ; +% end +% save(['../confident_' folder_name], 'confident') ; +% plot_cone_field( confident , cone_map ) +% +% plot_LL_ncones( greed , mcmc , cast , cone_map ) +plot_LL_ncones( {} , mcmc , cast , cone_map ) +% plot_Greedy_MCMC_CAST( greed , mcmc , cast , cone_map ) + +if strcmp(cone_map.type,'george') + timeline(greed,mcmc,cast,cone_map.initX, sum(cone_map.N_spikes)) +end + + +% % [sta,invww] = denoised_sta( greed.initX , cast{1}.X.dX , cone_map, selector ) ; +% % make_sta_plots( sta , invww, 'denoised' ) + +cd(here) + +end \ No newline at end of file diff --git a/make_sta_plots.m b/make_sta_plots.m new file mode 100644 index 0000000..efa40cd --- /dev/null +++ b/make_sta_plots.m @@ -0,0 +1,34 @@ +function make_sta_plots( sta , invww, filenames ) +% Given a cell struct of stas, for example as output by denoised_sta, save +% imagesc plots to current directory. Negative regions in STA are shown in +% white. + +NGC = size( sta, 2 ) ; + +h = figure ; + +for i=1:NGC + st = plotable_evidence( sta{1,i} ) ; + st = st.^(0.5) ; + + try + imagesc(st) ; + filename = sprintf('%s_%d_STA',filenames,i) ; + saveas(h,filename,'jpg') ; + catch E + fprintf('Error while attempting to plot %s',filename) + disp(E) + end + + try + std = sqrt( sta{2,i} - sta{1,i}.^2 + invww ) ; + std = std-min(std(:)) ; + std = std / max(std(:)) ; + imagesc(std) + filename = sprintf('%s_%d_std',filenames,i) ; + saveas(h,filename,'jpg') ; + catch E + fprintf('Error while attempting to plot %s',filename) + disp(E) + end +end \ No newline at end of file diff --git a/move.m b/move.m new file mode 100644 index 0000000..eed3160 --- /dev/null +++ b/move.m @@ -0,0 +1,131 @@ +function samples = move( X , PROB , T , n ) +% samples = move( X , PROB , n ) +% Draw n trial flips starting from state X. +% Two types of move are produced: additions of cones, and moves or changes +% in color of existing cones. +% First, n spatial locations are drawn. They are drawn from existing cone +% locations with probability PROB.q, and from the uniform distribution with +% probability (1-PROB.q). +% For each trial location i, if no cone of any color is at that position, +% then the corresponding trial is a placement of a single randomly colored +% cone at that location. +% If a cone of any color is at location i, then the corresponding +% trial is a change of color or deletion with probability 1/7, or a move of +% the cone to a neighboring location, each with probability 1/7. If the +% cone lies on the border of the domain, 7 is replaced by 3 + the number of +% adjacent positions that are within the border. +% For speed, backward probabilities are not calculated: this sampler should +% only be used with the symmetric rule, not with metropolis-hastings. + +% check_X(X) + +if nargin<4 , n = 1 ; end + +M0 = PROB.M0 * PROB.SS ; +M1 = PROB.M1 * PROB.SS ; + +% current cones in X +[cx,cy] = find(X.state) ; + +% initialize samples +samples = cell(X.N_cones*7+n,1) ; +ns = 0 ; + +% propose moves of existing cones +if X.N_cones > 0 + % draw n_moved existing cones + n_moved = binornd(n,PROB.q) ; + cones = randi( X.N_cones , 1 , n_moved ) ; + +% cones = 1:X.n_cones ; + + for s=1:n_moved +% for s=1:X.n_cones + i = cx(cones(s)) ; + j = cy(cones(s)) ; + color = X.state(i,j) ; + + % probability of choosing this location + p = 1/X.N_cones * PROB.q ; + + % number of legal moves for this cone, being careful about borders + nforward = 4 - PROB.outofbounds(i,j) + PROB.N_colors ; + + % for each adjacent location, add trial move to that location + for d=1:4 % move N , E , S , W + ni = i + X.masks{1,1}.shift{d}(1) ; + nj = j + X.masks{1,1}.shift{d}(2) ; + if ni > 0 && ni <= M0 && nj>0 && nj <= M1 + ns = ns+1 ; +% samples{ns} = move_cone( X , i , j , d , PROB , T ) ; + samples{ns} = propagate_action(X,i+(j-1)*X.M0,d,PROB,T) ; + samples{ns}.forward_prob = p/nforward ; + end + end + + % cone deletion + ns = ns+1 ; + samples{ns} = flip_LL( X , [i j 0] , PROB , T ) ; + samples{ns}.forward_prob = p/nforward ; +% check_X(samples{ns}) + + % change of color, without moving + deleted = ns ; + ne = not_excluded(X,i,j) ; + for cc=setdiff( 1:X.N_colors , color ) + ns = ns+1 ; + if ne && ~isempty(PROB.sparse_struct{i,j,cc}) + samples{ns} = flip_LL( samples{deleted} , [i j cc] , PROB , T ) ; +% check_X(samples{ns}) + else + samples{ns} = samples{deleted} ; + samples{ns}.ll = -Inf ; + end + samples{ns}.forward_prob = p/nforward ; + end + + end +else + n_moved = 0 ; +end + +% sample unoccupied locations, propose cone additions +while ns <= n - n_moved + ex = find(~X.excluded & PROB.has_evidence) ; + [i,j] = ind2sub([M0 M1],ex(randi(numel(ex)))) ; +% i = ij(1) ; +% j = ij(2) ; +% i = randi( M0 , 1 ) ; +% j = randi( M1 , 1 ) ; + + if ~X.state(i+M0*(j-1)) + % probability of choosing this location & color + p = (1-PROB.q)/((M0*M1 - X.N_cones)*PROB.N_colors) ; + + if X.N_cones >= X.maxcones + % if maxcones has been reached, delete a random cone first + cone = randi( X.N_cones , 1 , 1 ) ; + X = flip_LL( X, [cx(cone) cy(cone) 0], PROB, T ) ; + p = p/X.N_cones ; + end + + % propose addition of new cone of each color + ne = not_excluded(X,i,j) ; + for c=1:PROB.N_colors + ns = ns+1 ; + if ne && ~isempty(PROB.sparse_struct{i,j,c}) + samples{ns} = flip_LL( X , [i j c] , PROB , T ) ; +% check_X(samples{ns}) + else + samples{ns} = X ; + samples{ns}.ll = -Inf ; + end + samples{ns}.forward_prob = p ; + end + end +end + +samples = samples(1:ns) ; +% fprintf('\nDONE sampling trial moves\n') + +end \ No newline at end of file diff --git a/move_cone.m b/move_cone.m new file mode 100644 index 0000000..5ae0500 --- /dev/null +++ b/move_cone.m @@ -0,0 +1,10 @@ +function X = move_cone( X , x , y , d , PROB , T ) + +c = X.state(x,y) ; +if ~c , error('trying to move_cone nonexistent cone') ; end + +% update contacts and shift_dLLs recursively +action = @(z,xy)action_LL_shift(z,xy,d,PROB,T) ; +X = propagate_action(X,x+(y-1)*X.M0,d,action) ; + +end \ No newline at end of file diff --git a/normalize_sta.m b/normalize_sta.m new file mode 100644 index 0000000..78627f6 --- /dev/null +++ b/normalize_sta.m @@ -0,0 +1,6 @@ +function sta = normalize_sta( sta ) + +sta = sta-min(sta(:)) ; +sta = sta / max(sta(:)) ; + +end \ No newline at end of file diff --git a/not_excluded.m b/not_excluded.m new file mode 100644 index 0000000..e042b25 --- /dev/null +++ b/not_excluded.m @@ -0,0 +1,6 @@ +function [free,indices] = not_excluded(X,x,y) + +[~,indices] = place_mask( X.M0 , X.M1 , x , y , X.masks{1,1}.exclusion ) ; +free = isempty( find( X.state(indices)>0 , 1) ) ; + +end diff --git a/place_mask.m b/place_mask.m new file mode 100644 index 0000000..988202f --- /dev/null +++ b/place_mask.m @@ -0,0 +1,11 @@ +function [mask,indices] = place_mask( M0 , M1 , x , y , mask ) + +mask = [ mask(:,1)+x mask(:,2)+y ] ; +lines = mask(:,1)>0 & mask(:,1)<=M0 & mask(:,2)>0 & mask(:,2)<=M1 ; +mask = mask(lines,:) ; + +if nargout>1 + indices = mask(:,1) + (mask(:,2)-1)*M0 ; +end + +end \ No newline at end of file diff --git a/plot_Greedy_MCMC_CAST.m b/plot_Greedy_MCMC_CAST.m new file mode 100644 index 0000000..16b521d --- /dev/null +++ b/plot_Greedy_MCMC_CAST.m @@ -0,0 +1,39 @@ +function svg = plot_Greedy_MCMC_CAST( greed , mcmc , cast , PROB ) + +[~,ll,states,keep] = get_best( [mcmc ; cast ; {greed}] ) ; +id = [ones(numel(mcmc),1) ; 2*ones(numel(cast),1) ; 0] ; +id = id(keep) ; + +[xG,yG,cG] = find( states{end} ) ; +[x1,y1,c1] = find( states{ ll(id == 1) == max(ll(id == 1)) } ) ; +[x2,y2,c2] = find( states{ ll(id == 2) == max(ll(id == 2)) } ) ; + +id = [ones(numel(x1),1) ; 2*ones(numel(x2),1) ; zeros(numel(xG),1)] ; + +c = [num2cell(c1(:)) ; num2cell(c2(:)) ; num2cell(cG(:))] ; +for i=1:numel(c) + cc = c{i} ; + switch cc + case 1 + c{i} = 'red' ; + case 2 + c{i} = 'green' ; + case 3 + c{i} = 'blue' ; + end +end + +evidence = print_evidence( PROB.NICE ) ; +scale = 480/max([size(PROB.NICE,1) size(PROB.NICE,2)]) ; +width = min([500 500*size(PROB.NICE,2)/size(PROB.NICE,1)]) ; +height = min([500 500*size(PROB.NICE,1)/size(PROB.NICE,2)])+40 ; + +svg = sprints('<use xlink:href="#%d" transform="translate(%f %f)" stroke="%s"/>\n', ... + id,[y1(:);y2(:);yG],[x1(:);x2(:);xG],c) ; + +fid = fopen('plot_Greedy_MCMC_CAST_stub.svg') ; +svg = sprintf(fread(fid,'*char'),width,height,width,height,scale,scale,evidence,svg) ; + +save_svg_plot(svg,sprintf('Best_Greed_MCMC_CAST_%s.svg',PROB.type)) + +end \ No newline at end of file diff --git a/plot_Greedy_MCMC_CAST_stub.svg b/plot_Greedy_MCMC_CAST_stub.svg new file mode 100644 index 0000000..652fc0c --- /dev/null +++ b/plot_Greedy_MCMC_CAST_stub.svg @@ -0,0 +1,29 @@ +<svg width="%f" height="%f" viewBox="0 0 %f %f" + xmlns="http://www.w3.org/2000/svg" version="1.1" + xmlns:xlink="http://www.w3.org/1999/xlink" +> + +<defs> + <circle id="0" cx="0" cy="0" r="1.0" stroke-width="1.1" fill="white" /> + <circle id="1" cx="0" cy="0" r="3.1" stroke-width="1.4" fill="none" stroke-dasharray="3.5 2.5"/> + <circle id="2" cx="0" cy="0" r="4.5" stroke-width="1." fill="none"/> +</defs> + + <g transform="translate(10,12)scale(2.2,2.2)"> + <text font-size="8"> + <tspan baseline-shift="-50%%">Greedy</tspan> + <tspan baseline-shift="-50%%" dx="42">MCMC</tspan> + <tspan baseline-shift="-50%%" dx="49">CAST</tspan> + </text> + <use xlink:href="#0" transform="translate(33 1)" stroke="red"/> + <use xlink:href="#1" transform="translate(105 1)" stroke="red"/> + <use xlink:href="#2" transform="translate(175 1)" stroke="red"/> + </g> +<!-- <text x="38" y="17" font-size="6" fill="white">1</text> + <text x="95" y="70" font-size="6" fill="white">2</text> --> + +<g transform="translate(9,40)scale(%f,%f)"> +%s +%s +</g> +</svg> \ No newline at end of file diff --git a/plot_LL_ncones.m b/plot_LL_ncones.m new file mode 100644 index 0000000..7da3cc1 --- /dev/null +++ b/plot_LL_ncones.m @@ -0,0 +1,89 @@ +function svg = plot_LL_ncones( greed , mcmc , cast , cone_map ) + +if ~isempty(greed) + [x,y] = get_best( [mcmc ; cast ; {greed}] ) ; + id = [ones(numel(mcmc),1) ; 2*ones(numel(cast),1) ; 0] ; +else + [x,y] = get_best( [mcmc ; cast ] ) ; + id = [ones(numel(mcmc),1) ; 2*ones(numel(cast),1) ] ; +end + +y = bits_per_spike( y, sum(cone_map.N_spikes) ) ; + +minx = min(x) ; +maxx = max(x) ; +inds = (x>=minx) & (x<=maxx) ; + +id = id(inds) ; +y = y(inds) ; +x = x(inds) ; + +mx = min(x) ; +Mx = max(x) ; + +m = min(y) ; +M = max(y) ; + +id3 = find( y == max(y(id == 1)) ) ; +id( id3 ) = 3 ; + +id4 = find( y == max(y(id == 2)), 1 ) ; +id( id4 ) = 4 ; + +inds = [1:id3-1 id3+1:id4-1 id4+1:numel(x)-1 id3 id4 numel(x)] ; +x = x(inds) ; +y = y(inds) ; +id = id(inds) ; + +M1 = max(y(id==1)) ; + +mxi = y == max(y) ; + +g_ncone = x(end) ; +g_ll = y(end) ; + +mcmc_ncone = x(end-2) ; + +height = 220 ; + +y = y - m ; +y = 200 * (1-y/(M-m)) ; +x = 200 * (x-minx)/(max(x)-minx) ; + +svg = sprints('<use xlink:href="#%d" transform="translate(%f %f)"/>\n',id,x,y) ; + +ymax = y(find(x==max(x),1)) ; + +svg = [sprintf('<line x1="0" x2="%f" y1="0" y2="0" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(mxi)) ... + sprintf('<text x="-5" y="0" font-size="12" text-anchor="end" baseline-shift="-45%%">%.5f</text>\n',M) ... + sprintf('<line x1="%f" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',200,200,ymax,height) ... + sprintf('<text x="%f" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%d</text>\n',200,height,ceil(Mx)) ... + sprintf('<line x1="%f" x2="0" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end-2),y(end-2),y(end-2)) ... + sprintf('<text x="-5" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%.5f</text>\n',y(end-2),M1) ... + sprintf('<text x="100" y="240" font-size="15" text-anchor="middle" baseline-shift="-100%%" font-weight="bold"> number of cones</text>\n') ... + sprintf('<g transform="translate(-85 25)rotate(-90)"><text font-size="15" text-anchor="end" font-weight="bold">log posterior (bits/spike)</text></g>\n') ... + svg] ; + +if ~isempty(greed) + svg = [sprintf('<line x1="0" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end),y(end),y(end)) ... + sprintf('<text x="-5" y="%d" font-size="12" text-anchor="end" baseline-shift="-45%%">%.4f</text>\n',y(end),g_ll) ... + sprintf('<line x1="%f" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end),x(end),y(end),height) ... + sprintf('<text x="%f" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%d</text>\n',x(end),height,g_ncone)... + sprintf('<text x="75" y="-35" font-size="18" text-anchor="middle"><tspan fill="green">Greedy</tspan>, <tspan fill="blue">MCMC</tspan> and <tspan fill="red">CAST</tspan></text>\n') ... + svg] ; +else + svg = [sprintf('<line x1="%f" x2="%f" y1="%f" y2="%f" text-anchor="middle" stroke="black" opacity="0.4"/>\n',x(end-2),x(end-2),y(end-2),height) ... + sprintf('<text x="%f" y="%f" font-size="12" text-anchor="middle" baseline-shift="-110%%">%d</text>\n',x(end-2),height,mcmc_ncone)... +sprintf('<text x="75" y="-35" font-size="18" text-anchor="middle"><tspan fill="blue">MCMC</tspan> and <tspan fill="red">CAST</tspan></text>\n') ... + svg] ; +end + +svg = insert_string(svg,'plot_LL_ncones_stub.svg',-40) ; + +if ~isempty(greed) + save_svg_plot(svg,sprintf('LL_ncones_%s.svg',cone_map.type)) +else + save_svg_plot(svg,sprintf('LL_ncones_nogreed_%s.svg',cone_map.type)) +end + +end \ No newline at end of file diff --git a/plot_LL_ncones_stub.svg b/plot_LL_ncones_stub.svg new file mode 100644 index 0000000..d1d70a9 --- /dev/null +++ b/plot_LL_ncones_stub.svg @@ -0,0 +1,28 @@ +<svg width="100%" height="100%" viewBox="0 -5 645 585" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> + +<defs> + <line id="tick" x1="-10" stroke-width="0.3" stroke="black"/> + <!--<circle id="0" r="6" fill="green"/> + <ellipse id="1" rx="4" ry="1" fill="blue"/> + <ellipse id="2" rx="4" ry="1" fill="red"/>--> + <text id="0" fill="green" font-size="20" font-weight="bolder" text-anchor="middle" baseline-shift="-35%%" stroke="white" stroke-width="0.2">G</text> + <text id="1" fill="blue" font-size="9" font-weight="bolder" text-anchor="middle" baseline-shift="-35%%">M</text> + <text id="2" fill="red" font-size="9" font-weight="bolder" text-anchor="middle" baseline-shift="-35%%" stroke="white" stroke-width="0.2">C</text> + <text id="3" fill="blue" font-size="20" font-weight="bolder" text-anchor="middle" baseline-shift="-35%%" stroke="white" stroke-width="0.2">M</text> + <text id="4" fill="red" font-size="20" font-weight="bolder" text-anchor="middle" baseline-shift="-35%%" stroke="white" stroke-width="0.2">C</text> +</defs> + +<g transform="scale(2 2)" font-family="Helvetica"> + <g transform="translate(100 40)"> + + <!-- <use xlink:href="#tick"/> + <use xlink:href="#tick" transform="translate(0 200)"/> + <use xlink:href="#tick" transform="translate(0 200)rotate(-90)"/> + <use xlink:href="#tick" transform="translate(200 200)rotate(-90)"/> + --> + + <!-- DO NOT MODIFY AFTER THIS --> + + </g> +</g> +</svg> \ No newline at end of file diff --git a/plot_cone_field.m b/plot_cone_field.m new file mode 100644 index 0000000..ce8b736 --- /dev/null +++ b/plot_cone_field.m @@ -0,0 +1,37 @@ +function svg = plot_cone_field( cc , PROB ) + +alpha = sqrt(sum(cc.^2,3)) ; +[x,y,alpha] = find( alpha ) ; + +[alpha,order] = sort( alpha, 1, 'ascend' ) ; +x = x(order) ; +y = y(order) ; + +[M0,M1,~] = size(cc) ; + +r = floor( 255*cc(x+M0*(y-1)) ./ alpha ) ; +g = floor( 255*cc( M0*M1 + x+M0*(y-1)) ./ alpha ) ; +b = floor( 255*cc(2*M0*M1 + x+M0*(y-1)) ./ alpha ) ; + +svg = sprints('<use xlink:href="#1" transform="translate(%f %f)" stroke="rgb(%d,%d,%d)" opacity="%.2f"/>\n', ... + y,x,r,g,b,alpha) ; + +scale = 500/max([size(PROB.NICE,1) size(PROB.NICE,2)]) ; +width = min([500 500*size(PROB.NICE,2)/size(PROB.NICE,1)])+20 ; +height = min([500 500*size(PROB.NICE,1)/size(PROB.NICE,2)])+20 ; + +% width = scale*(size(PROB.NICE,2)+ 17) ; +% height = scale*(size(PROB.NICE,1)+ 85) ; + +% scale = 1 ; +% [width,height] = size(PROB.NICE) ; + +evidence = print_evidence( PROB.NICE ) ; +% evidence = [sprintf('<g transform="scale(%f,%f)">',scale,scale) evidence '</g>'] ; + +fid = fopen('plot_cones_field_stub.svg') ; +svg = sprintf(fread(fid,'*char'),width,height,width,height,scale,scale,evidence,svg) ; + +save_svg_plot(svg,sprintf('cones_field_%s.svg',PROB.type)) + +end \ No newline at end of file diff --git a/plot_cones.m b/plot_cones.m new file mode 100644 index 0000000..1a05d6e --- /dev/null +++ b/plot_cones.m @@ -0,0 +1,51 @@ +function h = plot_cones( states , cone_map ) + +if isnumeric(states) + states = { states } ; +end + +if iscell(states) && isfield(states{1},'state') + for i=1:numel(states) + states{i} = states{i}.state ; + end +end + +% if issparse(states{1}) +% for ii=1:numel(states) +% states{ii} = states{ii}( states{ii}>0 ) ; +% end +% end + +symbols = {'o' ; 's' ; '*' ; 'x' ; 'p' ; 'h' ; 'd' ; '.'} ; +colors = {'r' ; 'g' ; 'b' } ; + +NN = numel(states) ; +h = cell(3,NN) ; + +if nargin>1 && isfield( cone_map ,'NICE' ) + colormap('pink') + imagesc( cone_map.NICE.^(0.6) ) ; +end + +hold on +for ii=1:numel(states) + s = symbols{ii} ; + for cc=1:3 + c = colors{cc} ; + + [ix,iy] = find(states{ii} == cc) ; + h{cc,ii} = plot(iy,ix,sprintf('%s%s',c,s),'MarkerSize',12) ; + end +end + +if nargin>1 + if isfield(cone_map,'greedy') + cone_map = cone_map.greedy ; + end + if isnumeric(cone_map) + [gx,gy] = find( cone_map ) ; + plot(gy,gx,'w+','MarkerSize',7) ; + end +end + +end \ No newline at end of file diff --git a/plot_cones_field_stub.svg b/plot_cones_field_stub.svg new file mode 100644 index 0000000..31f3804 --- /dev/null +++ b/plot_cones_field_stub.svg @@ -0,0 +1,18 @@ +<svg width="%f" height="%f" viewBox="0 0 %f %f" + xmlns="http://www.w3.org/2000/svg" version="1.1" + xmlns:xlink="http://www.w3.org/1999/xlink" +> + +<defs> + <circle id="1" cx="0" cy="0" r="4.4" stroke-width="0.9" fill="none"/> +</defs> + +<!-- <text font-size="28"> + <tspan x="15" y="30">Cones sampled using CAST</tspan> +</text> --> + +<g transform="translate(10,10)scale(%f,%f)"> +%s +%s +</g> +</svg> \ No newline at end of file diff --git a/plot_save_select.m b/plot_save_select.m new file mode 100644 index 0000000..d60e399 --- /dev/null +++ b/plot_save_select.m @@ -0,0 +1,23 @@ +function plot_save_select(cone_map,dX,which_ones) +% cone_map can be the initial cone_map produced by exact_LL_setup.m (or +% equivalently , by main_CAST.m), or it can be the final cone_map after +% a run, either way. +% dX can be found as a field of X. +% which_ones is a list of iteration numbers which we would like to +% do_something with. + +T = [1 1] ; + +do = @plot_save ; + function plot_save(X,PROB,i) + save(sprintf('X_iteration_%d',i),'X') + plot_cones({X},PROB) ; + title(sprintf('Iteration %d LL%8d',i,floor(X.ll)),'FontSize',22) + drawnow + saveas(gcf,sprintf('X_at_iteration_%d',i),'fig') + end + +replay_select_X(cone_map,dX,T,which_ones,do) + +end + diff --git a/plotable_evidence.m b/plotable_evidence.m new file mode 100644 index 0000000..ddad84a --- /dev/null +++ b/plotable_evidence.m @@ -0,0 +1,21 @@ +function evidence = plotable_evidence( evidence ) + +infinite = ~isfinite(evidence) ; +evidence(~isfinite(evidence)) = 1e-10 ; + +evidence(evidence<0) = 0 ; + +z = max(evidence,[],3) ; +inds = logical(z<=0) ; +inds = inds(:) ; +inds3 = [inds ; inds ; inds] ; +% evidence(inds3) = -[z(inds) ; z(inds) ; z(inds)] ; +evidence(inds3) = 0 ; + +evidence = evidence-min(evidence(:)) ; +evidence = evidence / max(evidence(:)) ; + +evidence(inds3) = 0.15 ; +evidence(infinite) = 0 ; + +end \ No newline at end of file diff --git a/print_evidence.m b/print_evidence.m new file mode 100644 index 0000000..667490a --- /dev/null +++ b/print_evidence.m @@ -0,0 +1,12 @@ +function svg = print_evidence( NICE ) + +[nx,ny,~] = size(NICE) ; +f = figure('visible','off'); imshow(NICE, 'Border', 'tight'); +set(gca,'position',[0 0 1 1],'units','normalized') +set(gcf,'PaperPosition',[0 0 ny/80 nx/80]) +set(gcf,'PaperSize',[ny nx]) +print(f, '-r80', '-dpng', 'evidence80.png'); + +svg = sprintf('<image width="%d" height="%d" xlink:href="evidence80.png"/>\n',ny,nx) ; + +end \ No newline at end of file diff --git a/propagate_action.m b/propagate_action.m new file mode 100644 index 0000000..34e149e --- /dev/null +++ b/propagate_action.m @@ -0,0 +1,30 @@ +function [X,done] = propagate_action( X , xy , d , PROB, T , done ) + +% keep track of which cones have already been visited +if nargin<6 , done = sparse([],[],[],X.M0*X.M1,1,10) ; end + +if ~done(xy) + +% check_X(X) +% +% if ~X.state(xy) +% error('trying to act on nonexistent cell') +% end + + dd = mod(d-1,2)+1 ; + if d>2 + cxys = find( X.contact{dd}(:,xy)' ) ; + else + cxys = find( X.contact{dd}(xy,:) ) ; + end + for cxy = cxys + if cxy ~= xy + [X,done] = propagate_action( X , cxy , d , PROB, T , done ) ; + end + end + + X = action_LL_shift(X,xy,d,PROB,T) ; +end +done(xy) = true ; + +end \ No newline at end of file diff --git a/randiscrete.m b/randiscrete.m new file mode 100644 index 0000000..e80dbf4 --- /dev/null +++ b/randiscrete.m @@ -0,0 +1,19 @@ +function sample = randiscrete(cumprob,m) +% draw m integers from 1:length(cumprob) from cumulative probability vector +% cumprob, where cumprob must be positive, increasing and cumprob(end) = 1. + +if nargin<2 + m = 1 ; +end + +% cumprob=cumsum(p(:)); +sample=zeros(1,m); +for j=1:m + uni=rand(); + sample(j) = find( uni<=cumprob , 1 ) ; +end + +% note +% an implementation with sortrows would be much faster for large m + +end \ No newline at end of file diff --git a/remake_X.m b/remake_X.m new file mode 100644 index 0000000..7db1483 --- /dev/null +++ b/remake_X.m @@ -0,0 +1,27 @@ +function Y = remake_X( cone_map, X ) + +Y = X ; + +if ~isfield(X,'WW') || ~isfield(X,'contact') + Y = initialize_X( cone_map.M0, cone_map.M1, ... + cone_map.N_colors, cone_map.SS, ... + cone_map.cone_params.replusion_radii, ... + cone_map.naive_LL, 1, 1) ; + + [x,y,c] = find(X.state) ; + for i=1:numel(x) + Y = flip_LL( Y , [x(i) y(i) c(i)] , cone_map , [1 1] ) ; + Y = update_X({Y}) ; + end +end + +if ~isfield(X, 'excluded') + Y.excluded = false(Y.M0,X.M1) ; + [x,y,c] = find(Y.state) ; + for i=1:numel(x) + [~,indices] = not_excluded( Y, x(i), y(i) ) ; + Y.excluded(indices) = true ; + end +end + +end \ No newline at end of file diff --git a/remake_cone_map.m b/remake_cone_map.m new file mode 100644 index 0000000..8ef6dfa --- /dev/null +++ b/remake_cone_map.m @@ -0,0 +1,38 @@ +function cone_map = remake_cone_map( X ) + +if strcmp(X.type,'peach') + type = 'peach' ; + load peach/peach_data % contains 'stas' + load peach/cone_params +else + type = 'george' ; + load george/stas % contains 'stas' + load george/cone_params % contains 'cone_params' +end + +% stas = restrict_ROI( stas, X.ROI{1}, X.ROI{2} ) ; + +cone_map = exact_LL_setup(stas,cone_params) ; % cone_map, aka PROB or data + +cone_map.initX.rois = X.rois ; +cone_map.rois = X.rois ; +cone_map.initX.NROI = X.NROI ; +try + cone_map.initX.NROIs = numel(X.ROI) ; + cone_map.NROIs = numel(X.ROI) ; + cone_map.initX.ROI = X.ROI ; +catch + cone_map.initX.NROIs = 2 ; + cone_map.NROIs = 2 ; +end +cone_map.initX.type = X.type ; +cone_map.type = X.type ; +cone_map.initX.supersample = cone_params.supersample ; +cone_map.initX.support_radius = cone_params.support_radius ; +cone_map.min_beta = min(X.betas) ; +cone_map.min_delta = min(X.deltas) ; +cone_map.initX.betas = X.betas ; +cone_map.initX.deltas = X.deltas ; +cone_map.initX.N_iterations = X.N_iterations ; + +end \ No newline at end of file diff --git a/replay.m b/replay.m new file mode 100644 index 0000000..b19b3c2 --- /dev/null +++ b/replay.m @@ -0,0 +1,99 @@ +function replay( dX, greedy, cone_map , skip, speed ) + +if nargin<4 , skip = 10 ; end % iterations/frame +if nargin<5 , speed = 10 ; end % frames/sec + +[gx,gy] = find(greedy) ; + +M0 = cone_map.M0 * cone_map.cone_params.supersample ; +M1 = cone_map.M1 * cone_map.cone_params.supersample ; +NN = numel(dX) ; + +n = 0 ; +N = 0 ; +states = cell(NN,1) ; +for i=1:NN + n = max(n,numel(max(dX{i}(:,1:3:end)))) ; + N = max(N,find(max(dX{i},[],2),1,'last')) ; + states{i} = zeros(M0,M1) ; +end + +% scrsz = get(0,'ScreenSize'); +% hf = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; +% +% colormap('pink') +% imagesc( cone_map.NICE ) ; +% hold on +% +% symbols = {'.' ; 's' ; '*' ; 'x' ; 'p' ; 'h' ; 'd' ; 'o'} ; +% colors = {'r' ; 'g' ; 'b' } ; +% +% h = cell(3,NN) ; +% +% for i=1:N +% for j=0:n-1 +% for ii=1:NN +% if dX{ii}(i,1+3*j) +% states{ii}(dX{ii}(i,1+3*j),dX{ii}(i,2+3*j)) = dX{ii}(i,3+3*j) ; +% end +% end +% end +% +% if ~mod(i,skip) +% tic ; +% +% figure(hf) +% +% for ii=1:NN +% s = symbols{ii} ; +% for cc=1:3 +% c = colors{cc} ; +% +% [ix,iy] = find(states{ii} == cc) ; +% h{cc,ii} = plot(iy,ix,sprintf('%s%s',c,s),'MarkerSize',5) ; +% end +% end +% plot(gy,gx,'w+','MarkerSize',7) +% +% title(sprintf('Iteration %d',i),'FontSize',16) +% drawnow expose +% pause(1/speed - toc) ; +% if i<N-skip , delete(cell2mat(h(:))) ; end +% +% end +% end + + + + + +scrsz = get(0,'ScreenSize'); +hf = figure('Position',[1 scrsz(4)*0.7*0.5 1500*0.5 1200*0.5]) ; + +colormap('pink') +imagesc( cone_map.NICE.^(0.6) ) ; +hold on + +for i=1:N + for j=0:n-1 + for ii=1:NN + if dX{ii}(i,1+3*j) + states{ii}(dX{ii}(i,1+3*j),dX{ii}(i,2+3*j)) = dX{ii}(i,3+3*j) ; + end + end + end + + if ~mod(i,skip) + tic ; + + figure(hf) + + h = plot_cones( states , greedy ) ; + + title(sprintf('Iteration %d',i),'FontSize',16) + drawnow expose + pause(1/speed - toc) ; + if i<N-skip , delete(cell2mat(h(:))) ; end + + end +end \ No newline at end of file diff --git a/replay_select_X.m b/replay_select_X.m new file mode 100644 index 0000000..256926c --- /dev/null +++ b/replay_select_X.m @@ -0,0 +1,23 @@ +function replay_select_X(cone_map,dX,T,which_ones,do_something) +% cone_map can be the initial cone_map produced by exact_LL_setup.m (or +% equivalently , by main_CAST.m), or it can be the final cone_map after +% a run, either way. +% dX can be found as a field of X. +% which_ones is a list of iteration numbers which we would like to +% do_something with. do_something will be called with arguments X, +% cone_map, and the iteration number i. +% You can have do_something save or plot X at which_ones iterations. + +f = @do_it ; +function i = do_it(i,X) + if ismember(i,which_ones) + do_something(X,cone_map,i) ; + end + i = i+1 ; +end + +dX = dX(1:max(which_ones)+5,:) ; + +fold_X( cone_map.initX , dX , cone_map , T , 0 , f ) ; + +end \ No newline at end of file diff --git a/restrict_ROI.m b/restrict_ROI.m new file mode 100644 index 0000000..2b24d99 --- /dev/null +++ b/restrict_ROI.m @@ -0,0 +1,18 @@ +function stas = restrict_ROI( stas, xrange, yrange ) +% Restrict stas to new Region Of Interest [x X], [y Y]. +% Only keep those cells for which the sta extremum is within the new ROI. + +keep = zeros(numel(stas),1) ; +for c=1:numel(stas) + [~,I] = max( sum(abs(stas(c).spatial),3) ) ; + if xrange(1)<=I(1) && I(1)<=xrange(2) && yrange(1)<=I(2) && I(2)<=yrange(2) + keep(c) = 1 ; + end +end +stas = stas(logical(keep)) ; + +for c=1:numel(stas) + stas(c).spatial = stas(c).spatial(xrange(1):xrange(2),yrange(1):yrange(2),:) ; +end + +end \ No newline at end of file diff --git a/save_svg_plot.m b/save_svg_plot.m new file mode 100644 index 0000000..5bd4eb3 --- /dev/null +++ b/save_svg_plot.m @@ -0,0 +1,11 @@ +function save_svg_plot(svg,filename,batik) + +if nargin<3 + batik = '../batik/' ; +end + +fid = fopen(filename,'w') ; +fwrite(fid,svg) ; fclose(fid) ; +system(['java -jar ' batik 'batik-rasterizer.jar -m application/pdf ' filename]) + +end \ No newline at end of file diff --git a/sprints.m b/sprints.m new file mode 100644 index 0000000..4477d0b --- /dev/null +++ b/sprints.m @@ -0,0 +1,27 @@ +function s = sprints( format , varargin ) + +N = numel(varargin{1}) ; +for i=1:nargin-1 +% if iscell( varargin{i} ) , varargin{i} = cell2mat(varargin{i}) ; end + varargin{i} = varargin{i}(:) ; + if length(varargin{i}) ~= N + error('sprints: numel(varargs{i}) must all be ==.') ; + end +end + +s = '' ; +format = ['%s' format] ; +arg = 's' ; +for i=1:nargin-1 + if iscell( varargin{i} ) + arg = sprintf('%s,varargin{%d}{j}',arg,i) ; + else + arg = sprintf('%s,varargin{%d}(j)',arg,i) ; + end +end + +for j=1:N + s = eval(['sprintf(format,' arg ')']) ; +end + +end \ No newline at end of file diff --git a/strip_cone_map.m b/strip_cone_map.m new file mode 100644 index 0000000..af2bdbb --- /dev/null +++ b/strip_cone_map.m @@ -0,0 +1,14 @@ +for i=1:50 + try + name = sprintf('result_%d.mat',i) ; + load( name ) ; + try + cone_map = rmfield(cone_map,{'STA','LL','NICE','initX'}) ; + end + cone_map.X = rmfield(cone_map.X,{'invWW','contact'}) ; + save(name,'cone_map') + end +end + +names = fieldnames( cone_map ) ; +for i=1:numel(names) , assignin('base',names{i},cone_map.(names{i})) ; end \ No newline at end of file diff --git a/svg_movie.m b/svg_movie.m new file mode 100644 index 0000000..83238f1 --- /dev/null +++ b/svg_movie.m @@ -0,0 +1,58 @@ +function svg = svg_movie( init , dX , greedy ) + +data = 'data = [' ; +for i=1:1e10 + idata = cell(numel(dX),4) ; run = 0 ; + for j=1:numel(dX) + if size(dX{j},1)>=i + if i == 1 , idata(j,:) = state2xyc( init{j} , j ) ; end + for jj=1:3 , idata{j,jj} = [idata{j,jj} dX{j}(i,jj:3:end)] ; end + idata{j,4} = [idata{j,4} repmat(j,[1 numel(idata{j,1})])] ; + run = 1 ; + end + end + if ~run , break ; end + if i == 1 , idata = [idata ; state2xyc(greedy,0)] ; end + + ith = xycs2js( idata ) ; + if ~isempty( ith ) + data = [data '[' ith sprintf('],\n')] ; + end +end +data = [data(1:end-1) ']'] ; + +svg = insert_string( data , which('dance.js') , 356 ) ; +svg = insert_string( svg , which('dancing_cones_source.svg') , 172 ) ; + +try + lsres = ls('dancing_cones.svg') ; + user_input = input('\nWarning: rm old dancing_cones.svg? (y/n):','s') ; + switch user_input + case 'y' + delete('dancing_cones.svg') + otherwise + return + end +end +fid = fopen('dancing_cones.svg','w') ; +fwrite(fid,svg) ; fclose(fid) ; + +end + + +function xyc = state2xyc(state,ii) +[x,y,c] = find( state ) ; xyc = {x(:)' y(:)' c(:)' repmat(ii,[1 numel(x)])} ; +end + + +function js = xycs2js( xycs ) +js = '' ; +for i=1:size(xycs,1) + inds = find(xycs{i,1}) ; + for j=inds + js = [js '[ ' num2str(xycs{i,2}(j)) ' , ' num2str(xycs{i,1}(j)) ' , ' ... + num2str(xycs{i,3}(j)) ' , ' num2str(xycs{i,4}(j)) '] , '] ; + end +end +if ~isempty(js) , js = js(1:end-5) ; end +end \ No newline at end of file diff --git a/swap/equivalence_classes.m b/swap/equivalence_classes.m new file mode 100644 index 0000000..94545bc --- /dev/null +++ b/swap/equivalence_classes.m @@ -0,0 +1,40 @@ +function [classes,sizes] = equivalence_classes(R,max_classes) +% for binary transitive relation R, a boolean square matrix +% calculate equivalence classes, i.e. groups of indices which are related, +% as well as the sizes of these groups. + + +n = size(R,1) ; +seen = zeros(n,1) ; + +classes = cell(min(n,max_classes),1) ; +sizes = zeros(min(n,max_classes),1) ; + +inds = find(diag(R)>0) ; + +if ~isempty(inds) + perm = randperm(numel(inds)) ; + inds = inds(perm) ; + + i=inds(1) ; + k=1 ; + while ~isempty(i) + s = R(:,i) ; + seen(s) = k ; + + classes{k} = find(s) ; + sizes(k) = sum(s) ; + + if k >= max_classes + break + end + k = k+1 ; + i = inds( find(~seen(inds),1) ) ; + end + classes = classes(1:k) ; + sizes = sizes(1:k) ; +else + classes = {} ; + sizes = [] ; +end +end \ No newline at end of file diff --git a/swap/overlap_relation.m b/swap/overlap_relation.m new file mode 100644 index 0000000..2b6311c --- /dev/null +++ b/swap/overlap_relation.m @@ -0,0 +1,28 @@ +function R = overlap_relation( X , Y ) +% Calculate the binary relation R, a boolean square matrix, whose entry i,j +% is true iff cone i in configuration X is within the exclusion disk of +% cone j in configuration Y. + +[x,y] = find(X.state) ; +xx = find(X.state) ; + +x_inds = zeros(numel(x),1) ; +y_inds = zeros(numel(x),1) ; +ind = 0 ; + +for i=1:length(x) + [dum,indices] = place_mask( Y.M0 , Y.M1 , x(i) , y(i) , Y.masks{1,1}.exclusion ) ; + overlaps = find( Y.state(indices)>0 ) ; + for j=1:numel(overlaps) + ind = ind+1 ; + x_inds(ind) = xx(i) ; + y_inds(ind) = indices(overlaps(j)) ; + end +end + +x_inds = x_inds(1:ind) ; +y_inds = y_inds(1:ind) ; + +R = logical( sparse(x_inds,y_inds,ones(ind,1),numel(X.state),numel(X.state))) ; + +end \ No newline at end of file diff --git a/swap/swap_closure.m b/swap/swap_closure.m new file mode 100644 index 0000000..65474a4 --- /dev/null +++ b/swap/swap_closure.m @@ -0,0 +1,158 @@ +function XS = swap_closure( X , T, otherX , oT, PROB ) +% Combine two systems into a single system, summing their log-likelihoods. +% This is in preparation for swapping parts of the two systems' +% configurations. For this, groups of cells that must be swapped together +% are calculated. + +% check_X(X) +% check_X(otherX) + +% calculate overlaps of X cones on otherX exclusion disks + +% symmetrize relation and calculate transitive closure +N = numel(X.state) ; + +% i = find( otherX.state) ; +% j = find( X.state) ; +R = overlap_relation( otherX , X ) ; + +% EO= logical(sparse(i,i,ones(length(i),1),N,N,3*N)) ; +% EX= logical(sparse(j,j,ones(length(j),1),N,N,3*N)) ; +% R = logical( [ EO R ; R' EX ] ) ; +% R = transitive_closure(R,[i ; N+j],0) ; + +% EO= logical(sparse([],[],[],N,N,N)) ; +% EX= logical(sparse([],[],[],N,N,N)) ; +% RR = logical( [ EO R ; R' EX ] ) ; +% RR = transitive_closure(RR,[i ; N+j],1) ; + +% clear i j + +% get equivalence classes / connected components +% classes_old = equivalence_classes(RR,20) ; + +classes = equivalence_classes_direct(R,50) ; + +if numel(classes)>0 + classes = [{[]} ; classes] ; +else + classes = {[]} ; +end +XS = cell( numel(classes), 1 ) ; + +fprintf(' %d',numel(classes)) + + +keep = [] ; +for m=1:length(XS) + if m>1 + XX = struct ; + XX.state = X.state ; + if isfield(X,'invWW') + XX.invWW = X.invWW ; + end + if isfield(X,'WW') + XX.WW = X.WW ; + end + if isfield(X,'dUW_STA') + XX.dUW_STA = X.dUW_STA ; + end + if isfield(X,'ds_UW_STA') + XX.ds_UW_STA = X.ds_UW_STA ; + end + XX.sparse_STA_W_state = X.sparse_STA_W_state ; + XX.contributions = X.contributions ; + XX.N_cones=X.N_cones ; + XX.ll = X.ll ; + XX.diff = X.diff ; + XX.beta = X.beta ; + XX.delta = X.delta ; + XX.LL_history = X.LL_history ; + XX.N_cones_history = X.N_cones_history ; + XX.cputime = X.cputime ; + + OX = struct ; + OX.state = otherX.state ; + if isfield(X,'invWW') + OX.invWW = otherX.invWW ; + end + if isfield(X,'WW') + OX.WW = otherX.WW ; + end + if isfield(X,'dUW_STA') + OX.dUW_STA = otherX.dUW_STA ; + end + if isfield(X,'ds_UW_STA') + OX.ds_UW_STA = otherX.ds_UW_STA ; + end + OX.sparse_STA_W_state = otherX.sparse_STA_W_state ; + OX.contributions = otherX.contributions ; + OX.N_cones=otherX.N_cones ; + OX.ll = otherX.ll ; + OX.diff = otherX.diff ; + OX.beta = otherX.beta ; + OX.delta = otherX.delta ; + OX.LL_history = otherX.LL_history ; + OX.N_cones_history = otherX.N_cones_history ; + OX.cputime = otherX.cputime ; + else + XX = X ; + OX = otherX ; + end + Oclass = classes{m}(classes{m}<=N) ; + Xclass = classes{m}(classes{m} >N) - N ; + +% fprintf('\t %d,%d',numel(Xclass),numel(Oclass)) ; + + if X.maxcones >= X.N_cones + numel(Oclass) && ... + X.maxcones >= otherX.N_cones + numel(Xclass) + + xcx = 1+mod(Xclass-1,X.M0) ; + xcy = 1+floor((Xclass-1)/X.M0) ; + xcc = XX.state(Xclass) ; + + ocx = 1+mod(Oclass-1,X.M0) ; + ocy = 1+floor((Oclass-1)/X.M0) ; + occ = OX.state(Oclass) ; + + for k=1:length(Xclass) + XX = flip_LL( XX , [xcx(k) xcy(k) 0] , PROB, T ) ; + end + for k=1:length(Oclass) + OX = flip_LL( OX , [ocx(k) ocy(k) 0] , PROB, oT ) ; + end + for k=1:length(Oclass) + XX = flip_LL( XX , [ocx(k) ocy(k) occ(k)] , PROB, T ) ; + end + for k=1:length(Xclass) + OX = flip_LL( OX , [xcx(k) xcy(k) xcc(k)] , PROB, oT ) ; + end + + XS{m}.X = XX ; + XS{m}.with = OX ; + XS{m}.ll = XX.ll + OX.ll ; + + keep = [keep m] ; + end +end +XS = XS(keep) ; + + +N = numel(XS) ; +for i=1:N +% check_X(XS{i}.X) +% check_X(XS{i}.with) + XS{i}.forward_prob = 1/N ; +end + +if N==0 + X + otherX + keep + numel(classes) + classes{1} + classes + save(sprintf('crash_dump_%d.mat',randi(100)),'X','otherX','keep','classes','PROB') +end + +end \ No newline at end of file diff --git a/swap/swap_step.m b/swap/swap_step.m new file mode 100644 index 0000000..5219aa6 --- /dev/null +++ b/swap/swap_step.m @@ -0,0 +1,14 @@ +function [X1,X2] = swap_step(X1,T1,X2,T2,PROB) + +% check_X(X1) +% check_X(X2) +swapX = swap_closure( X1, T1, X2 , T2, PROB) ; +% for i=1:numel(swapX) +% check_X(swapX{i}.X) +% check_X(swapX{i}.with) +% end +swapX = flip_MCMC( swapX{1}, swapX(2:end), PROB, {T1 T2} ) ; +X1 = swapX.X ; +X2 = swapX.with ; + +end diff --git a/swap/update_swap.m b/swap/update_swap.m new file mode 100644 index 0000000..ef7ef9c --- /dev/null +++ b/swap/update_swap.m @@ -0,0 +1,79 @@ +function X = update_swap(trials,i) + +if i>1 + +% check_X(trials{1}.X) +% check_X(trials{1}.with) + + X.X = trials{1}.X ; + X.X.state = trials{i}.X.state ; + if isfield(trials{i}.X,'invWW') + X.X.invWW = trials{i}.X.invWW ; + end + if isfield(trials{i}.X,'WW') + X.X.WW = trials{i}.X.WW ; + end + if isfield(trials{i}.X,'dUW_STA') + X.X.dUW_STA = trials{i}.X.dUW_STA ; + end + if isfield(trials{i}.X,'ds_UW_STA') + X.X.ds_UW_STA = trials{i}.X.ds_UW_STA ; + end + X.X.sparse_STA_W_state = trials{i}.X.sparse_STA_W_state ; + X.X.contributions = trials{i}.X.contributions ; + X.X.N_cones = trials{i}.X.N_cones ; + X.X.ll = trials{i}.X.ll ; + X.X.diff = trials{i}.X.diff ; + X.X.beta = trials{i}.X.beta ; + X.X.delta = trials{i}.X.delta ; + X.X.LL_history = trials{i}.X.LL_history ; + X.X.N_cones_history = trials{i}.X.N_cones_history ; + X.X.cputime = trials{i}.X.cputime ; + + X.with = trials{1}.with ; + X.with.state = trials{i}.with.state ; + if isfield(trials{i}.with,'invWW') + X.with.invWW = trials{i}.with.invWW ; + end + if isfield(trials{i}.with,'WW') + X.with.WW = trials{i}.with.WW ; + end + if isfield(trials{i}.with,'dUW_STA') + X.with.dUW_STA = trials{i}.with.dUW_STA ; + end + if isfield(trials{i}.with,'ds_UW_STA') + X.with.ds_UW_STA = trials{i}.with.ds_UW_STA ; + end + X.with.sparse_STA_W_state = trials{i}.with.sparse_STA_W_state ; + X.with.contributions = trials{i}.with.contributions ; + X.with.N_cones = trials{i}.with.N_cones ; + X.with.ll = trials{i}.with.ll ; + X.with.diff = trials{i}.with.diff ; + X.with.beta = trials{i}.with.beta ; + X.with.delta = trials{i}.with.delta ; + X.with.LL_history = trials{i}.with.LL_history ; + X.with.N_cones_history = trials{i}.with.N_cones_history ; + X.with.cputime = trials{i}.with.cputime ; + + +% check_X(X.X) +% check_X(X.with) + +else + X = trials{1} ; +end + +% update both X +ii = 2*(i>1) + (i==1) ; +X.X = update_X({trials{1}.X X.X },ii) ; +X.with = update_X({trials{1}.with X.with},ii) ; + +if isfield(X.X,'swap') + X.X.swap(X.X.iteration) = true ; +end + +if isfield(X.X,'swap') + X.with.swap(X.with.iteration) = true ; +end + +end \ No newline at end of file diff --git a/test/check_LL.m b/test/check_LL.m new file mode 100644 index 0000000..f95cd1f --- /dev/null +++ b/test/check_LL.m @@ -0,0 +1,104 @@ +function check_LL( Y , PROB ) + +M0 = PROB.M0 * PROB.SS ; +M1 = PROB.M1 * PROB.SS ; + +[xs , ys , cs] = find(Y.state) ; + +posX = [] ; +posY = [] ; +colors = [] ; + +X.state = Y.state * 0 ; +X.N_cones = 0 ; +X.WW = [] ; + +order = randperm(size(xs,1)) ; + +for i=order + + x = xs(i) ; + y = ys(i) ; + c = cs(i) ; + + % block matrix inverse update + X.N_cones = X.N_cones + 1 ; + + Wkinds = [posX'-x ; posY'-y] ; + ssx = 1+mod(x-1,PROB.SS) ; + ssy = 1+mod(y-1,PROB.SS) ; + + Wkstate = zeros(1,X.N_cones-1) ; + +% where = find( max(abs(Wkinds),[],1) <= PROB.R ) ; +% if ~isempty(where) +% xx = Wkinds(1,where)+PROB.R+ssx ; +% yy = Wkinds(2,where)+PROB.R+ssy ; +% for k=1:length(where) +% Wkstate(where(k)) = PROB.coneConv(xx(k),yy(k),ssx,ssy) ... +% .* PROB.colorDot(c,colors(where(k))) ; +% end + + where = find( max(abs(Wkinds),[],1) <= PROB.R ) ; + if ~isempty(where) + xx = Wkinds(1,where)+PROB.R+ssx ; + yy = Wkinds(2,where)+PROB.R+ssy ; + for k=1:length(where) + Wkstate(where(k)) = PROB.coneConv(xx(k),yy(k),ssx,ssy) ... + .* PROB.colorDot(c,colors(where(k))) ; + end + + +% for k=1:size(posX) +% Wkstate(k) = 1/norm(Wkinds(:,k)) ; +% end + end + + Wkkc = PROB.coneConv(PROB.R+ssx,PROB.R+ssy,ssx,ssy) * PROB.colorDot(c,c) ; +% Wkkc = i ; + + if max(Wkstate) > Wkkc + error('This is absurd.') + end + + X.WW = [X.WW Wkstate' ; Wkstate Wkkc ] ; + + X.state(x,y) = c ; + posX = [posX ; x] ; + posY = [posY ; y] ; + colors = [colors ; c] ; + +end + +% recalculate data log-likelihood +if X.N_cones>0 + + STA_W_state = PROB.STA_W( posX'+M0*(posY'-1)+M0*M1*(colors'-1) , : )' ; + + ll = Y.beta * full(- X.N_cones * PROB.sumLconst - log(det(X.WW)) * PROB.N_GC + ... + sum( PROB.cell_consts .* sum( (STA_W_state * inv(X.WW)) .* STA_W_state ,2) )/2) ; +else + ll = 0 ; +end + +X.ll = ll ; + +if max(abs(x-xs))>0 || max(abs(y-ys))>0 || max(abs(c-cs))>0 + 'problem with check_LL...' +end + +% if abs(ll-Y.ll)>1e-8 +if abs(det(X.WW) - 1/det(Y.invWW))>1e-8 + 'det(WW) is not right' +end + +order ; +order = full( sparse(order,1:numel(order),1:numel(order),numel(order),numel(order)) ) ; +order = max(full(order')) ; +[ll-Y.ll ll Y.ll] +[posX(order) posY(order) colors(order)] +[X.WW(order,order) ; inv(Y.invWW)] + +if abs(ll - Y.ll)>1e-8 + 'Y.ll is not right' +end \ No newline at end of file diff --git a/test/check_X.m b/test/check_X.m new file mode 100644 index 0000000..2286d98 --- /dev/null +++ b/test/check_X.m @@ -0,0 +1,86 @@ +function check_X( Y ) + +global cone_map + +X = Y ; +[x,y,c] = find( X.state ) ; + +% check X.contact +for d=1:4 + X.contact{d} = X.contact{d} * 0 ; + + for i=1:length(x) + X = make_contacts( X , [x(i) y(i) c(i)]) ; + end + + dX = find( xor( Y.contact{d} , X.contact{d}) ) ; + if dX + X.diff.added + X.diff.deleted + X.contact{d} + Y.contact{d} + dX + d + end +end + +% check that X.contact only concerns existing cones +for d=1:4 + cones = logical( max( max( X.contact{d} ,[],1) , max( X.contact{d} ,[],2)') ) ; + if ~min(X.state(cones)) + X.state + cones + end + if ~cones(X.state(:)>0) + cones + X.state + end +end + +% % check that ll is consistent % NEEDS cone_map TO BE GLOBAL +% if isfield(X,'contact') , X = rmfield(X,'contact') ; end +% X.N_cones = 0 ; +% X.invWW = [] ; +% X.state = 0 * X.state ; +% for k=1:length(x) +% X = flip_LL( X , [x(k) y(k) c(k)] , cone_map ) ; +% end +% +% if abs(X.ll - Y.ll)>1e-8 +% X.ll - Y.ll +% X.diff +% [x y c] +% 'll is off' +% end + +for i=1:length(x) +% X = make_contacts( X , x(i) , y(i) , X.id(x(i),y(i)) , LL ) ; +% check exclusion + [dummy,indices] = place_mask( X.M0 , X.M1 , x(i) , y(i) , X.masks{1,1}.exclusion ) ; + + overlap = find( X.state(indices)>0 , 1) ; + if ~isempty( overlap ) && indices(overlap) ~= x(i) + X.M0*(y(i)-1) + [x(i) y(i) c(i)] + end +end + + +% % check that localLL is consistent with LL(inds) +% [Xx,Xy,Xc] = find(Y.state) ; +% [x,y,v] = find(Y.id ) ; +% inds = Xx + Y.M0*(Xy-1) + Y.M0*Y.M1*(Xc-1) ; +% if ~isempty(find( Y.localLL(v) - LL(inds) , 1)) +% 'ha!' +% end + +% check if N_cones if consistent with id, state and taken_ids +% counts = [Y.N_cones numel(find(Y.id)) numel(find(Y.state)) ... +% numel(find(Y.taken_ids)) size(Y.invWW,1)] ; +counts = [numel(find(Y.state)) size(Y.invWW,1)] ; +if ~isempty(find(diff(counts))) + counts + 'N_cones is off' +end + + +end \ No newline at end of file diff --git a/timeline.m b/timeline.m new file mode 100644 index 0000000..5479ffd --- /dev/null +++ b/timeline.m @@ -0,0 +1,106 @@ +function timeline( greed , mcmc , cast, fast, total_spikes ) + +maxtime = max(greed.X.cputime) * 1.15 ; + +ll_fast = fast.ll ; +cpustart = fast.cputime(fast.N_cones) ; + +n = greed.X.iteration ; +start = find( greed.X.LL_history>ll_fast, 1 ) ; +gr = [greed.X.cputime(start:n)' ; greed.X.LL_history(start:n)' ; zeros(1,n-start+1) ; zeros(1,n-start+1)] ; + +mc = cell(numel(mcmc),1) ; +ca = cell(numel(cast),1) ; + +for i=1:numel(mcmc) + cputimes = reshift_cputime(mcmc{i}.X.cputime,fast) ; + n = mcmc{i}.X.iteration ; + cutoff = find(cputimes > maxtime,1) ; + if ~isempty(cutoff) + n = min( mcmc{i}.X.iteration, cutoff ) ; + end + start = find( mcmc{i}.X.LL_history>ll_fast, 1) ; + mc{i} = [cputimes(start:n) ; mcmc{i}.X.LL_history(start+(1:n-start+1))' ; zeros(1,n-start+1) ; zeros(1,n-start+1)] ; +end + +maxcast = 0 ; +for i=1:numel(cast) + if max(cast{i}.X.LL_history) > maxcast + index = find(cast{i}.X.LL_history >= max(cast{i}.X.LL_history),1) ; + cast{i}.X.cputime(index) + end + maxcast = max(maxcast,max(cast{i}.X.LL_history)) ; + n = find(cast{i}.X.cputime > maxtime,1) ; + cputimes = reshift_cputime(cast{i}.X.cputime,fast) ; + start = find( mcmc{i}.X.LL_history>ll_fast, 1) ; + ca{i} = [cputimes(start:n) ; cast{i}.X.LL_history(start+(1:n-start+1))' ; zeros(1,n-start+1) ; zeros(1,n-start+1)] ; +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +width = 230 ; +height = 100 ; + +xmax = max(gr(1,:)) ; +ymax = max(gr(2,:)) ; +for i=1:30 + xmax = max([xmax mc{i}(1,:)]) ; + xmax = max([xmax ca{i}(1,:)]) ; + ymax = max([ymax mc{i}(2,:)]) ; + ymax = max([ymax ca{i}(2,:)]) ; +end + +ymax = maxcast+100 ; + +maxcast_rescaled = height*(maxcast - ll_fast)/(ymax-ll_fast) ; +gr(3:4,:) = [width*gr(1,:)/(xmax) ; height*(gr(2,:) - ll_fast)/(ymax-ll_fast)] ; +for i=1:30 + mc{i}(3:4,:) = [width*mc{i}(1,:)/(xmax) ; height*(mc{i}(2,:) - ll_fast)/(ymax-ll_fast)] ; + ca{i}(3:4,:) = [width*ca{i}(1,:)/(xmax) ; height*(ca{i}(2,:) - ll_fast)/(ymax-ll_fast)] ; +end + +svg = [] ; +svg = [svg sprintf('<text x="-12" y="-3" fill="black" font-size="7" baseline-shift="-35%%" font-family="Helvetica">%.4f</text>\n', bits_per_spike( ll_fast, total_spikes))] ; +svg = [svg sprintf('<text x="%f" y="7" text-anchor="start" fill="black" font-size="7" baseline-shift="-35%%" font-family="Helvetica">%d sec.</text>\n', mc{1}(3,1), floor(cpustart))] ; +svg = [svg sprintf('<text x="%f" y="7" text-anchor="middle" fill="black" font-size="7" baseline-shift="-35%%" font-family="Helvetica">%d sec.</text>\n', gr(3,1), floor(gr(1,1)))] ; +svg = [svg sprintf('<text x="%f" y="%f" fill="black" font-size="7" baseline-shift="-35%%" font-family="Helvetica">%.4f</text>\n',mc{1}(3,1),-maxcast_rescaled,bits_per_spike( maxcast, total_spikes ))] ; +svg = [svg sprintf('<line x1="%f" x2="230" y1="%f" y2="%f" stroke-width="0.6" stroke="red" stroke-dasharray="9 5"/>\n',mc{1}(3,1)+25,-maxcast_rescaled,-maxcast_rescaled)] ; +svg = [svg sprintf('<circle r="1" cx="%f" cy="0" fill="green"/>\n',mc{1}(3,1))] ; +svg = [svg sprintf('<circle r="1" cx="%f" cy="%f" fill="black"/>\n',gr(3,1),-gr(4,1))] ; +svg = [svg sprintf('<circle r="1" cx="%f" cy="%f" fill="black"/>\n',gr(3,end),-gr(4,end))] ; + +for i=1:numel(mc) + svg = [svg plot_line(mc{i}(3,:),mc{i}(4,:),'<line x1="%f" x2="%f" y1="%f" y2="%f" stroke-width="0.3" stroke="blue"/>\n')] ; +end + +for i=1:numel(ca) + svg = [svg plot_line(ca{i}(3,:),ca{i}(4,:),'<line x1="%f" x2="%f" y1="%f" y2="%f" stroke-width="0.3" stroke="red"/>\n')] ; +end + +svg = [svg plot_line(gr(3,:),gr(4,:),'<line x1="%f" x2="%f" y1="%f" y2="%f" stroke-width="0.6" stroke="black"/>\n')] ; + +fid = fopen('timeline_stub.svg') ; +svg = sprintf(fread(fid,'*char'), svg) ; + +save_svg_plot(svg,sprintf('timeline__%s.svg','george')) + +end + +function cputimes = reshift_cputime(cputimes,fast) +m = fast.N_cones ; +cputimes = [fast.cputime(1:m)' cputimes(m+1:end)'-cputimes(m+1)+fast.cputime(m)] - fast.cputime(1) ; +end + +function svg = plot_line(x,y,pattern,points) +if nargin<4 + points = 30 ; +end +inds = 1:ceil(size(x,2)/points):size(x,2) ; +svg = [] ; +for j=1:length(inds)-1 +% svg = [svg sprintf('<use xlink:href="#g" transform="translate(%f %f)"/>\n', ... +% gr(3,j),gr(4,j))] ; +svg = [svg sprintf(pattern, ... + x(inds(j)),x(inds(j+1)),-y(inds(j)),-y(inds(j+1)))] ; +end +end \ No newline at end of file diff --git a/timeline_stub.svg b/timeline_stub.svg new file mode 100644 index 0000000..7dd0c6a --- /dev/null +++ b/timeline_stub.svg @@ -0,0 +1,30 @@ +<svg width="900" height="500" viewBox="0 0 900 500" + xmlns="http://www.w3.org/2000/svg" version="1.1" + xmlns:xlink="http://www.w3.org/1999/xlink"> + +<defs/> + +<text x="390" y="470" fill="black" font-size="34" baseline-shift="-35%%" font-family="Helvetica">cpu time</text> +<g transform="translate(50 300) rotate(-90)"> + <text fill="black" font-size="34" baseline-shift="-35%%" font-family="Helvetica">log-likelihood</text> +</g> +<g transform="translate(100 260) rotate(-90)"> + <text fill="black" font-size="26" baseline-shift="-35%%" font-family="Helvetica">(bits/spike)</text> +</g> + +<g transform="translate(90 410)scale(4 4)"> +%s +</g> + +<!-- <g transform="scale(2 2)" font-family="Helvetica"> + <g transform="translate(100 40)"> + + <use xlink:href="#tick"/> + <use xlink:href="#tick" transform="translate(0 200)"/> + <use xlink:href="#tick" transform="translate(0 200)rotate(-90)"/> + <use xlink:href="#tick" transform="translate(200 200)rotate(-90)"/> + + </g> +</g>--> + +</svg> \ No newline at end of file diff --git a/transitive_closure.m b/transitive_closure.m new file mode 100644 index 0000000..357a6f6 --- /dev/null +++ b/transitive_closure.m @@ -0,0 +1,36 @@ +function R = transitive_closure( R , inds , sym) +% Calculate transitive closure of a binary relation +% represented by boolean matrix R. +% inds is a list of indices which are known to be necessary for this +% calculation. 2 cases: +% - transitive_closure is being called for the first time, inds should be +% the indices of rows and columns where R has at least one true entry. +% - transitive_closure has already been called, and the only modification +% to R has been to add some entries, then inds need only be the indices of +% those entries. + +% global tct + +% tic + +% non-symmetric relation +if nargin<3 || ~sym + for k=inds(:)' + R( R(:,k) , R(k,:) ) = true ; + end + +% symmetric relation +else + for k=inds(:)' + i = R(:,k) ; +% if ~isempty(find(i,1)) + R( i , i ) = true ; +% end + end + +end + +% tct(numel(inds),1) = tct(numel(inds),1) + toc ; +% tct(numel(inds),2) = tct(numel(inds),2) + 1 ; + +end \ No newline at end of file diff --git a/update_X.m b/update_X.m new file mode 100644 index 0000000..e12106e --- /dev/null +++ b/update_X.m @@ -0,0 +1,97 @@ +function X = update_X(trials,i,track_contacts) +% X = update_X(trials,[i,track_contacts]) +% choose trials{i} as next X +% update X based on changes since last iteration recorded in X.diff +% update X.contact if track_contacts is true +% record X.LL_history, X.N_cones_history, X.cputime if they exist + +% by default, i = 1 which means the empty move was chosen +if nargin<2 , i = 1 ; end + +% default is to track contacts +if nargin<3 , track_contacts=true ; end + +% choose trials{i} as next X +X = trials{i} ; +if i>1 , X.version = trials{1}.version+1 ; end + +% update iteration number +if ~isfield(X,'iteration') , X.iteration = 0 ; end +X.iteration = X.iteration+1 ; + +% all other proposed moves can be discarded +clear trials + + +%% track all changes if dX exists (used to replay CAST runs later) +if isfield(X,'dX') + if i>1 + diffX = X.diff' ; + X.dX(X.iteration,1:numel(diffX)) = diffX(:)' ; + else + X.dX(X.iteration,1) = 0 ; + end +end + +%% update data structures used by greedy, MCMC and CAST +if ~isempty(X.diff) + deleted = find( ~X.diff(:,3) ) ; + if ~isempty(deleted) + %% update excluded (used by all algorithms) + for ii=1:numel(deleted) + [~,indices] = not_excluded( X, X.diff(deleted(ii),1), X.diff(deleted(ii),2) ) ; + X.excluded(indices) = false ; + end + + %% update contacts (used by MCMC and CAST for shift moves) + if track_contacts && isfield(X,'contact') + + deleted = X.diff(deleted,1) + (X.diff(deleted,2)-1)*X.M0 ; + for d=1:2 + X.contact{d}(deleted,:) = false ; + X.contact{d}(:,deleted) = false ; + end + end + end + + added = find( X.diff(:,3) ) ; + for ii=1:numel(added) + %% update contacts (used by MCMC and CAST for shift moves) + if track_contacts && isfield(X,'contact') + X = make_contacts(X , X.diff(added(ii),:)) ; + end + %% update excluded (used by all algorithms) + [~,indices] = not_excluded( X, X.diff(added(ii),1), X.diff(added(ii),2) ) ; + X.excluded(indices) = true ; + end +end + + +%% record LL_history if field exists +if isfield(X,'LL_history') + if X.iteration>length(X.LL_history) + X.LL_history = [X.LL_history ; zeros(numel(X.LL_history)+500,1)] ; + end + X.LL_history(X.iteration) = X.ll ; +end + +%% record N_cones_history if field exists +if isfield(X,'N_cones_history') + if X.iteration>length(X.N_cones_history) + X.N_cones_history = [X.N_cones_history ; zeros(numel(X.N_cones_history)+500,1)] ; + end + X.N_cones_history(X.iteration) = X.N_cones ; +end + +%% record cputime if field exists +if isfield(X,'cputime') + if X.iteration>numel(X.cputime) + X.cputime = [X.cputime ; zeros(numel(X.cputime)+500,1)] ; + end + X.cputime(X.iteration) = cputime ; +end + +%% reset changes since last update to empty change set +X.diff = [] ; + +end \ No newline at end of file diff --git a/weights.m b/weights.m new file mode 100644 index 0000000..006704b --- /dev/null +++ b/weights.m @@ -0,0 +1,60 @@ +function [m,C,scaling,X] = weights( x , PROB ) +% Get mean m and covariance of weights between cones and ganglion cells +% Weights between a cone and different ganglion cells are independent. +% The covariance matrix between cone weights is the same for every ganglion +% cell, up to a scaling factor: the covariance between cones i and j for +% ganglion cell g is given by C(i,j)*scaling(g). +% +% INPUT: +% x either a 2D matrix with 0,1,2 or 3 in each entry +% where 0 is no cone, 1 = red, 2=green, 3=blue +% or a set of incremental moves, specified by an N-by-3 +% matrix of the form [x y c], where the x column contains x +% coordinates of cones, the y column contains y coordinates, +% and c contains colors (1,2 or 3). +% +% PROB struct containing problem specification. +% returned by exact_LL_setup.m and cones.m +% required fields: +% - M0 +% - M1 +% - SS +% - coneConv +% - colorDot +% - STA_W +% - sumLconst +% - maxcones +% - N_colors +% - D + +M0 = cone_map.M0 * cone_map.cone_params.supersample ; +M1 = cone_map.M1 * cone_map.cone_params.supersample ; + +% if an X structure is given instead of a x, +% extract the x first +if isstruct(x) && isfield(x,'state') + x = x.state ; +end + +% if a set of moves was given instead of a x +% then calculate x from moves +if max(x(:)) > 3 + x=increment_state(x,zeros(M0,M1) ) ; +end + +[x,y,c] = find(x) ; + +dX = [x y c] ; + +X = initialize_X( PROB.M0, PROB.M1, PROB.N_colors, PROB.SS, PROB.D, PROB.naive_LL, 1 ) ; + +X = flip_LL( X , dX , PROB ) ; + +STA_W_state = PROB.STA_W( x+M0*(y-1)+M0*M1*(c-1) , : ) ; + + +m = X.invWW * STA_W_state ; +C = inv( X.invWW ) ; +scaling = 1 ./ PROB.cell_consts ; + +end \ No newline at end of file
beepscore/GalleryDesktopService
fbc6884d6c00b8695379344b4bd809a41b5b0118
Add autorelease pool. Without pool, if iPhone client quits during send, console logs
diff --git a/ApplicationController.m b/ApplicationController.m index 8f81c52..94d0edc 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,442 +1,442 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; @synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"russianRocket" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ setDelegate:self]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal (16 bit) if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender -{ +{ // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); [self.progressIndicator startAnimation:self]; // send NSImage [imageShareService_ sendImageToClients:image]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model NSLog(@"number of images in the model = %d", [images_ count]); NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { [self sendImage:self]; } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } #pragma mark - #pragma mark ImageShareServiceDelegate // Implement ImageShareService's formal protocol ImageShareServiceDelegate // when the asynchronous send completes, imageShareService calls back to its delegate - (void)imageShareServiceDidSend:(ImageShareService*)imageShareService { [self.progressIndicator stopAnimation:self]; } @end diff --git a/ImageShareService.m b/ImageShareService.m index e34c18b..bf128f0 100644 --- a/ImageShareService.m +++ b/ImageShareService.m @@ -1,434 +1,439 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and advertises its service via Bonjour // Sends an image to the connected clients #import "ImageShareService.h" #import "ApplicationController.h" #import <sys/socket.h> #import <netinet/in.h> NSString* const kServiceTypeString = @"_uwcelistener._tcp."; NSString* const kServiceNameString = @"Images"; const int kListenPort = 8082; NSString* const kConnectionKey = @"connectionKey"; NSString* const kImageSizeKey = @"imageSize"; NSString* const kRepresentationToSendKey = @"representationToSend"; @interface ImageShareService () - (void) parseDataRecieved:(NSMutableData*)dataSoFar; - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle; - (void) handleMessage:(NSString*)messageString; @end @implementation ImageShareService #pragma mark properties @synthesize delegate; - (id) init { self = [super init]; if (self != nil) { appController_ = [ApplicationController sharedApplicationController]; socket_ = nil; connectionFileHandle_ = nil; dataForFileHandles_ = [[NSMutableDictionary dictionary] retain]; connectedFileHandles_ = [[NSMutableArray array] retain]; } return self; } - (void) dealloc { [dataForFileHandles_ release]; dataForFileHandles_ = nil; for (NSFileHandle* connection in connectedFileHandles_) { [connection closeFile]; } [connectedFileHandles_ release]; connectedFileHandles_ = nil; // a delegator doesn't retain it's delegate, and so it doesn't release it delegate = nil; [super dealloc]; } - (BOOL) startService { socket_ = CFSocketCreate ( kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL ); // Create a network socket for streaming TCP if (!socket_) { [appController_ appendStringToLog:@"Cound not create socket"]; return NO; } int reuse = true; int fileDescriptor = CFSocketGetNative(socket_); // Make sure socket is set for reuse of the address // without this, you may find that the socket is already in use // when restarting and debugging int result = setsockopt( fileDescriptor, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(int) ); if ( result != 0) { [appController_ appendStringToLog:@"Unable to set socket options"]; return NO; } // Create the address for the socket. // In this case we don't care what address is incoming // but we listen on a specific port - kListenPort struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(kListenPort); CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); [(id)addressData autorelease]; // bind socket to the address if (CFSocketSetAddress(socket_, addressData) != kCFSocketSuccess) { [appController_ appendStringToLog:@"Unable to bind socket to address"]; return NO; } // setup listening to incoming connections // we will use notifications to respond // as we are not looking for high performance and want // to use the simpiler Cocoa NSFileHandle APIs connectionFileHandle_ = [[NSFileHandle alloc] initWithFileDescriptor:fileDescriptor closeOnDealloc:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIncomingConnection:) name:NSFileHandleConnectionAcceptedNotification object:nil]; [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; NSString* logString = [NSString stringWithFormat:@"listening to socket on port %d", kListenPort]; [appController_ appendStringToLog:logString]; return YES; } - (void) publishService { // Create a name for the service that includes this computer's name CFStringRef computerName = CSCopyMachineName(); NSString* serviceNameString = [NSString stringWithFormat:@"%@'s %@", (NSString*)computerName, kServiceNameString]; CFRelease(computerName); NSNetService* netService = [[NSNetService alloc] initWithDomain:@"" type:kServiceTypeString name:serviceNameString port:kListenPort]; // publish on the default domains [netService setDelegate:self]; [netService publish]; // NOTE : We are not handling any failure to publish cases // which is not a good idea. We should at least // Be checking for name collisions NSString* logString = [NSString stringWithFormat:@"published service type:%@ with name %@ on port %d", kServiceTypeString, kServiceNameString, kListenPort]; [appController_ appendStringToLog:logString]; } #pragma mark - #pragma mark Receiving -(void) handleIncomingConnection:(NSNotification*)notification { NSDictionary* userInfo = [notification userInfo]; NSFileHandle* connectedFileHandle = [userInfo objectForKey:NSFileHandleNotificationFileHandleItem]; if(connectedFileHandle) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readIncomingData:) name:NSFileHandleDataAvailableNotification object:connectedFileHandle]; [connectedFileHandles_ addObject:connectedFileHandle]; [appController_ appendStringToLog:@"Opened an incoming connection"]; [connectedFileHandle waitForDataInBackgroundAndNotify]; } [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; } - (void) readIncomingData:(NSNotification*) notification { NSFileHandle* readFileHandle = [notification object]; // suggestion from Sean Quinlan // the catch block ensures readIncomingData will call stopReceivingForFileHandle before it exits NSData* newData = nil; @try { newData = [readFileHandle availableData]; } // @catch could return type NSException* instead of type id @catch (id e) { // log error NSLog(@"Error in readIncomingData:"); } NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; if ([newData length] == 0) { [appController_ appendStringToLog:@"No more data in file handle, closing"]; [self stopReceivingForFileHandle:readFileHandle closeFileHandle:YES]; return; } [appController_ appendStringToLog:@"Got a new message :"]; [appController_ appendStringToLog:[NSString stringWithUTF8String:[newData bytes]]]; // append the data to the data we have so far [dataSoFar appendData:newData]; [self parseDataRecieved:dataSoFar]; // wait for a read again [readFileHandle waitForDataInBackgroundAndNotify]; } - (void) parseDataRecieved:(NSMutableData*)dataSoFar { // Look for a token that indicates a complete message // and act on the message. Remove the message from the data so far // Currently our token is the null terminator 0x00 char token = 0x00; NSRange result = [dataSoFar rangeOfData:[NSData dataWithBytes:&token length:1] options:0 range:NSMakeRange(0, [dataSoFar length])]; if ( result.location != NSNotFound ) { NSData* messageData = [dataSoFar subdataWithRange:NSMakeRange(0, result.location+1)]; NSString* messageString = [NSString stringWithUTF8String:[messageData bytes]]; // act on the message NSLog(@"parsed message : %@", messageString); [self handleMessage:messageString]; // trim the message we have handled off the data received NSUInteger location = result.location + 1; NSUInteger length = [dataSoFar length] - [messageData length]; [dataSoFar setData:[dataSoFar subdataWithRange:NSMakeRange(location, length)]]; } } - (void) handleMessage:(NSString*)messageString { // Not reacting to any sent messages for now } - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle { NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data == nil ) { data = [NSMutableData data]; [dataForFileHandles_ setObject:data forKey:fileHandle]; } return data; } - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close { if (close) { [fileHandle closeFile]; [connectedFileHandles_ removeObject:fileHandle]; } NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data != nil ) { [dataForFileHandles_ removeObjectForKey:fileHandle]; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleDataAvailableNotification object:fileHandle]; } #pragma mark - #pragma mark Sending - (void)sendWithDictionary:(NSMutableDictionary*)sendArgumentsDictionary { + // Add autorelease pool. + // Without autorelease pool, if iPhone client quits during send, console logs + // "_NSCallStackArray autoreleased with no pool in place - just leaking" + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + // sendWithDictionary: has one parameter, a dictionary. // This way, sendWithDictionary: can be called from performSelectorInBackground:withObject: // The dictionary object contains multiple objects as "arguments" for use by the method NSFileHandle* connection = [sendArgumentsDictionary objectForKey:kConnectionKey]; NSData* imageSize = [sendArgumentsDictionary objectForKey:kImageSizeKey]; NSData* representationToSend = [sendArgumentsDictionary objectForKey:kRepresentationToSendKey]; - - // TODO: Add autorelease pool. - // If iPhone client quits during send, console logs - // _NSCallStackArray autoreleased with no pool in place - just leaking - + // suggestion from Sean Quinlan // if we lose a connection and have a "bad socket", these catch blocks around writeData // allows the server to write to other valid connections. @try { [connection writeData:imageSize]; } // @catch could return type NSException* instead of type id @catch (id e) { // log error NSLog(@"Error in sendWithDictionary: sending image size."); } @try { [connection writeData:representationToSend]; } @catch (id e) { // log error NSLog(@"Error in sendWithDictionary: sending image."); } // Notify delegate the send is complete // The delegate controls the view. // View related methods are not thread safe and must be performed on the main thread. [self.delegate performSelectorOnMainThread:@selector(imageShareServiceDidSend:) withObject:self waitUntilDone:NO]; + + // http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/drain + [pool drain]; } - (void) sendImageToClients:(NSImage*)image { + NSUInteger clientCount = [connectedFileHandles_ count]; if( clientCount <= 0 ) { [appController_ appendStringToLog:@"No clients connected, not sending"]; return; } NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; // NOTE : this will only work when the image has a bitmap representation of some type // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep // and then representationUsingType will fail // To do this better we could draw the image into an offscreen context // then save that context in a format like PNG // There are some downsides to this though, because for instance a jpeg will recompress // so you would want to use a rep when you have it and if not, create one. // NOTE 2: We could try to just send the file as data rather than // an NSImage. The problem is the iPhone doesn't support as many // image formats as the desktop. The translation to PNG insures // something the iPhone can display // The first thing we send is 4 bytes that represent the length of // of the image so that the client will know when a full image has // transfered NSUInteger imageDataSize = [representationToSend length]; // the length method returns an NSUInteger, which happens to be 64 bits // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits // we are simply going to not send anything that is so big that it // length is > 2^32, which should be fine considering the iPhone client // could not handle images that large anyway if ( imageDataSize > UINT32_MAX ) { [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; return; } // We also have to be careful and make sure that the bytes are in the proper order // when sent over the network using htonl() uint32 dataLength = htonl( (uint32)imageDataSize ); NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; for ( NSFileHandle* connection in connectedFileHandles_) { // make a dictionary for sendWithDictionary: NSMutableDictionary* sendArgumentsDictionary = [[NSMutableDictionary alloc] initWithObjectsAndKeys:connection, kConnectionKey, imageSize, kImageSizeKey, representationToSend, kRepresentationToSendKey, nil]; // send asynchronously to avoid locking up UI // Thanks to suggestions from Greg Anderson and Pam DeBriere // including using performSelectorInBackground:withObject: to create a new thread [self performSelectorInBackground:@selector(sendWithDictionary:) withObject:sendArgumentsDictionary]; [sendArgumentsDictionary release]; } - [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; + [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; } @end
beepscore/GalleryDesktopService
40aa20dad3ccd78b826e24b7f3f630d8b0ca5d52
Add try-catch blocks to handle async send and recieve errors instead of crashing.
diff --git a/ApplicationController.m b/ApplicationController.m index b3ed0fe..8f81c52 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,448 +1,442 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; @synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"russianRocket" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ setDelegate:self]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal (16 bit) if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); - // in IB, set progressIndicator to display when stopped. - // usually the send completes quickly, especially when sending to the simulator. - // if the progressIndicator is not set to display when stopped, - // the send may complete before the progressIndicator and animation appear. - // can test a "display when stopped" progressIndicator by attempting to send a pdf file, - // which isn't supported and so takes forever [self.progressIndicator startAnimation:self]; // send NSImage [imageShareService_ sendImageToClients:image]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model NSLog(@"number of images in the model = %d", [images_ count]); NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { [self sendImage:self]; } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } #pragma mark - #pragma mark ImageShareServiceDelegate // Implement ImageShareService's formal protocol ImageShareServiceDelegate // when the asynchronous send completes, imageShareService calls back to its delegate - (void)imageShareServiceDidSend:(ImageShareService*)imageShareService { [self.progressIndicator stopAnimation:self]; } @end diff --git a/ImageShareService.m b/ImageShareService.m index 62ffe30..e34c18b 100644 --- a/ImageShareService.m +++ b/ImageShareService.m @@ -1,407 +1,434 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and advertises its service via Bonjour // Sends an image to the connected clients #import "ImageShareService.h" #import "ApplicationController.h" #import <sys/socket.h> #import <netinet/in.h> NSString* const kServiceTypeString = @"_uwcelistener._tcp."; NSString* const kServiceNameString = @"Images"; const int kListenPort = 8082; NSString* const kConnectionKey = @"connectionKey"; NSString* const kImageSizeKey = @"imageSize"; NSString* const kRepresentationToSendKey = @"representationToSend"; @interface ImageShareService () - (void) parseDataRecieved:(NSMutableData*)dataSoFar; - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle; - (void) handleMessage:(NSString*)messageString; @end @implementation ImageShareService #pragma mark properties @synthesize delegate; - (id) init { self = [super init]; if (self != nil) { appController_ = [ApplicationController sharedApplicationController]; socket_ = nil; connectionFileHandle_ = nil; dataForFileHandles_ = [[NSMutableDictionary dictionary] retain]; connectedFileHandles_ = [[NSMutableArray array] retain]; } return self; } - (void) dealloc { [dataForFileHandles_ release]; dataForFileHandles_ = nil; for (NSFileHandle* connection in connectedFileHandles_) { [connection closeFile]; } [connectedFileHandles_ release]; connectedFileHandles_ = nil; // a delegator doesn't retain it's delegate, and so it doesn't release it delegate = nil; [super dealloc]; } - (BOOL) startService { socket_ = CFSocketCreate ( kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL ); // Create a network socket for streaming TCP if (!socket_) { [appController_ appendStringToLog:@"Cound not create socket"]; return NO; } int reuse = true; int fileDescriptor = CFSocketGetNative(socket_); // Make sure socket is set for reuse of the address // without this, you may find that the socket is already in use - // when restartnig and debugging + // when restarting and debugging int result = setsockopt( fileDescriptor, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(int) ); - - + if ( result != 0) { [appController_ appendStringToLog:@"Unable to set socket options"]; return NO; } - // Create the address for the scoket. + // Create the address for the socket. // In this case we don't care what address is incoming - // but we listen on a specific port - kLisenPort + // but we listen on a specific port - kListenPort struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(kListenPort); CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); [(id)addressData autorelease]; // bind socket to the address if (CFSocketSetAddress(socket_, addressData) != kCFSocketSuccess) { [appController_ appendStringToLog:@"Unable to bind socket to address"]; return NO; } // setup listening to incoming connections // we will use notifications to respond // as we are not looking for high performance and want // to use the simpiler Cocoa NSFileHandle APIs connectionFileHandle_ = [[NSFileHandle alloc] initWithFileDescriptor:fileDescriptor closeOnDealloc:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIncomingConnection:) name:NSFileHandleConnectionAcceptedNotification object:nil]; [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; NSString* logString = [NSString stringWithFormat:@"listening to socket on port %d", kListenPort]; [appController_ appendStringToLog:logString]; return YES; } - (void) publishService { - // Create a name for the service that include's this computer's name + // Create a name for the service that includes this computer's name CFStringRef computerName = CSCopyMachineName(); NSString* serviceNameString = [NSString stringWithFormat:@"%@'s %@", (NSString*)computerName, kServiceNameString]; CFRelease(computerName); NSNetService* netService = [[NSNetService alloc] initWithDomain:@"" type:kServiceTypeString name:serviceNameString port:kListenPort]; - // publish on the default domains - + // publish on the default domains [netService setDelegate:self]; [netService publish]; // NOTE : We are not handling any failure to publish cases // which is not a good idea. We should at least // Be checking for name collisions NSString* logString = [NSString stringWithFormat:@"published service type:%@ with name %@ on port %d", kServiceTypeString, kServiceNameString, kListenPort]; [appController_ appendStringToLog:logString]; } #pragma mark - #pragma mark Receiving -(void) handleIncomingConnection:(NSNotification*)notification { NSDictionary* userInfo = [notification userInfo]; NSFileHandle* connectedFileHandle = [userInfo objectForKey:NSFileHandleNotificationFileHandleItem]; if(connectedFileHandle) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readIncomingData:) name:NSFileHandleDataAvailableNotification object:connectedFileHandle]; [connectedFileHandles_ addObject:connectedFileHandle]; [appController_ appendStringToLog:@"Opened an incoming connection"]; [connectedFileHandle waitForDataInBackgroundAndNotify]; } [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; } - (void) readIncomingData:(NSNotification*) notification { NSFileHandle* readFileHandle = [notification object]; - NSData* newData = [readFileHandle availableData]; - - NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; + + // suggestion from Sean Quinlan + // the catch block ensures readIncomingData will call stopReceivingForFileHandle before it exits + NSData* newData = nil; + @try { + newData = [readFileHandle availableData]; + } + // @catch could return type NSException* instead of type id + @catch (id e) { + // log error + NSLog(@"Error in readIncomingData:"); + } + + NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; if ([newData length] == 0) { [appController_ appendStringToLog:@"No more data in file handle, closing"]; [self stopReceivingForFileHandle:readFileHandle closeFileHandle:YES]; return; } [appController_ appendStringToLog:@"Got a new message :"]; [appController_ appendStringToLog:[NSString stringWithUTF8String:[newData bytes]]]; // append the data to the data we have so far [dataSoFar appendData:newData]; [self parseDataRecieved:dataSoFar]; // wait for a read again [readFileHandle waitForDataInBackgroundAndNotify]; } - (void) parseDataRecieved:(NSMutableData*)dataSoFar { // Look for a token that indicates a complete message // and act on the message. Remove the message from the data so far // Currently our token is the null terminator 0x00 char token = 0x00; NSRange result = [dataSoFar rangeOfData:[NSData dataWithBytes:&token length:1] options:0 range:NSMakeRange(0, [dataSoFar length])]; if ( result.location != NSNotFound ) { NSData* messageData = [dataSoFar subdataWithRange:NSMakeRange(0, result.location+1)]; NSString* messageString = [NSString stringWithUTF8String:[messageData bytes]]; // act on the message NSLog(@"parsed message : %@", messageString); [self handleMessage:messageString]; // trim the message we have handled off the data received NSUInteger location = result.location + 1; NSUInteger length = [dataSoFar length] - [messageData length]; [dataSoFar setData:[dataSoFar subdataWithRange:NSMakeRange(location, length)]]; } } - (void) handleMessage:(NSString*)messageString { // Not reacting to any sent messages for now } - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle { NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data == nil ) { data = [NSMutableData data]; [dataForFileHandles_ setObject:data forKey:fileHandle]; } return data; } - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close { if (close) { [fileHandle closeFile]; [connectedFileHandles_ removeObject:fileHandle]; } NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data != nil ) { [dataForFileHandles_ removeObjectForKey:fileHandle]; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleDataAvailableNotification object:fileHandle]; } #pragma mark - #pragma mark Sending - (void)sendWithDictionary:(NSMutableDictionary*)sendArgumentsDictionary { // sendWithDictionary: has one parameter, a dictionary. // This way, sendWithDictionary: can be called from performSelectorInBackground:withObject: // The dictionary object contains multiple objects as "arguments" for use by the method NSFileHandle* connection = [sendArgumentsDictionary objectForKey:kConnectionKey]; NSData* imageSize = [sendArgumentsDictionary objectForKey:kImageSizeKey]; NSData* representationToSend = [sendArgumentsDictionary objectForKey:kRepresentationToSendKey]; - [connection writeData:imageSize]; - [connection writeData:representationToSend]; + // TODO: Add autorelease pool. + // If iPhone client quits during send, console logs + // _NSCallStackArray autoreleased with no pool in place - just leaking + + // suggestion from Sean Quinlan + // if we lose a connection and have a "bad socket", these catch blocks around writeData + // allows the server to write to other valid connections. + @try { + [connection writeData:imageSize]; + } + // @catch could return type NSException* instead of type id + @catch (id e) { + // log error + NSLog(@"Error in sendWithDictionary: sending image size."); + } + @try { + [connection writeData:representationToSend]; + } + @catch (id e) { + // log error + NSLog(@"Error in sendWithDictionary: sending image."); + } + // Notify delegate the send is complete // The delegate controls the view. // View related methods are not thread safe and must be performed on the main thread. [self.delegate performSelectorOnMainThread:@selector(imageShareServiceDidSend:) withObject:self waitUntilDone:NO]; } - (void) sendImageToClients:(NSImage*)image { NSUInteger clientCount = [connectedFileHandles_ count]; if( clientCount <= 0 ) { [appController_ appendStringToLog:@"No clients connected, not sending"]; return; } NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; // NOTE : this will only work when the image has a bitmap representation of some type // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep // and then representationUsingType will fail // To do this better we could draw the image into an offscreen context // then save that context in a format like PNG // There are some downsides to this though, because for instance a jpeg will recompress // so you would want to use a rep when you have it and if not, create one. // NOTE 2: We could try to just send the file as data rather than // an NSImage. The problem is the iPhone doesn't support as many // image formats as the desktop. The translation to PNG insures // something the iPhone can display // The first thing we send is 4 bytes that represent the length of // of the image so that the client will know when a full image has // transfered NSUInteger imageDataSize = [representationToSend length]; // the length method returns an NSUInteger, which happens to be 64 bits // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits // we are simply going to not send anything that is so big that it // length is > 2^32, which should be fine considering the iPhone client // could not handle images that large anyway if ( imageDataSize > UINT32_MAX ) { [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; return; } // We also have to be careful and make sure that the bytes are in the proper order // when sent over the network using htonl() uint32 dataLength = htonl( (uint32)imageDataSize ); NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; for ( NSFileHandle* connection in connectedFileHandles_) { // make a dictionary for sendWithDictionary: NSMutableDictionary* sendArgumentsDictionary = [[NSMutableDictionary alloc] initWithObjectsAndKeys:connection, kConnectionKey, imageSize, kImageSizeKey, representationToSend, kRepresentationToSendKey, nil]; // send asynchronously to avoid locking up UI // Thanks to suggestions from Greg Anderson and Pam DeBriere // including using performSelectorInBackground:withObject: to create a new thread - - // Note: if iPhone client is stopped during send, application throws exception - // Currently exception is not handled and stops program execution [self performSelectorInBackground:@selector(sendWithDictionary:) withObject:sendArgumentsDictionary]; [sendArgumentsDictionary release]; } [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; } @end
beepscore/GalleryDesktopService
1b78ea806ad020047c5b92d88898681a644cc5e9
In imageBrowser:cellWasDoubleClickedAtIndex: send image.
diff --git a/ApplicationController.m b/ApplicationController.m index 37ab7a5..b3ed0fe 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,452 +1,448 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; @synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"russianRocket" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ setDelegate:self]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal (16 bit) if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // in IB, set progressIndicator to display when stopped. // usually the send completes quickly, especially when sending to the simulator. // if the progressIndicator is not set to display when stopped, // the send may complete before the progressIndicator and animation appear. // can test a "display when stopped" progressIndicator by attempting to send a pdf file, // which isn't supported and so takes forever [self.progressIndicator startAnimation:self]; // send NSImage [imageShareService_ sendImageToClients:image]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model NSLog(@"number of images in the model = %d", [images_ count]); NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { - // HW_TODO : - // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE - // INSTEAD OF THE DEFAULT TO OPEN - + [self sendImage:self]; } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } #pragma mark - #pragma mark ImageShareServiceDelegate // Implement ImageShareService's formal protocol ImageShareServiceDelegate // when the asynchronous send completes, imageShareService calls back to its delegate - (void)imageShareServiceDidSend:(ImageShareService*)imageShareService { [self.progressIndicator stopAnimation:self]; } @end diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 2d7a294..ad00332 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1,536 +1,536 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> <string key="IBDocument.SystemVersion">10D573</string> <string key="IBDocument.InterfaceBuilderVersion">762</string> <string key="IBDocument.AppKitVersion">1038.29</string> <string key="IBDocument.HIToolboxVersion">460.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.imagekit.ibplugin</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>762</string> <string>1.1</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="372"/> + <integer value="622"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="1021"> <string key="NSClassName">NSApplication</string> </object> <object class="NSCustomObject" id="1014"> <string key="NSClassName">FirstResponder</string> </object> <object class="NSCustomObject" id="1050"> <string key="NSClassName">NSApplication</string> </object> <object class="NSMenu" id="649796088"> <string key="NSTitle">AMainMenu</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="694149608"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">GalleryDesktopService</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <object class="NSCustomResource" key="NSOnImage" id="35465992"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSMenuCheckmark</string> </object> <object class="NSCustomResource" key="NSMixedImage" id="502551668"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSMenuMixedState</string> </object> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="110575045"> <string key="NSTitle">GalleryDesktopService</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="238522557"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">About GalleryDesktopService</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="304266470"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="609285721"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Preferences…</string> <string key="NSKeyEquiv">,</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="481834944"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1046388886"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Services</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="752062318"> <string key="NSTitle">Services</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <string key="NSName">_NSServicesMenu</string> </object> </object> <object class="NSMenuItem" id="646227648"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="755159360"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Hide GalleryDesktopService</string> <string key="NSKeyEquiv">h</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="342932134"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Hide Others</string> <string key="NSKeyEquiv">h</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="908899353"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Show All</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1056857174"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="632727374"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Quit GalleryDesktopService</string> <string key="NSKeyEquiv">q</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSAppleMenu</string> </object> </object> <object class="NSMenuItem" id="379814623"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">File</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="720053764"> <string key="NSTitle">File</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="705341025"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">New</string> <string key="NSKeyEquiv">n</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="722745758"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Open…</string> <string key="NSKeyEquiv">o</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1025936716"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Open Recent</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="1065607017"> <string key="NSTitle">Open Recent</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="759406840"> <reference key="NSMenu" ref="1065607017"/> <string key="NSTitle">Clear Menu</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSRecentDocumentsMenu</string> </object> </object> <object class="NSMenuItem" id="425164168"> <reference key="NSMenu" ref="720053764"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="776162233"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Close</string> <string key="NSKeyEquiv">w</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1023925487"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Save</string> <string key="NSKeyEquiv">s</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="117038363"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Save As…</string> <string key="NSKeyEquiv">S</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="579971712"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Revert to Saved</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1010469920"> <reference key="NSMenu" ref="720053764"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="294629803"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Page Setup...</string> <string key="NSKeyEquiv">P</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSToolTip"/> </object> <object class="NSMenuItem" id="49223823"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Print…</string> <string key="NSKeyEquiv">p</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="952259628"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Edit</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="789758025"> <string key="NSTitle">Edit</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1058277027"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Undo</string> <string key="NSKeyEquiv">z</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="790794224"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Redo</string> <string key="NSKeyEquiv">Z</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1040322652"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="296257095"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Cut</string> <string key="NSKeyEquiv">x</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="860595796"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Copy</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="29853731"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Paste</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="82994268"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Paste and Match Style</string> <string key="NSKeyEquiv">V</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="437104165"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Delete</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="583158037"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Select All</string> <string key="NSKeyEquiv">a</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="212016141"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="892235320"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Find</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="963351320"> <string key="NSTitle">Find</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="447796847"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find…</string> <string key="NSKeyEquiv">f</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">1</int> </object> <object class="NSMenuItem" id="326711663"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find Next</string> <string key="NSKeyEquiv">g</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">2</int> </object> <object class="NSMenuItem" id="270902937"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find Previous</string> <string key="NSKeyEquiv">G</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">3</int> </object> <object class="NSMenuItem" id="159080638"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Use Selection for Find</string> <string key="NSKeyEquiv">e</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">7</int> </object> <object class="NSMenuItem" id="88285865"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Jump to Selection</string> <string key="NSKeyEquiv">j</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="972420730"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Spelling and Grammar</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="769623530"> <string key="NSTitle">Spelling and Grammar</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="679648819"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Show Spelling and Grammar</string> <string key="NSKeyEquiv">:</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="96193923"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Check Document Now</string> <string key="NSKeyEquiv">;</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="859480356"> <reference key="NSMenu" ref="769623530"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> @@ -1073,1025 +1073,1025 @@ <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="31516759"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Writing Direction</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="956096989"> <string key="NSTitle">Writing Direction</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="257099033"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Paragraph</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="551969625"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="249532473"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="607364498"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="508151438"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="981751889"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Selection</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="380031999"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="825984362"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="560145579"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="908105787"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="644046920"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Show Ruler</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="231811626"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Copy Ruler</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="883618387"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Paste Ruler</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> </object> </object> </object> <object class="NSMenuItem" id="586577488"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">View</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="466310130"> <string key="NSTitle">View</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="102151532"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Show Toolbar</string> <string key="NSKeyEquiv">t</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="237841660"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Customize Toolbar…</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="713487014"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Window</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="835318025"> <string key="NSTitle">Window</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1011231497"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Minimize</string> <string key="NSKeyEquiv">m</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="575023229"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Zoom</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="299356726"> <reference key="NSMenu" ref="835318025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="625202149"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Bring All to Front</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSWindowsMenu</string> </object> </object> <object class="NSMenuItem" id="448692316"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Help</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="992780483"> <string key="NSTitle">Help</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="105068016"> <reference key="NSMenu" ref="992780483"/> <string key="NSTitle">DesktopService Help</string> <string key="NSKeyEquiv">?</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSHelpMenu</string> </object> </object> </object> <string key="NSName">_NSMainMenu</string> </object> <object class="NSWindowTemplate" id="972006081"> <int key="NSWindowStyleMask">15</int> <int key="NSWindowBacking">2</int> <string key="NSWindowRect">{{335, 81}, {1011, 669}}</string> <int key="NSWTFlags">1954021376</int> <string key="NSWindowTitle">GalleryDesktopService</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <string key="NSWindowContentMinSize">{720, 480}</string> <object class="NSView" key="NSWindowView" id="439893737"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextField" id="542196890"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 414}, {38, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="959611778"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Log</string> <object class="NSFont" key="NSSupport" id="1000618677"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="542196890"/> <object class="NSColor" key="NSBackgroundColor" id="760086907"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor" id="104511740"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> </object> </object> <object class="NSColor" key="NSTextColor" id="178691194"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlTextColor</string> <object class="NSColor" key="NSColor" id="733687712"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MAA</bytes> </object> </object> </object> </object> <object class="NSTextField" id="988469753"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 632}, {454, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="325691760"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Homework 7 :</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande-Bold</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="988469753"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSTextField" id="18745654"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 439}, {303, 185}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="833549254"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">272629760</int> <string type="base64-UTF8" key="NSContents">VGhpcyBhcHBsaWNhaXRvbiBwdWJsaXNoZXMgYSBzZXJ2aWNlIHZpYSBCb25qb3VyLiBBIGNvbXBhbmlv biBpUGhvbmUgYXBwbGljYXRpb24gYnJvd3NlcyBmb3IgdGhpcyBzZXJ2aWNlLiBDb25uZWN0ZWQgaVBo b25lIGNsaWVudHMgd2lsbCByZWNpZXZlIGFuIGltYWdlIGZyb20gdGhpcyBzZXJ2aWNlIHRvIGRpc3Bs YXkuIAoKVGhlIEltYWdlIGlzIHNlbGVjdGVkIGF0IHRoZSByaWdodCBhbmQgc2VudCB1c2luZyB0aGUg IlNlbmQgSW1hZ2UiIGJ1dHRvbi4gQWRkaXRpb25hbCBpbWFnZXMgb3IgZm9sZGVycyBvZiBpbWFnZXMg Y2FuIGJlIGFkZGVkIHRvIHRoZSBicm93c2VyIHVzaW5nIHRoZSAiQWRkIEltYWdlcy4uLiIgYnV0dG9u LiA</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="18745654"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSScrollView" id="305991980"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">4368</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="432592696"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextView" id="981802596"> <reference key="NSNextResponder" ref="432592696"/> <int key="NSvFlags">6418</int> <string key="NSFrameSize">{295, 14}</string> <reference key="NSSuperview" ref="432592696"/> <object class="NSTextContainer" key="NSTextContainer" id="735441310"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> <object class="NSMutableString" key="NSString"> <characters key="NS.bytes"/> </object> <nil key="NSDelegate"/> </object> <object class="NSMutableArray" key="NSTextContainers"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="735441310"/> </object> <int key="NSLMFlags">134</int> <nil key="NSDelegate"/> </object> <reference key="NSTextView" ref="981802596"/> <double key="NSWidth">295</double> <int key="NSTCFlags">1</int> </object> <object class="NSTextViewSharedData" key="NSSharedData"> <int key="NSFlags">11557</int> <int key="NSTextCheckingTypes">0</int> <nil key="NSMarkedAttributes"/> <object class="NSColor" key="NSBackgroundColor" id="786488440"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MQA</bytes> </object> <object class="NSDictionary" key="NSSelectedAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSBackgroundColor</string> <string>NSColor</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextBackgroundColor</string> <reference key="NSColor" ref="104511740"/> </object> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextColor</string> <reference key="NSColor" ref="733687712"/> </object> </object> </object> <reference key="NSInsertionColor" ref="733687712"/> <object class="NSDictionary" key="NSLinkAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSColor</string> <string>NSCursor</string> <string>NSUnderline</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">1</int> <bytes key="NSRGB">MCAwIDEAA</bytes> </object> <object class="NSCursor"> <string key="NSHotSpot">{8, -8}</string> <int key="NSCursorType">13</int> </object> <integer value="1"/> </object> </object> <nil key="NSDefaultParagraphStyle"/> </object> <int key="NSTVFlags">6</int> <string key="NSMaxSize">{463, 1e+07}</string> <string key="NSMinize">{223, 0}</string> <nil key="NSDelegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {295, 360}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSNextKeyView" ref="981802596"/> <reference key="NSDocView" ref="981802596"/> <reference key="NSBGColor" ref="786488440"/> <object class="NSCursor" key="NSCursor"> <string key="NSHotSpot">{4, -5}</string> <int key="NSCursorType">1</int> </object> <int key="NScvFlags">4</int> </object> <object class="NSScroller" id="786198283"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {15, 318}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.85256409645080566</double> </object> <object class="NSScroller" id="773550805"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {431, 15}}</string> <reference key="NSSuperview" ref="305991980"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">1</double> <double key="NSPercent">0.94565218687057495</double> </object> </object> <string key="NSFrame">{{20, 44}, {297, 362}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="432592696"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="786198283"/> <reference key="NSHScroller" ref="773550805"/> <reference key="NSContentView" ref="432592696"/> </object> <object class="NSButton" id="468638438"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{884, 8}, {113, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1061814889"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Send Image</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="468638438"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSProgressIndicator" id="48802473"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">1313</int> <object class="NSPSMatrix" key="NSDrawMatrix"/> <string key="NSFrame">{{850, 10}, {32, 32}}</string> <reference key="NSSuperview" ref="439893737"/> - <int key="NSpiFlags">20490</int> + <int key="NSpiFlags">28682</int> <double key="NSMaxValue">100</double> </object> <object class="NSButton" id="934936218"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{629, 8}, {127, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="367445469"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Add Images...</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="934936218"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSSlider" id="562298877"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">256</int> <string key="NSFrame">{{325, 20}, {100, 16}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="589268444"> <int key="NSCellFlags">-2079981824</int> <int key="NSCellFlags2">262144</int> <string key="NSContents"/> <reference key="NSControlView" ref="562298877"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.5714285714285714</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">8</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">YES</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSScrollView" id="352236955"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">274</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="302360068"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IKImageBrowserView" id="887580421"> <reference key="NSNextResponder" ref="302360068"/> <int key="NSvFlags">18</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple PDF pasteboard type</string> <string>Apple PICT pasteboard type</string> <string>Apple PNG pasteboard type</string> <string>Apple URL pasteboard type</string> <string>NSFilenamesPboardType</string> <string>NSTypedFilenamesPboardType:'.SGI'</string> <string>NSTypedFilenamesPboardType:'8BPS'</string> <string>NSTypedFilenamesPboardType:'BMP '</string> <string>NSTypedFilenamesPboardType:'BMPf'</string> <string>NSTypedFilenamesPboardType:'EPSF'</string> <string>NSTypedFilenamesPboardType:'FPix'</string> <string>NSTypedFilenamesPboardType:'GIFf'</string> <string>NSTypedFilenamesPboardType:'ICO '</string> <string>NSTypedFilenamesPboardType:'JPEG'</string> <string>NSTypedFilenamesPboardType:'PDF '</string> <string>NSTypedFilenamesPboardType:'PICT'</string> <string>NSTypedFilenamesPboardType:'PNGf'</string> <string>NSTypedFilenamesPboardType:'PNTG'</string> <string>NSTypedFilenamesPboardType:'TIFF'</string> <string>NSTypedFilenamesPboardType:'TPIC'</string> <string>NSTypedFilenamesPboardType:'icns'</string> <string>NSTypedFilenamesPboardType:'jp2 '</string> <string>NSTypedFilenamesPboardType:'qtif'</string> <string>NSTypedFilenamesPboardType:3FR</string> <string>NSTypedFilenamesPboardType:3fr</string> <string>NSTypedFilenamesPboardType:ARW</string> <string>NSTypedFilenamesPboardType:BMP</string> <string>NSTypedFilenamesPboardType:CR2</string> <string>NSTypedFilenamesPboardType:CRW</string> <string>NSTypedFilenamesPboardType:CUR</string> <string>NSTypedFilenamesPboardType:DCR</string> <string>NSTypedFilenamesPboardType:DNG</string> <string>NSTypedFilenamesPboardType:EFX</string> <string>NSTypedFilenamesPboardType:EPI</string> <string>NSTypedFilenamesPboardType:EPS</string> <string>NSTypedFilenamesPboardType:EPSF</string> <string>NSTypedFilenamesPboardType:EPSI</string> <string>NSTypedFilenamesPboardType:ERF</string> <string>NSTypedFilenamesPboardType:EXR</string> <string>NSTypedFilenamesPboardType:FAX</string> <string>NSTypedFilenamesPboardType:FFF</string> <string>NSTypedFilenamesPboardType:FPIX</string> <string>NSTypedFilenamesPboardType:FPX</string> <string>NSTypedFilenamesPboardType:G3</string> <string>NSTypedFilenamesPboardType:GIF</string> <string>NSTypedFilenamesPboardType:HDR</string> <string>NSTypedFilenamesPboardType:ICNS</string> <string>NSTypedFilenamesPboardType:ICO</string> <string>NSTypedFilenamesPboardType:JFAX</string> <string>NSTypedFilenamesPboardType:JFX</string> <string>NSTypedFilenamesPboardType:JP2</string> <string>NSTypedFilenamesPboardType:JPE</string> <string>NSTypedFilenamesPboardType:JPEG</string> <string>NSTypedFilenamesPboardType:JPF</string> <string>NSTypedFilenamesPboardType:JPG</string> <string>NSTypedFilenamesPboardType:MAC</string> <string>NSTypedFilenamesPboardType:MOS</string> <string>NSTypedFilenamesPboardType:MRW</string> <string>NSTypedFilenamesPboardType:NEF</string> <string>NSTypedFilenamesPboardType:NRW</string> <string>NSTypedFilenamesPboardType:ORF</string> <string>NSTypedFilenamesPboardType:PCT</string> <string>NSTypedFilenamesPboardType:PDF</string> <string>NSTypedFilenamesPboardType:PEF</string> <string>NSTypedFilenamesPboardType:PIC</string> <string>NSTypedFilenamesPboardType:PICT</string> <string>NSTypedFilenamesPboardType:PNG</string> <string>NSTypedFilenamesPboardType:PNT</string> <string>NSTypedFilenamesPboardType:PNTG</string> <string>NSTypedFilenamesPboardType:PS</string> <string>NSTypedFilenamesPboardType:PSD</string> <string>NSTypedFilenamesPboardType:QTI</string> <string>NSTypedFilenamesPboardType:QTIF</string> <string>NSTypedFilenamesPboardType:RAF</string> <string>NSTypedFilenamesPboardType:RAW</string> <string>NSTypedFilenamesPboardType:RGB</string> <string>NSTypedFilenamesPboardType:RW2</string> <string>NSTypedFilenamesPboardType:RWL</string> <string>NSTypedFilenamesPboardType:SGI</string> <string>NSTypedFilenamesPboardType:SR2</string> <string>NSTypedFilenamesPboardType:SRF</string> <string>NSTypedFilenamesPboardType:TARGA</string> <string>NSTypedFilenamesPboardType:TGA</string> <string>NSTypedFilenamesPboardType:TIF</string> <string>NSTypedFilenamesPboardType:TIFF</string> <string>NSTypedFilenamesPboardType:XBM</string> <string>NSTypedFilenamesPboardType:arw</string> <string>NSTypedFilenamesPboardType:bmp</string> <string>NSTypedFilenamesPboardType:cr2</string> <string>NSTypedFilenamesPboardType:crw</string> <string>NSTypedFilenamesPboardType:cur</string> <string>NSTypedFilenamesPboardType:dcr</string> <string>NSTypedFilenamesPboardType:dng</string> <string>NSTypedFilenamesPboardType:efx</string> <string>NSTypedFilenamesPboardType:epi</string> <string>NSTypedFilenamesPboardType:eps</string> <string>NSTypedFilenamesPboardType:epsf</string> <string>NSTypedFilenamesPboardType:epsi</string> <string>NSTypedFilenamesPboardType:erf</string> <string>NSTypedFilenamesPboardType:exr</string> <string>NSTypedFilenamesPboardType:fax</string> <string>NSTypedFilenamesPboardType:fff</string> <string>NSTypedFilenamesPboardType:fpix</string> <string>NSTypedFilenamesPboardType:fpx</string> <string>NSTypedFilenamesPboardType:g3</string> <string>NSTypedFilenamesPboardType:gif</string> <string>NSTypedFilenamesPboardType:hdr</string> <string>NSTypedFilenamesPboardType:icns</string> <string>NSTypedFilenamesPboardType:ico</string> <string>NSTypedFilenamesPboardType:jfax</string> <string>NSTypedFilenamesPboardType:jfx</string> <string>NSTypedFilenamesPboardType:jp2</string> <string>NSTypedFilenamesPboardType:jpe</string> <string>NSTypedFilenamesPboardType:jpeg</string> <string>NSTypedFilenamesPboardType:jpf</string> <string>NSTypedFilenamesPboardType:jpg</string> <string>NSTypedFilenamesPboardType:mac</string> <string>NSTypedFilenamesPboardType:mos</string> <string>NSTypedFilenamesPboardType:mrw</string> <string>NSTypedFilenamesPboardType:nef</string> <string>NSTypedFilenamesPboardType:nrw</string> <string>NSTypedFilenamesPboardType:orf</string> <string>NSTypedFilenamesPboardType:pct</string> <string>NSTypedFilenamesPboardType:pdf</string> <string>NSTypedFilenamesPboardType:pef</string> <string>NSTypedFilenamesPboardType:pic</string> <string>NSTypedFilenamesPboardType:pict</string> <string>NSTypedFilenamesPboardType:png</string> <string>NSTypedFilenamesPboardType:pnt</string> <string>NSTypedFilenamesPboardType:pntg</string> <string>NSTypedFilenamesPboardType:ps</string> <string>NSTypedFilenamesPboardType:psd</string> <string>NSTypedFilenamesPboardType:qti</string> <string>NSTypedFilenamesPboardType:qtif</string> <string>NSTypedFilenamesPboardType:raf</string> <string>NSTypedFilenamesPboardType:raw</string> <string>NSTypedFilenamesPboardType:rgb</string> <string>NSTypedFilenamesPboardType:rw2</string> <string>NSTypedFilenamesPboardType:rwl</string> <string>NSTypedFilenamesPboardType:sgi</string> <string>NSTypedFilenamesPboardType:sr2</string> <string>NSTypedFilenamesPboardType:srf</string> <string>NSTypedFilenamesPboardType:targa</string> <string>NSTypedFilenamesPboardType:tga</string> <string>NSTypedFilenamesPboardType:tif</string> <string>NSTypedFilenamesPboardType:tiff</string> <string>NSTypedFilenamesPboardType:xbm</string> <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> <string>NeXT TIFF v4.0 pasteboard type</string> </object> </object> <string key="NSFrameSize">{664, 603}</string> <reference key="NSSuperview" ref="302360068"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="constrainsToOriginalSize">NO</bool> <bool key="cellsHaveSubtitle">NO</bool> <bool key="cellsHaveTitle">NO</bool> <bool key="outlinesCells">NO</bool> <bool key="shadowsCells">YES</bool> <bool key="animates">NO</bool> <bool key="allowsReordering">YES</bool> <bool key="allowsMultipleSelection">NO</bool> <float key="cellWidth">100</float> <float key="cellHeight">100</float> <reference key="dataSource"/> <reference key="delegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {664, 603}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSNextKeyView" ref="887580421"/> <reference key="NSDocView" ref="887580421"/> <reference key="NSBGColor" ref="760086907"/> <int key="NScvFlags">6</int> </object> <object class="NSScroller" id="1064542466"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{575, 1}, {15, 588}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">0.98009950248756217</double> <double key="NSPercent">0.96363627910614014</double> </object> <object class="NSScroller" id="242271987"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 589}, {574, 15}}</string> <reference key="NSSuperview" ref="352236955"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.50602412223815918</double> </object> </object> <string key="NSFrame">{{325, 44}, {666, 605}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="302360068"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="1064542466"/> <reference key="NSHScroller" ref="242271987"/> <reference key="NSContentView" ref="302360068"/> <bytes key="NSScrollAmts">QSAAAEEgAABDAszNQvAAAA</bytes> </object> </object> <string key="NSFrameSize">{1011, 669}</string> <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{720, 502}</string> <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> </object> <object class="NSCustomObject" id="976324537"> <string key="NSClassName">GalleryDesktopServiceAppDelegate</string> </object> <object class="NSCustomObject" id="755631768"> <string key="NSClassName">NSFontManager</string> </object> <object class="NSUserDefaultsController" id="1054695559"> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSCustomObject" id="295914207"> <string key="NSClassName">ApplicationController</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performMiniaturize:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1011231497"/> </object> <int key="connectionID">37</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">arrangeInFront:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="625202149"/> </object> <int key="connectionID">39</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">print:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="49223823"/> </object> <int key="connectionID">86</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">runPageLayout:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="294629803"/> </object> <int key="connectionID">87</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">clearRecentDocuments:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="759406840"/> </object> <int key="connectionID">127</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontStandardAboutPanel:</string> <reference key="source" ref="1021"/> <reference key="destination" ref="238522557"/> </object> <int key="connectionID">142</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performClose:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="776162233"/> </object> <int key="connectionID">193</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleContinuousSpellChecking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="948374510"/> </object> <int key="connectionID">222</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">undo:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1058277027"/> </object> <int key="connectionID">223</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copy:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="860595796"/> </object> <int key="connectionID">224</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">checkSpelling:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="96193923"/> </object> <int key="connectionID">225</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">paste:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="29853731"/> </object> <int key="connectionID">226</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">stopSpeaking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="680220178"/> </object> <int key="connectionID">227</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">cut:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="296257095"/> </object> <int key="connectionID">228</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">showGuessPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="679648819"/> </object> <int key="connectionID">230</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">redo:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="790794224"/> </object> <int key="connectionID">231</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">selectAll:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="583158037"/> </object> <int key="connectionID">232</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">startSpeaking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="731782645"/> </object> <int key="connectionID">233</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">delete:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="437104165"/> </object> <int key="connectionID">235</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performZoom:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="575023229"/> </object> <int key="connectionID">240</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="447796847"/> </object> <int key="connectionID">241</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">centerSelectionInVisibleArea:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="88285865"/> </object> <int key="connectionID">245</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleGrammarChecking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="967646866"/> </object> <int key="connectionID">347</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleSmartInsertDelete:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="605118523"/> </object> <int key="connectionID">355</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticQuoteSubstitution:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="197661976"/> </object> <int key="connectionID">356</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticLinkDetection:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="708854459"/> </object> <int key="connectionID">357</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">saveDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1023925487"/> </object> <int key="connectionID">362</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">saveDocumentAs:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="117038363"/> </object> <int key="connectionID">363</int> @@ -3775,1027 +3775,1027 @@ LiA</string> </object> <object class="IBObjectRecord"> <int key="objectID">546</int> <reference key="object" ref="786198283"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">547</int> <reference key="object" ref="773550805"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">548</int> <reference key="object" ref="981802596"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">558</int> <reference key="object" ref="468638438"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1061814889"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">559</int> <reference key="object" ref="1061814889"/> <reference key="parent" ref="468638438"/> </object> <object class="IBObjectRecord"> <int key="objectID">577</int> <reference key="object" ref="1054695559"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">591</int> <reference key="object" ref="934936218"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="367445469"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">592</int> <reference key="object" ref="367445469"/> <reference key="parent" ref="934936218"/> </object> <object class="IBObjectRecord"> <int key="objectID">537</int> <reference key="object" ref="295914207"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">597</int> <reference key="object" ref="562298877"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="589268444"/> </object> <reference key="parent" ref="439893737"/> <string key="objectName">Zoom Slider</string> </object> <object class="IBObjectRecord"> <int key="objectID">598</int> <reference key="object" ref="589268444"/> <reference key="parent" ref="562298877"/> </object> <object class="IBObjectRecord"> <int key="objectID">609</int> <reference key="object" ref="352236955"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1064542466"/> <reference ref="242271987"/> <reference ref="887580421"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">610</int> <reference key="object" ref="1064542466"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">611</int> <reference key="object" ref="242271987"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">590</int> <reference key="object" ref="887580421"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">622</int> <reference key="object" ref="48802473"/> <reference key="parent" ref="439893737"/> </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-3.IBPluginDependency</string> <string>112.IBPluginDependency</string> <string>112.ImportedFromIB2</string> <string>124.IBPluginDependency</string> <string>124.ImportedFromIB2</string> <string>125.IBPluginDependency</string> <string>125.ImportedFromIB2</string> <string>125.editorWindowContentRectSynchronizationRect</string> <string>126.IBPluginDependency</string> <string>126.ImportedFromIB2</string> <string>129.IBPluginDependency</string> <string>129.ImportedFromIB2</string> <string>130.IBPluginDependency</string> <string>130.ImportedFromIB2</string> <string>130.editorWindowContentRectSynchronizationRect</string> <string>131.IBPluginDependency</string> <string>131.ImportedFromIB2</string> <string>134.IBPluginDependency</string> <string>134.ImportedFromIB2</string> <string>136.IBPluginDependency</string> <string>136.ImportedFromIB2</string> <string>143.IBPluginDependency</string> <string>143.ImportedFromIB2</string> <string>144.IBPluginDependency</string> <string>144.ImportedFromIB2</string> <string>145.IBPluginDependency</string> <string>145.ImportedFromIB2</string> <string>149.IBPluginDependency</string> <string>149.ImportedFromIB2</string> <string>150.IBPluginDependency</string> <string>150.ImportedFromIB2</string> <string>19.IBPluginDependency</string> <string>19.ImportedFromIB2</string> <string>195.IBPluginDependency</string> <string>195.ImportedFromIB2</string> <string>196.IBPluginDependency</string> <string>196.ImportedFromIB2</string> <string>197.IBPluginDependency</string> <string>197.ImportedFromIB2</string> <string>198.IBPluginDependency</string> <string>198.ImportedFromIB2</string> <string>199.IBPluginDependency</string> <string>199.ImportedFromIB2</string> <string>200.IBEditorWindowLastContentRect</string> <string>200.IBPluginDependency</string> <string>200.ImportedFromIB2</string> <string>200.editorWindowContentRectSynchronizationRect</string> <string>201.IBPluginDependency</string> <string>201.ImportedFromIB2</string> <string>202.IBPluginDependency</string> <string>202.ImportedFromIB2</string> <string>203.IBPluginDependency</string> <string>203.ImportedFromIB2</string> <string>204.IBPluginDependency</string> <string>204.ImportedFromIB2</string> <string>205.IBEditorWindowLastContentRect</string> <string>205.IBPluginDependency</string> <string>205.ImportedFromIB2</string> <string>205.editorWindowContentRectSynchronizationRect</string> <string>206.IBPluginDependency</string> <string>206.ImportedFromIB2</string> <string>207.IBPluginDependency</string> <string>207.ImportedFromIB2</string> <string>208.IBPluginDependency</string> <string>208.ImportedFromIB2</string> <string>209.IBPluginDependency</string> <string>209.ImportedFromIB2</string> <string>210.IBPluginDependency</string> <string>210.ImportedFromIB2</string> <string>211.IBPluginDependency</string> <string>211.ImportedFromIB2</string> <string>212.IBPluginDependency</string> <string>212.ImportedFromIB2</string> <string>212.editorWindowContentRectSynchronizationRect</string> <string>213.IBPluginDependency</string> <string>213.ImportedFromIB2</string> <string>214.IBPluginDependency</string> <string>214.ImportedFromIB2</string> <string>215.IBPluginDependency</string> <string>215.ImportedFromIB2</string> <string>216.IBPluginDependency</string> <string>216.ImportedFromIB2</string> <string>217.IBPluginDependency</string> <string>217.ImportedFromIB2</string> <string>218.IBPluginDependency</string> <string>218.ImportedFromIB2</string> <string>219.IBPluginDependency</string> <string>219.ImportedFromIB2</string> <string>220.IBEditorWindowLastContentRect</string> <string>220.IBPluginDependency</string> <string>220.ImportedFromIB2</string> <string>220.editorWindowContentRectSynchronizationRect</string> <string>221.IBPluginDependency</string> <string>221.ImportedFromIB2</string> <string>23.IBPluginDependency</string> <string>23.ImportedFromIB2</string> <string>236.IBPluginDependency</string> <string>236.ImportedFromIB2</string> <string>239.IBPluginDependency</string> <string>239.ImportedFromIB2</string> <string>24.IBEditorWindowLastContentRect</string> <string>24.IBPluginDependency</string> <string>24.ImportedFromIB2</string> <string>24.editorWindowContentRectSynchronizationRect</string> <string>29.IBEditorWindowLastContentRect</string> <string>29.IBPluginDependency</string> <string>29.ImportedFromIB2</string> <string>29.WindowOrigin</string> <string>29.editorWindowContentRectSynchronizationRect</string> <string>295.IBPluginDependency</string> <string>296.IBEditorWindowLastContentRect</string> <string>296.IBPluginDependency</string> <string>296.editorWindowContentRectSynchronizationRect</string> <string>297.IBPluginDependency</string> <string>298.IBPluginDependency</string> <string>346.IBPluginDependency</string> <string>346.ImportedFromIB2</string> <string>348.IBPluginDependency</string> <string>348.ImportedFromIB2</string> <string>349.IBEditorWindowLastContentRect</string> <string>349.IBPluginDependency</string> <string>349.ImportedFromIB2</string> <string>349.editorWindowContentRectSynchronizationRect</string> <string>350.IBPluginDependency</string> <string>350.ImportedFromIB2</string> <string>351.IBPluginDependency</string> <string>351.ImportedFromIB2</string> <string>354.IBPluginDependency</string> <string>354.ImportedFromIB2</string> <string>371.IBEditorWindowLastContentRect</string> <string>371.IBPluginDependency</string> <string>371.IBWindowTemplateEditedContentRect</string> <string>371.NSWindowTemplate.visibleAtLaunch</string> <string>371.editorWindowContentRectSynchronizationRect</string> <string>371.windowTemplate.hasMinSize</string> <string>371.windowTemplate.maxSize</string> <string>371.windowTemplate.minSize</string> <string>372.IBPluginDependency</string> <string>375.IBPluginDependency</string> <string>376.IBEditorWindowLastContentRect</string> <string>376.IBPluginDependency</string> <string>377.IBPluginDependency</string> <string>388.IBEditorWindowLastContentRect</string> <string>388.IBPluginDependency</string> <string>389.IBPluginDependency</string> <string>390.IBPluginDependency</string> <string>391.IBPluginDependency</string> <string>392.IBPluginDependency</string> <string>393.IBPluginDependency</string> <string>394.IBPluginDependency</string> <string>395.IBPluginDependency</string> <string>396.IBPluginDependency</string> <string>397.IBPluginDependency</string> <string>398.IBPluginDependency</string> <string>399.IBPluginDependency</string> <string>400.IBPluginDependency</string> <string>401.IBPluginDependency</string> <string>402.IBPluginDependency</string> <string>403.IBPluginDependency</string> <string>404.IBPluginDependency</string> <string>405.IBPluginDependency</string> <string>406.IBPluginDependency</string> <string>407.IBPluginDependency</string> <string>408.IBPluginDependency</string> <string>409.IBPluginDependency</string> <string>410.IBPluginDependency</string> <string>411.IBPluginDependency</string> <string>412.IBPluginDependency</string> <string>413.IBPluginDependency</string> <string>414.IBPluginDependency</string> <string>415.IBPluginDependency</string> <string>416.IBPluginDependency</string> <string>417.IBPluginDependency</string> <string>418.IBPluginDependency</string> <string>419.IBPluginDependency</string> <string>450.IBPluginDependency</string> <string>451.IBEditorWindowLastContentRect</string> <string>451.IBPluginDependency</string> <string>452.IBPluginDependency</string> <string>453.IBPluginDependency</string> <string>454.IBPluginDependency</string> <string>457.IBPluginDependency</string> <string>459.IBPluginDependency</string> <string>460.IBPluginDependency</string> <string>462.IBPluginDependency</string> <string>465.IBPluginDependency</string> <string>466.IBPluginDependency</string> <string>485.IBPluginDependency</string> <string>490.IBPluginDependency</string> <string>491.IBEditorWindowLastContentRect</string> <string>491.IBPluginDependency</string> <string>492.IBPluginDependency</string> <string>496.IBPluginDependency</string> <string>497.IBEditorWindowLastContentRect</string> <string>497.IBPluginDependency</string> <string>498.IBPluginDependency</string> <string>499.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>5.ImportedFromIB2</string> <string>500.IBPluginDependency</string> <string>501.IBPluginDependency</string> <string>502.IBPluginDependency</string> <string>503.IBPluginDependency</string> <string>504.IBPluginDependency</string> <string>505.IBPluginDependency</string> <string>506.IBPluginDependency</string> <string>507.IBPluginDependency</string> <string>508.IBEditorWindowLastContentRect</string> <string>508.IBPluginDependency</string> <string>509.IBPluginDependency</string> <string>510.IBPluginDependency</string> <string>511.IBPluginDependency</string> <string>512.IBPluginDependency</string> <string>513.IBPluginDependency</string> <string>514.IBPluginDependency</string> <string>515.IBPluginDependency</string> <string>516.IBPluginDependency</string> <string>517.IBPluginDependency</string> <string>535.IBPluginDependency</string> <string>536.IBPluginDependency</string> <string>541.IBPluginDependency</string> <string>542.IBPluginDependency</string> <string>543.IBPluginDependency</string> <string>544.IBPluginDependency</string> <string>545.IBPluginDependency</string> <string>546.IBPluginDependency</string> <string>547.IBPluginDependency</string> <string>548.IBPluginDependency</string> <string>558.IBPluginDependency</string> <string>559.IBPluginDependency</string> <string>56.IBPluginDependency</string> <string>56.ImportedFromIB2</string> <string>57.IBEditorWindowLastContentRect</string> <string>57.IBPluginDependency</string> <string>57.ImportedFromIB2</string> <string>57.editorWindowContentRectSynchronizationRect</string> <string>577.IBPluginDependency</string> <string>58.IBPluginDependency</string> <string>58.ImportedFromIB2</string> <string>590.IBPluginDependency</string> <string>591.IBPluginDependency</string> <string>592.IBPluginDependency</string> <string>597.IBPluginDependency</string> <string>598.IBPluginDependency</string> <string>609.IBPluginDependency</string> <string>610.IBPluginDependency</string> <string>611.IBPluginDependency</string> <string>622.IBPluginDependency</string> <string>72.IBPluginDependency</string> <string>72.ImportedFromIB2</string> <string>73.IBPluginDependency</string> <string>73.ImportedFromIB2</string> <string>74.IBPluginDependency</string> <string>74.ImportedFromIB2</string> <string>75.IBPluginDependency</string> <string>75.ImportedFromIB2</string> <string>77.IBPluginDependency</string> <string>77.ImportedFromIB2</string> <string>78.IBPluginDependency</string> <string>78.ImportedFromIB2</string> <string>79.IBPluginDependency</string> <string>79.ImportedFromIB2</string> <string>80.IBPluginDependency</string> <string>80.ImportedFromIB2</string> <string>81.IBEditorWindowLastContentRect</string> <string>81.IBPluginDependency</string> <string>81.ImportedFromIB2</string> <string>81.editorWindowContentRectSynchronizationRect</string> <string>82.IBPluginDependency</string> <string>82.ImportedFromIB2</string> <string>83.IBPluginDependency</string> <string>83.ImportedFromIB2</string> <string>92.IBPluginDependency</string> <string>92.ImportedFromIB2</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{522, 812}, {146, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{436, 809}, {64, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 187}, {275, 113}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {275, 83}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{547, 180}, {254, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{187, 434}, {243, 243}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {167, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 217}, {238, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {241, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{654, 239}, {194, 73}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{525, 802}, {197, 73}}</string> <string>{{299, 836}, {476, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{74, 862}</string> <string>{{6, 978}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{604, 269}, {231, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{746, 287}, {220, 133}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {215, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{1560, 120}, {1011, 669}}</string> + <string>{{163, 154}, {1011, 669}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{1560, 120}, {1011, 669}}</string> + <string>{{163, 154}, {1011, 669}}</string> <integer value="1"/> <string>{{33, 99}, {480, 360}}</string> <boolean value="YES"/> <string>{3.40282e+38, 3.40282e+38}</string> <string>{720, 480}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{591, 420}, {83, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{523, 2}, {178, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{753, 197}, {170, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{725, 289}, {246, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{674, 260}, {204, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{878, 180}, {164, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{286, 129}, {275, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{23, 794}, {245, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{452, 109}, {196, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{145, 474}, {199, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> <int key="maxID">623</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">ApplicationController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addImages:</string> <string>sendImage:</string> <string>zoomChanged:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>imageBrowser</string> <string>logTextField</string> <string>progressIndicator</string> <string>zoomSlider</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>IKImageBrowserView</string> <string>NSTextView</string> <string>NSProgressIndicator</string> <string>NSSlider</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">ApplicationController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">GalleryDesktopServiceAppDelegate</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>appController</string> <string>window</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>ApplicationController</string> <string>NSWindow</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">GalleryDesktopServiceAppDelegate.h</string> </object> </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">IKImageBrowserView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>_dataSource</string> <string>_delegate</string> <string>_dragDestinationDelegate</string> <string>_horizontalScroller</string> <string>_verticalScroller</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>NSScroller</string> <string>NSScroller</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="119117330"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSActionCell</string> <string key="superclassName">NSCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="848393276"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="935018811"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="385905261"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSBrowser</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButton</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButtonCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSCell</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSControl</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="164379373"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSController</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>printDocument:</string> <string>revertDocumentToSaved:</string> <string>runPageLayout:</string> <string>saveDocument:</string> <string>saveDocumentAs:</string> <string>saveDocumentTo:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocumentController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>clearRecentDocuments:</string> <string>newDocument:</string> <string>openDocument:</string> <string>saveAllDocuments:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFontManager</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="149916190"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMatrix</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMatrix.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenu</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="55896286"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenuItem</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="359201979"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMovieView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="848393276"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="935018811"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="385905261"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="164379373"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="149916190"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> </object> </object>
beepscore/GalleryDesktopService
c817b6d761157dd5baa68afbba0831c370a5a111
When asynchronous send completes, stop progressIndicator animation.
diff --git a/ApplicationController.h b/ApplicationController.h index a65a889..96d4d58 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -1,50 +1,53 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // App controller is a singleton object // This class conforms to two IKImageBrowserView informal protocols: // IKImageBrowserDataSource and IKImageBrowserDelegate. #import <Cocoa/Cocoa.h> -@class ImageShareService; +// import ImageShareService.h to see the ImageShareServiceProtocol declaration +#import "ImageShareService.h" + @class IKImageBrowserView; -@interface ApplicationController : NSObject +// declare ApplicationController implements ImageShareServiceProtocol +@interface ApplicationController : NSObject <ImageShareServiceProtocol> { NSTextView* logTextField_; ImageShareService* imageShareService_; IKImageBrowserView* imageBrowser_; NSSlider* zoomSlider_; // MVC Model object NSMutableArray* images_; NSProgressIndicator* progressIndicator; } // Apple recommends on Mac assign IBOutlet, on iPhone retain IBOutlet // applies only to nib top-level objects? @property (nonatomic, assign) IBOutlet NSTextView* logTextField; @property (nonatomic, assign) IBOutlet IKImageBrowserView* imageBrowser; @property (nonatomic, assign) IBOutlet NSSlider* zoomSlider; @property(nonatomic, assign)IBOutlet NSProgressIndicator *progressIndicator; + (ApplicationController*)sharedApplicationController; - (void) startService; - (void) appendStringToLog:(NSString*)logString; - (IBAction) sendImage:(id)sender; - (IBAction) addImages:(id)sender; - (IBAction) zoomChanged:(id)sender; @end diff --git a/ApplicationController.m b/ApplicationController.m index 744b00c..37ab7a5 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,449 +1,452 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" -#import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; @synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"russianRocket" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; + } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; + [imageShareService_ setDelegate:self]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal (16 bit) if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // in IB, set progressIndicator to display when stopped. // usually the send completes quickly, especially when sending to the simulator. // if the progressIndicator is not set to display when stopped, // the send may complete before the progressIndicator and animation appear. // can test a "display when stopped" progressIndicator by attempting to send a pdf file, // which isn't supported and so takes forever [self.progressIndicator startAnimation:self]; // send NSImage [imageShareService_ sendImageToClients:image]; - // the send is asynchronous, so imageShareService_ could call back to stop the animation. - // for now, do a "quick and dirty" stop - [self.progressIndicator stopAnimation:self]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model NSLog(@"number of images in the model = %d", [images_ count]); NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } -@end - - - +#pragma mark - +#pragma mark ImageShareServiceDelegate +// Implement ImageShareService's formal protocol ImageShareServiceDelegate +// when the asynchronous send completes, imageShareService calls back to its delegate +- (void)imageShareServiceDidSend:(ImageShareService*)imageShareService +{ + [self.progressIndicator stopAnimation:self]; +} +@end diff --git a/ImageShareService.h b/ImageShareService.h index 4b1e4a0..900c7ab 100644 --- a/ImageShareService.h +++ b/ImageShareService.h @@ -1,40 +1,57 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.h // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and then sending an image to the connected client #import <Foundation/Foundation.h> +// declare ImageShareServiceProtocol. We will list methods below, after interface block. +@protocol ImageShareServiceProtocol; + @class ApplicationController; @interface ImageShareService : NSObject <NSNetServiceDelegate> { + #pragma mark Instance variables ApplicationController* appController_; CFSocketRef socket_; NSFileHandle* connectionFileHandle_; NSMutableDictionary* dataForFileHandles_; NSMutableArray* connectedFileHandles_; + + id delegate; } - (BOOL) startService; - (void) publishService; - (void) handleIncomingConnection:(NSNotification*)notification; - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close; - (void) readIncomingData:(NSNotification*) notification; - (void) sendImageToClients:(NSImage*)image; +#pragma mark Properties +// a delegator should manage its delegate property with assign, not retain. +// Ref http://cocoawithlove.com/2009/07/rules-to-avoid-retain-cycles.html +// delegate type is id (any type) +@property(nonatomic,assign) id delegate; + +@end +// list ImageShareServiceProtocol methods +@protocol ImageShareServiceProtocol +// notify delegate send is complete +- (void)imageShareServiceDidSend:(ImageShareService*)imageShareService; @end diff --git a/ImageShareService.m b/ImageShareService.m index 2429aed..62ffe30 100644 --- a/ImageShareService.m +++ b/ImageShareService.m @@ -1,394 +1,407 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and advertises its service via Bonjour // Sends an image to the connected clients #import "ImageShareService.h" #import "ApplicationController.h" #import <sys/socket.h> #import <netinet/in.h> NSString* const kServiceTypeString = @"_uwcelistener._tcp."; NSString* const kServiceNameString = @"Images"; const int kListenPort = 8082; NSString* const kConnectionKey = @"connectionKey"; NSString* const kImageSizeKey = @"imageSize"; NSString* const kRepresentationToSendKey = @"representationToSend"; @interface ImageShareService () - (void) parseDataRecieved:(NSMutableData*)dataSoFar; - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle; - (void) handleMessage:(NSString*)messageString; @end @implementation ImageShareService +#pragma mark properties +@synthesize delegate; + - (id) init { self = [super init]; if (self != nil) { appController_ = [ApplicationController sharedApplicationController]; socket_ = nil; connectionFileHandle_ = nil; dataForFileHandles_ = [[NSMutableDictionary dictionary] retain]; connectedFileHandles_ = [[NSMutableArray array] retain]; } return self; } - (void) dealloc { [dataForFileHandles_ release]; dataForFileHandles_ = nil; for (NSFileHandle* connection in connectedFileHandles_) { [connection closeFile]; } [connectedFileHandles_ release]; connectedFileHandles_ = nil; + + // a delegator doesn't retain it's delegate, and so it doesn't release it + delegate = nil; [super dealloc]; } - (BOOL) startService { socket_ = CFSocketCreate ( kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL ); // Create a network socket for streaming TCP if (!socket_) { [appController_ appendStringToLog:@"Cound not create socket"]; return NO; } int reuse = true; int fileDescriptor = CFSocketGetNative(socket_); // Make sure socket is set for reuse of the address // without this, you may find that the socket is already in use // when restartnig and debugging int result = setsockopt( fileDescriptor, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(int) ); if ( result != 0) { [appController_ appendStringToLog:@"Unable to set socket options"]; return NO; } // Create the address for the scoket. // In this case we don't care what address is incoming // but we listen on a specific port - kLisenPort struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(kListenPort); CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); [(id)addressData autorelease]; // bind socket to the address if (CFSocketSetAddress(socket_, addressData) != kCFSocketSuccess) { [appController_ appendStringToLog:@"Unable to bind socket to address"]; return NO; } // setup listening to incoming connections // we will use notifications to respond // as we are not looking for high performance and want // to use the simpiler Cocoa NSFileHandle APIs connectionFileHandle_ = [[NSFileHandle alloc] initWithFileDescriptor:fileDescriptor closeOnDealloc:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIncomingConnection:) name:NSFileHandleConnectionAcceptedNotification object:nil]; [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; NSString* logString = [NSString stringWithFormat:@"listening to socket on port %d", kListenPort]; [appController_ appendStringToLog:logString]; return YES; } - (void) publishService { // Create a name for the service that include's this computer's name CFStringRef computerName = CSCopyMachineName(); NSString* serviceNameString = [NSString stringWithFormat:@"%@'s %@", (NSString*)computerName, kServiceNameString]; CFRelease(computerName); NSNetService* netService = [[NSNetService alloc] initWithDomain:@"" type:kServiceTypeString name:serviceNameString port:kListenPort]; // publish on the default domains [netService setDelegate:self]; [netService publish]; // NOTE : We are not handling any failure to publish cases // which is not a good idea. We should at least // Be checking for name collisions NSString* logString = [NSString stringWithFormat:@"published service type:%@ with name %@ on port %d", kServiceTypeString, kServiceNameString, kListenPort]; [appController_ appendStringToLog:logString]; } #pragma mark - #pragma mark Receiving -(void) handleIncomingConnection:(NSNotification*)notification { NSDictionary* userInfo = [notification userInfo]; NSFileHandle* connectedFileHandle = [userInfo objectForKey:NSFileHandleNotificationFileHandleItem]; if(connectedFileHandle) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readIncomingData:) name:NSFileHandleDataAvailableNotification object:connectedFileHandle]; [connectedFileHandles_ addObject:connectedFileHandle]; [appController_ appendStringToLog:@"Opened an incoming connection"]; [connectedFileHandle waitForDataInBackgroundAndNotify]; } [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; } - (void) readIncomingData:(NSNotification*) notification { NSFileHandle* readFileHandle = [notification object]; NSData* newData = [readFileHandle availableData]; NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; if ([newData length] == 0) { [appController_ appendStringToLog:@"No more data in file handle, closing"]; [self stopReceivingForFileHandle:readFileHandle closeFileHandle:YES]; return; } [appController_ appendStringToLog:@"Got a new message :"]; [appController_ appendStringToLog:[NSString stringWithUTF8String:[newData bytes]]]; // append the data to the data we have so far [dataSoFar appendData:newData]; [self parseDataRecieved:dataSoFar]; // wait for a read again [readFileHandle waitForDataInBackgroundAndNotify]; } - (void) parseDataRecieved:(NSMutableData*)dataSoFar { // Look for a token that indicates a complete message // and act on the message. Remove the message from the data so far // Currently our token is the null terminator 0x00 char token = 0x00; NSRange result = [dataSoFar rangeOfData:[NSData dataWithBytes:&token length:1] options:0 range:NSMakeRange(0, [dataSoFar length])]; if ( result.location != NSNotFound ) { NSData* messageData = [dataSoFar subdataWithRange:NSMakeRange(0, result.location+1)]; NSString* messageString = [NSString stringWithUTF8String:[messageData bytes]]; // act on the message NSLog(@"parsed message : %@", messageString); [self handleMessage:messageString]; // trim the message we have handled off the data received NSUInteger location = result.location + 1; NSUInteger length = [dataSoFar length] - [messageData length]; [dataSoFar setData:[dataSoFar subdataWithRange:NSMakeRange(location, length)]]; } } - (void) handleMessage:(NSString*)messageString { // Not reacting to any sent messages for now } - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle { NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data == nil ) { data = [NSMutableData data]; [dataForFileHandles_ setObject:data forKey:fileHandle]; } return data; } - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close { if (close) { [fileHandle closeFile]; [connectedFileHandles_ removeObject:fileHandle]; } NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data != nil ) { [dataForFileHandles_ removeObjectForKey:fileHandle]; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleDataAvailableNotification object:fileHandle]; } #pragma mark - #pragma mark Sending - (void)sendWithDictionary:(NSMutableDictionary*)sendArgumentsDictionary { // sendWithDictionary: has one parameter, a dictionary. // This way, sendWithDictionary: can be called from performSelectorInBackground:withObject: // The dictionary object contains multiple objects as "arguments" for use by the method NSFileHandle* connection = [sendArgumentsDictionary objectForKey:kConnectionKey]; NSData* imageSize = [sendArgumentsDictionary objectForKey:kImageSizeKey]; NSData* representationToSend = [sendArgumentsDictionary objectForKey:kRepresentationToSendKey]; [connection writeData:imageSize]; [connection writeData:representationToSend]; + + // Notify delegate the send is complete + // The delegate controls the view. + // View related methods are not thread safe and must be performed on the main thread. + [self.delegate performSelectorOnMainThread:@selector(imageShareServiceDidSend:) + withObject:self + waitUntilDone:NO]; } - (void) sendImageToClients:(NSImage*)image { - NSUInteger clientCount = [connectedFileHandles_ count]; - - if( clientCount <= 0 ) - { - [appController_ appendStringToLog:@"No clients connected, not sending"]; - return; - } + NSUInteger clientCount = [connectedFileHandles_ count]; - NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; - NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; + if( clientCount <= 0 ) + { + [appController_ appendStringToLog:@"No clients connected, not sending"]; + return; + } + + NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; + NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; - // NOTE : this will only work when the image has a bitmap representation of some type - // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep - // and then representationUsingType will fail - // To do this better we could draw the image into an offscreen context - // then save that context in a format like PNG - // There are some downsides to this though, because for instance a jpeg will recompress - // so you would want to use a rep when you have it and if not, create one. + // NOTE : this will only work when the image has a bitmap representation of some type + // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep + // and then representationUsingType will fail + // To do this better we could draw the image into an offscreen context + // then save that context in a format like PNG + // There are some downsides to this though, because for instance a jpeg will recompress + // so you would want to use a rep when you have it and if not, create one. - // NOTE 2: We could try to just send the file as data rather than - // an NSImage. The problem is the iPhone doesn't support as many - // image formats as the desktop. The translation to PNG insures - // something the iPhone can display + // NOTE 2: We could try to just send the file as data rather than + // an NSImage. The problem is the iPhone doesn't support as many + // image formats as the desktop. The translation to PNG insures + // something the iPhone can display - // The first thing we send is 4 bytes that represent the length of - // of the image so that the client will know when a full image has - // transfered + // The first thing we send is 4 bytes that represent the length of + // of the image so that the client will know when a full image has + // transfered - NSUInteger imageDataSize = [representationToSend length]; + NSUInteger imageDataSize = [representationToSend length]; // the length method returns an NSUInteger, which happens to be 64 bits - // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits - // we are simply going to not send anything that is so big that it - // length is > 2^32, which should be fine considering the iPhone client - // could not handle images that large anyway - if ( imageDataSize > UINT32_MAX ) - { - [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; - return; - } + // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits + // we are simply going to not send anything that is so big that it + // length is > 2^32, which should be fine considering the iPhone client + // could not handle images that large anyway + if ( imageDataSize > UINT32_MAX ) + { + [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; + return; + } // We also have to be careful and make sure that the bytes are in the proper order - // when sent over the network using htonl() - uint32 dataLength = htonl( (uint32)imageDataSize ); - NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; + // when sent over the network using htonl() + uint32 dataLength = htonl( (uint32)imageDataSize ); + NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; - for ( NSFileHandle* connection in connectedFileHandles_) - { + for ( NSFileHandle* connection in connectedFileHandles_) + { // make a dictionary for sendWithDictionary: NSMutableDictionary* sendArgumentsDictionary = [[NSMutableDictionary alloc] initWithObjectsAndKeys:connection, kConnectionKey, imageSize, kImageSizeKey, representationToSend, kRepresentationToSendKey, nil]; // send asynchronously to avoid locking up UI // Thanks to suggestions from Greg Anderson and Pam DeBriere // including using performSelectorInBackground:withObject: to create a new thread // Note: if iPhone client is stopped during send, application throws exception // Currently exception is not handled and stops program execution [self performSelectorInBackground:@selector(sendWithDictionary:) withObject:sendArgumentsDictionary]; [sendArgumentsDictionary release]; } - [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; + [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; } @end
beepscore/GalleryDesktopService
c6aa496ceeb39023cf1fef06e81c8d02898df36e
Refactor/rename asynchSendWithDictionary: to sendWithDictionary:
diff --git a/ImageShareService.m b/ImageShareService.m index add4363..2429aed 100644 --- a/ImageShareService.m +++ b/ImageShareService.m @@ -1,391 +1,394 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and advertises its service via Bonjour // Sends an image to the connected clients #import "ImageShareService.h" #import "ApplicationController.h" #import <sys/socket.h> #import <netinet/in.h> NSString* const kServiceTypeString = @"_uwcelistener._tcp."; NSString* const kServiceNameString = @"Images"; const int kListenPort = 8082; NSString* const kConnectionKey = @"connectionKey"; NSString* const kImageSizeKey = @"imageSize"; NSString* const kRepresentationToSendKey = @"representationToSend"; @interface ImageShareService () - (void) parseDataRecieved:(NSMutableData*)dataSoFar; - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle; - (void) handleMessage:(NSString*)messageString; @end @implementation ImageShareService - (id) init { self = [super init]; if (self != nil) { appController_ = [ApplicationController sharedApplicationController]; socket_ = nil; connectionFileHandle_ = nil; dataForFileHandles_ = [[NSMutableDictionary dictionary] retain]; connectedFileHandles_ = [[NSMutableArray array] retain]; } return self; } - (void) dealloc { [dataForFileHandles_ release]; dataForFileHandles_ = nil; for (NSFileHandle* connection in connectedFileHandles_) { [connection closeFile]; } [connectedFileHandles_ release]; connectedFileHandles_ = nil; [super dealloc]; } - (BOOL) startService { socket_ = CFSocketCreate ( kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL ); // Create a network socket for streaming TCP if (!socket_) { [appController_ appendStringToLog:@"Cound not create socket"]; return NO; } int reuse = true; int fileDescriptor = CFSocketGetNative(socket_); // Make sure socket is set for reuse of the address // without this, you may find that the socket is already in use // when restartnig and debugging int result = setsockopt( fileDescriptor, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(int) ); if ( result != 0) { [appController_ appendStringToLog:@"Unable to set socket options"]; return NO; } // Create the address for the scoket. // In this case we don't care what address is incoming // but we listen on a specific port - kLisenPort struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(kListenPort); CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); [(id)addressData autorelease]; // bind socket to the address if (CFSocketSetAddress(socket_, addressData) != kCFSocketSuccess) { [appController_ appendStringToLog:@"Unable to bind socket to address"]; return NO; } // setup listening to incoming connections // we will use notifications to respond // as we are not looking for high performance and want // to use the simpiler Cocoa NSFileHandle APIs connectionFileHandle_ = [[NSFileHandle alloc] initWithFileDescriptor:fileDescriptor closeOnDealloc:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIncomingConnection:) name:NSFileHandleConnectionAcceptedNotification object:nil]; [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; NSString* logString = [NSString stringWithFormat:@"listening to socket on port %d", kListenPort]; [appController_ appendStringToLog:logString]; return YES; } - (void) publishService { // Create a name for the service that include's this computer's name CFStringRef computerName = CSCopyMachineName(); NSString* serviceNameString = [NSString stringWithFormat:@"%@'s %@", (NSString*)computerName, kServiceNameString]; CFRelease(computerName); NSNetService* netService = [[NSNetService alloc] initWithDomain:@"" type:kServiceTypeString name:serviceNameString port:kListenPort]; // publish on the default domains [netService setDelegate:self]; [netService publish]; // NOTE : We are not handling any failure to publish cases // which is not a good idea. We should at least // Be checking for name collisions NSString* logString = [NSString stringWithFormat:@"published service type:%@ with name %@ on port %d", kServiceTypeString, kServiceNameString, kListenPort]; [appController_ appendStringToLog:logString]; } #pragma mark - #pragma mark Receiving -(void) handleIncomingConnection:(NSNotification*)notification { NSDictionary* userInfo = [notification userInfo]; NSFileHandle* connectedFileHandle = [userInfo objectForKey:NSFileHandleNotificationFileHandleItem]; if(connectedFileHandle) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readIncomingData:) name:NSFileHandleDataAvailableNotification object:connectedFileHandle]; [connectedFileHandles_ addObject:connectedFileHandle]; [appController_ appendStringToLog:@"Opened an incoming connection"]; [connectedFileHandle waitForDataInBackgroundAndNotify]; } [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; } - (void) readIncomingData:(NSNotification*) notification { NSFileHandle* readFileHandle = [notification object]; NSData* newData = [readFileHandle availableData]; NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; if ([newData length] == 0) { [appController_ appendStringToLog:@"No more data in file handle, closing"]; [self stopReceivingForFileHandle:readFileHandle closeFileHandle:YES]; return; } [appController_ appendStringToLog:@"Got a new message :"]; [appController_ appendStringToLog:[NSString stringWithUTF8String:[newData bytes]]]; // append the data to the data we have so far [dataSoFar appendData:newData]; [self parseDataRecieved:dataSoFar]; // wait for a read again [readFileHandle waitForDataInBackgroundAndNotify]; } - (void) parseDataRecieved:(NSMutableData*)dataSoFar { // Look for a token that indicates a complete message // and act on the message. Remove the message from the data so far // Currently our token is the null terminator 0x00 char token = 0x00; NSRange result = [dataSoFar rangeOfData:[NSData dataWithBytes:&token length:1] options:0 range:NSMakeRange(0, [dataSoFar length])]; if ( result.location != NSNotFound ) { NSData* messageData = [dataSoFar subdataWithRange:NSMakeRange(0, result.location+1)]; NSString* messageString = [NSString stringWithUTF8String:[messageData bytes]]; // act on the message NSLog(@"parsed message : %@", messageString); [self handleMessage:messageString]; // trim the message we have handled off the data received NSUInteger location = result.location + 1; NSUInteger length = [dataSoFar length] - [messageData length]; [dataSoFar setData:[dataSoFar subdataWithRange:NSMakeRange(location, length)]]; } } - (void) handleMessage:(NSString*)messageString { // Not reacting to any sent messages for now } - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle { NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data == nil ) { data = [NSMutableData data]; [dataForFileHandles_ setObject:data forKey:fileHandle]; } return data; } - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close { if (close) { [fileHandle closeFile]; [connectedFileHandles_ removeObject:fileHandle]; } NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data != nil ) { [dataForFileHandles_ removeObjectForKey:fileHandle]; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleDataAvailableNotification object:fileHandle]; } #pragma mark - #pragma mark Sending -- (void)asyncSendWithDictionary:(NSMutableDictionary*)sendArgumentsDictionary { - +- (void)sendWithDictionary:(NSMutableDictionary*)sendArgumentsDictionary +{ + // sendWithDictionary: has one parameter, a dictionary. + // This way, sendWithDictionary: can be called from performSelectorInBackground:withObject: + // The dictionary object contains multiple objects as "arguments" for use by the method NSFileHandle* connection = [sendArgumentsDictionary objectForKey:kConnectionKey]; NSData* imageSize = [sendArgumentsDictionary objectForKey:kImageSizeKey]; NSData* representationToSend = [sendArgumentsDictionary objectForKey:kRepresentationToSendKey]; [connection writeData:imageSize]; [connection writeData:representationToSend]; } - (void) sendImageToClients:(NSImage*)image { NSUInteger clientCount = [connectedFileHandles_ count]; if( clientCount <= 0 ) { [appController_ appendStringToLog:@"No clients connected, not sending"]; return; } NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; // NOTE : this will only work when the image has a bitmap representation of some type // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep // and then representationUsingType will fail // To do this better we could draw the image into an offscreen context // then save that context in a format like PNG // There are some downsides to this though, because for instance a jpeg will recompress // so you would want to use a rep when you have it and if not, create one. // NOTE 2: We could try to just send the file as data rather than // an NSImage. The problem is the iPhone doesn't support as many // image formats as the desktop. The translation to PNG insures // something the iPhone can display // The first thing we send is 4 bytes that represent the length of // of the image so that the client will know when a full image has // transfered - - + NSUInteger imageDataSize = [representationToSend length]; - // the length method returns an NSUInteger, which happens to be 64 bits // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits // we are simply going to not send anything that is so big that it // length is > 2^32, which should be fine considering the iPhone client // could not handle images that large anyway if ( imageDataSize > UINT32_MAX ) { [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; return; } // We also have to be careful and make sure that the bytes are in the proper order // when sent over the network using htonl() uint32 dataLength = htonl( (uint32)imageDataSize ); NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; for ( NSFileHandle* connection in connectedFileHandles_) { - // make a dictionary to hold multiple arguments in one object - // for performSelectorInBackground:withObject: + // make a dictionary for sendWithDictionary: NSMutableDictionary* sendArgumentsDictionary = [[NSMutableDictionary alloc] initWithObjectsAndKeys:connection, kConnectionKey, imageSize, kImageSizeKey, representationToSend, kRepresentationToSendKey, nil]; // send asynchronously to avoid locking up UI // Thanks to suggestions from Greg Anderson and Pam DeBriere - // including performSelectorInBackground:withObject: - [self performSelectorInBackground:@selector(asyncSendWithDictionary:) + // including using performSelectorInBackground:withObject: to create a new thread + + // Note: if iPhone client is stopped during send, application throws exception + // Currently exception is not handled and stops program execution + [self performSelectorInBackground:@selector(sendWithDictionary:) withObject:sendArgumentsDictionary]; [sendArgumentsDictionary release]; } [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; } @end
beepscore/GalleryDesktopService
73b4af75d073b30e42893ac43c5fcb572c187198
Change send from synchronous to asynchronous.
diff --git a/ApplicationController.m b/ApplicationController.m index ef1f5c8..744b00c 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,447 +1,449 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; @synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"russianRocket" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal (16 bit) if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // in IB, set progressIndicator to display when stopped. // usually the send completes quickly, especially when sending to the simulator. // if the progressIndicator is not set to display when stopped, // the send may complete before the progressIndicator and animation appear. // can test a "display when stopped" progressIndicator by attempting to send a pdf file, // which isn't supported and so takes forever [self.progressIndicator startAnimation:self]; // send NSImage [imageShareService_ sendImageToClients:image]; + // the send is asynchronous, so imageShareService_ could call back to stop the animation. + // for now, do a "quick and dirty" stop [self.progressIndicator stopAnimation:self]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model NSLog(@"number of images in the model = %d", [images_ count]); NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/ImageShareService.m b/ImageShareService.m index 29513f9..add4363 100644 --- a/ImageShareService.m +++ b/ImageShareService.m @@ -1,381 +1,391 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // -// ImageShareService.h +// ImageShareService.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and advertises its service via Bonjour // Sends an image to the connected clients #import "ImageShareService.h" #import "ApplicationController.h" #import <sys/socket.h> #import <netinet/in.h> NSString* const kServiceTypeString = @"_uwcelistener._tcp."; NSString* const kServiceNameString = @"Images"; const int kListenPort = 8082; +NSString* const kConnectionKey = @"connectionKey"; +NSString* const kImageSizeKey = @"imageSize"; +NSString* const kRepresentationToSendKey = @"representationToSend"; + @interface ImageShareService () - (void) parseDataRecieved:(NSMutableData*)dataSoFar; - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle; - (void) handleMessage:(NSString*)messageString; @end @implementation ImageShareService - (id) init { self = [super init]; if (self != nil) { appController_ = [ApplicationController sharedApplicationController]; socket_ = nil; connectionFileHandle_ = nil; dataForFileHandles_ = [[NSMutableDictionary dictionary] retain]; connectedFileHandles_ = [[NSMutableArray array] retain]; } return self; } - (void) dealloc { [dataForFileHandles_ release]; dataForFileHandles_ = nil; for (NSFileHandle* connection in connectedFileHandles_) { [connection closeFile]; } [connectedFileHandles_ release]; connectedFileHandles_ = nil; [super dealloc]; } - (BOOL) startService { socket_ = CFSocketCreate - ( - kCFAllocatorDefault, - PF_INET, - SOCK_STREAM, - IPPROTO_TCP, - 0, - NULL, - NULL - ); + ( + kCFAllocatorDefault, + PF_INET, + SOCK_STREAM, + IPPROTO_TCP, + 0, + NULL, + NULL + ); // Create a network socket for streaming TCP if (!socket_) { [appController_ appendStringToLog:@"Cound not create socket"]; return NO; } int reuse = true; int fileDescriptor = CFSocketGetNative(socket_); // Make sure socket is set for reuse of the address // without this, you may find that the socket is already in use // when restartnig and debugging int result = setsockopt( - fileDescriptor, - SOL_SOCKET, - SO_REUSEADDR, - (void *)&reuse, - sizeof(int) + fileDescriptor, + SOL_SOCKET, + SO_REUSEADDR, + (void *)&reuse, + sizeof(int) ); if ( result != 0) { [appController_ appendStringToLog:@"Unable to set socket options"]; return NO; } // Create the address for the scoket. // In this case we don't care what address is incoming // but we listen on a specific port - kLisenPort struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(kListenPort); CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); [(id)addressData autorelease]; // bind socket to the address if (CFSocketSetAddress(socket_, addressData) != kCFSocketSuccess) { [appController_ appendStringToLog:@"Unable to bind socket to address"]; return NO; } // setup listening to incoming connections // we will use notifications to respond // as we are not looking for high performance and want // to use the simpiler Cocoa NSFileHandle APIs connectionFileHandle_ = [[NSFileHandle alloc] initWithFileDescriptor:fileDescriptor closeOnDealloc:YES]; [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(handleIncomingConnection:) - name:NSFileHandleConnectionAcceptedNotification - object:nil]; + addObserver:self + selector:@selector(handleIncomingConnection:) + name:NSFileHandleConnectionAcceptedNotification + object:nil]; [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; NSString* logString = [NSString stringWithFormat:@"listening to socket on port %d", kListenPort]; [appController_ appendStringToLog:logString]; return YES; } - (void) publishService { // Create a name for the service that include's this computer's name CFStringRef computerName = CSCopyMachineName(); NSString* serviceNameString = [NSString stringWithFormat:@"%@'s %@", (NSString*)computerName, kServiceNameString]; CFRelease(computerName); NSNetService* netService = [[NSNetService alloc] initWithDomain:@"" - type:kServiceTypeString - name:serviceNameString - port:kListenPort]; + type:kServiceTypeString + name:serviceNameString + port:kListenPort]; // publish on the default domains [netService setDelegate:self]; [netService publish]; // NOTE : We are not handling any failure to publish cases // which is not a good idea. We should at least // Be checking for name collisions NSString* logString = [NSString stringWithFormat:@"published service type:%@ with name %@ on port %d", kServiceTypeString, kServiceNameString, kListenPort]; [appController_ appendStringToLog:logString]; } #pragma mark - #pragma mark Receiving -(void) handleIncomingConnection:(NSNotification*)notification { NSDictionary* userInfo = [notification userInfo]; NSFileHandle* connectedFileHandle = [userInfo objectForKey:NSFileHandleNotificationFileHandleItem]; if(connectedFileHandle) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readIncomingData:) name:NSFileHandleDataAvailableNotification object:connectedFileHandle]; [connectedFileHandles_ addObject:connectedFileHandle]; [appController_ appendStringToLog:@"Opened an incoming connection"]; [connectedFileHandle waitForDataInBackgroundAndNotify]; } [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; } - (void) readIncomingData:(NSNotification*) notification { NSFileHandle* readFileHandle = [notification object]; NSData* newData = [readFileHandle availableData]; NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; if ([newData length] == 0) { [appController_ appendStringToLog:@"No more data in file handle, closing"]; [self stopReceivingForFileHandle:readFileHandle closeFileHandle:YES]; return; } [appController_ appendStringToLog:@"Got a new message :"]; [appController_ appendStringToLog:[NSString stringWithUTF8String:[newData bytes]]]; // append the data to the data we have so far [dataSoFar appendData:newData]; [self parseDataRecieved:dataSoFar]; // wait for a read again [readFileHandle waitForDataInBackgroundAndNotify]; } - (void) parseDataRecieved:(NSMutableData*)dataSoFar { // Look for a token that indicates a complete message // and act on the message. Remove the message from the data so far // Currently our token is the null terminator 0x00 char token = 0x00; NSRange result = [dataSoFar rangeOfData:[NSData dataWithBytes:&token length:1] options:0 range:NSMakeRange(0, [dataSoFar length])]; if ( result.location != NSNotFound ) { NSData* messageData = [dataSoFar subdataWithRange:NSMakeRange(0, result.location+1)]; NSString* messageString = [NSString stringWithUTF8String:[messageData bytes]]; // act on the message NSLog(@"parsed message : %@", messageString); [self handleMessage:messageString]; // trim the message we have handled off the data received NSUInteger location = result.location + 1; NSUInteger length = [dataSoFar length] - [messageData length]; [dataSoFar setData:[dataSoFar subdataWithRange:NSMakeRange(location, length)]]; } } - (void) handleMessage:(NSString*)messageString { // Not reacting to any sent messages for now } - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle { NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data == nil ) { data = [NSMutableData data]; [dataForFileHandles_ setObject:data forKey:fileHandle]; } return data; } - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close { if (close) { [fileHandle closeFile]; [connectedFileHandles_ removeObject:fileHandle]; } NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data != nil ) { [dataForFileHandles_ removeObjectForKey:fileHandle]; } [[NSNotificationCenter defaultCenter] - removeObserver:self - name:NSFileHandleDataAvailableNotification - object:fileHandle]; + removeObserver:self + name:NSFileHandleDataAvailableNotification + object:fileHandle]; } #pragma mark - #pragma mark Sending +- (void)asyncSendWithDictionary:(NSMutableDictionary*)sendArgumentsDictionary { + + NSFileHandle* connection = [sendArgumentsDictionary objectForKey:kConnectionKey]; + NSData* imageSize = [sendArgumentsDictionary objectForKey:kImageSizeKey]; + NSData* representationToSend = [sendArgumentsDictionary objectForKey:kRepresentationToSendKey]; + + [connection writeData:imageSize]; + [connection writeData:representationToSend]; +} + - (void) sendImageToClients:(NSImage*)image { NSUInteger clientCount = [connectedFileHandles_ count]; if( clientCount <= 0 ) { [appController_ appendStringToLog:@"No clients connected, not sending"]; return; } - + NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; - + // NOTE : this will only work when the image has a bitmap representation of some type // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep // and then representationUsingType will fail // To do this better we could draw the image into an offscreen context // then save that context in a format like PNG // There are some downsides to this though, because for instance a jpeg will recompress // so you would want to use a rep when you have it and if not, create one. - + // NOTE 2: We could try to just send the file as data rather than // an NSImage. The problem is the iPhone doesn't support as many // image formats as the desktop. The translation to PNG insures // something the iPhone can display - + // The first thing we send is 4 bytes that represent the length of // of the image so that the client will know when a full image has // transfered NSUInteger imageDataSize = [representationToSend length]; + + // the length method returns an NSUInteger, which happens to be 64 bits + // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits + // we are simply going to not send anything that is so big that it + // length is > 2^32, which should be fine considering the iPhone client + // could not handle images that large anyway if ( imageDataSize > UINT32_MAX ) { [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; return; } + + // We also have to be careful and make sure that the bytes are in the proper order + // when sent over the network using htonl() uint32 dataLength = htonl( (uint32)imageDataSize ); NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; - - // the length method returns an NSUInteger, which happens to be 64 bits - // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits - // we are simply going to not send anything that is so big that it - // length is > 2^32, which should be fine considering the iPhone client - // could not handle images that large anyway - // We also have to be careful and make sure that the bytes are in the proper order - // when sent over the network using htonl() - - - //HW_TODO : - // - // HERE IS THE BONUS OPPORTUNITY! - // THIS SYNCHRONOUS SENDING IS TERRIBLE. THE UI LOCKS UP - // UNTIL THE IMAGE IS SENT - // 100 PTS FOR A SOLUTION THAT MAKES THIS AN ASYNCHRONOUS SEND - // THAT FREES UP THE UI IMMEDIATELY AFTER PRESSING SEND - // 23 BONUS PTS FOR A PROGRESS INDICATOR DURING THE SENDING - + + for ( NSFileHandle* connection in connectedFileHandles_) { - // First write out the size of the image data we are sending - // Then send the image - [connection writeData:imageSize]; - [connection writeData:representationToSend]; - } - - - [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; - + // make a dictionary to hold multiple arguments in one object + // for performSelectorInBackground:withObject: + NSMutableDictionary* sendArgumentsDictionary = + [[NSMutableDictionary alloc] initWithObjectsAndKeys:connection, kConnectionKey, + imageSize, kImageSizeKey, + representationToSend, kRepresentationToSendKey, nil]; + + // send asynchronously to avoid locking up UI + // Thanks to suggestions from Greg Anderson and Pam DeBriere + // including performSelectorInBackground:withObject: + [self performSelectorInBackground:@selector(asyncSendWithDictionary:) + withObject:sendArgumentsDictionary]; + [sendArgumentsDictionary release]; + } + [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; } - - @end
beepscore/GalleryDesktopService
e7e861d3d813ad7c69aa0411b6eb4371e36f796c
Delete soyuz image- it had white strip at bottom, could be confused with border.
diff --git a/ApplicationController.m b/ApplicationController.m index 6e2769f..ef1f5c8 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,447 +1,447 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; @synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; - NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"soyuz" ofType:@"png"]; + NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"russianRocket" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal (16 bit) if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // in IB, set progressIndicator to display when stopped. // usually the send completes quickly, especially when sending to the simulator. // if the progressIndicator is not set to display when stopped, // the send may complete before the progressIndicator and animation appear. // can test a "display when stopped" progressIndicator by attempting to send a pdf file, // which isn't supported and so takes forever [self.progressIndicator startAnimation:self]; // send NSImage [imageShareService_ sendImageToClients:image]; [self.progressIndicator stopAnimation:self]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model NSLog(@"number of images in the model = %d", [images_ count]); NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/GalleryDesktopService.xcodeproj/project.pbxproj b/GalleryDesktopService.xcodeproj/project.pbxproj index 70407f7..1dfc382 100644 --- a/GalleryDesktopService.xcodeproj/project.pbxproj +++ b/GalleryDesktopService.xcodeproj/project.pbxproj @@ -1,330 +1,330 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXBuildFile section */ 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */; }; 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCAC1196603D00069E79 /* QuartzCore.framework */; }; 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCB21196604C00069E79 /* Quartz.framework */; }; 018C928C1155977C003349E5 /* ImageShareService.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C928B1155977C003349E5 /* ImageShareService.m */; }; 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C92B211559ABF003349E5 /* ApplicationController.m */; }; 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; DE0E5073119BCA2500D4E903 /* README in Resources */ = {isa = PBXBuildFile; fileRef = DE0E5072119BCA2500D4E903 /* README */; }; - DE4BE952119E70F300A8BBFC /* soyuz.png in Resources */ = {isa = PBXBuildFile; fileRef = DE4BE951119E70F300A8BBFC /* soyuz.png */; }; DE4BE954119E712700A8BBFC /* sunRed.pdf in Resources */ = {isa = PBXBuildFile; fileRef = DE4BE953119E712700A8BBFC /* sunRed.pdf */; }; DE4BE956119E713900A8BBFC /* predict.gif in Resources */ = {isa = PBXBuildFile; fileRef = DE4BE955119E713900A8BBFC /* predict.gif */; }; + DE7DD88911A4BAC600F49795 /* russianRocket.png in Resources */ = {isa = PBXBuildFile; fileRef = DE7DD88811A4BAC600F49795 /* russianRocket.png */; }; DEBF281B119E24D100F3A293 /* baileySit100514.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DEBF281A119E24D100F3A293 /* baileySit100514.jpg */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePathImageObject.h; sourceTree = "<group>"; }; 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilePathImageObject.m; sourceTree = "<group>"; }; 0170BCAC1196603D00069E79 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0170BCB21196604C00069E79 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; 018C928A1155977C003349E5 /* ImageShareService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageShareService.h; sourceTree = "<group>"; }; 018C928B1155977C003349E5 /* ImageShareService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageShareService.m; sourceTree = "<group>"; }; 018C92B111559ABF003349E5 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = "<group>"; }; 018C92B211559ABF003349E5 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = "<group>"; }; 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopServiceAppDelegate.h; sourceTree = "<group>"; }; 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryDesktopServiceAppDelegate.m; sourceTree = "<group>"; }; 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopService_Prefix.pch; sourceTree = "<group>"; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GalleryDesktopService-Info.plist"; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* GalleryDesktopService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GalleryDesktopService.app; sourceTree = BUILT_PRODUCTS_DIR; }; DE0E5072119BCA2500D4E903 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; - DE4BE951119E70F300A8BBFC /* soyuz.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = soyuz.png; sourceTree = "<group>"; }; DE4BE953119E712700A8BBFC /* sunRed.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = sunRed.pdf; sourceTree = "<group>"; }; DE4BE955119E713900A8BBFC /* predict.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = predict.gif; sourceTree = "<group>"; }; + DE7DD88811A4BAC600F49795 /* russianRocket.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = russianRocket.png; sourceTree = "<group>"; }; DEBF281A119E24D100F3A293 /* baileySit100514.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = baileySit100514.jpg; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D11072E0486CEB800E47090 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */, 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( 018C92B111559ABF003349E5 /* ApplicationController.h */, 018C92B211559ABF003349E5 /* ApplicationController.m */, 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */, 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */, 018C928A1155977C003349E5 /* ImageShareService.h */, 018C928B1155977C003349E5 /* ImageShareService.m */, 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */, 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */, ); name = Classes; sourceTree = "<group>"; }; 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 0170BCAC1196603D00069E79 /* QuartzCore.framework */, 0170BCB21196604C00069E79 /* Quartz.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* GalleryDesktopService.app */, ); name = Products; sourceTree = "<group>"; }; 29B97314FDCFA39411CA2CEA /* DesktopService */ = { isa = PBXGroup; children = ( 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = DesktopService; sourceTree = "<group>"; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, ); name = "Other Sources"; sourceTree = "<group>"; }; 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( DEBF281A119E24D100F3A293 /* baileySit100514.jpg */, 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, DE4BE955119E713900A8BBFC /* predict.gif */, DE0E5072119BCA2500D4E903 /* README */, - DE4BE951119E70F300A8BBFC /* soyuz.png */, + DE7DD88811A4BAC600F49795 /* russianRocket.png */, DE4BE953119E712700A8BBFC /* sunRed.pdf */, ); name = Resources; sourceTree = "<group>"; }; 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8D1107260486CEB800E47090 /* GalleryDesktopService */ = { isa = PBXNativeTarget; buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */; buildPhases = ( 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, 8D11072E0486CEB800E47090 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = GalleryDesktopService; productInstallPath = "$(HOME)/Applications"; productName = DesktopService; productReference = 8D1107320486CEB800E47090 /* GalleryDesktopService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 29B97314FDCFA39411CA2CEA /* DesktopService */; projectDirPath = ""; projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* GalleryDesktopService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D1107290486CEB800E47090 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, DE0E5073119BCA2500D4E903 /* README in Resources */, DEBF281B119E24D100F3A293 /* baileySit100514.jpg in Resources */, - DE4BE952119E70F300A8BBFC /* soyuz.png in Resources */, DE4BE954119E712700A8BBFC /* sunRed.pdf in Resources */, DE4BE956119E713900A8BBFC /* predict.gif in Resources */, + DE7DD88911A4BAC600F49795 /* russianRocket.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D11072C0486CEB800E47090 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072D0486CEB800E47090 /* main.m in Sources */, 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */, 018C928C1155977C003349E5 /* ImageShareService.m in Sources */, 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */, 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C165DFE840E0CC02AAC07 /* English */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( 1DDD58150DA1D0A300B32029 /* English */, ); name = MainMenu.xib; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Debug; }; C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4B08A954540054247B /* Debug */, C01FCF4C08A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, C01FCF5008A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; } diff --git a/russianRocket.png b/russianRocket.png new file mode 100644 index 0000000..29132f7 Binary files /dev/null and b/russianRocket.png differ diff --git a/soyuz.png b/soyuz.png deleted file mode 100644 index 6b900b4..0000000 Binary files a/soyuz.png and /dev/null differ
beepscore/GalleryDesktopService
c8e137a6d71f115d8aef122f8e4c903f0a4e0c79
Add progress indicator for send.
diff --git a/ApplicationController.h b/ApplicationController.h index bae76cb..a65a889 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -1,44 +1,50 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // App controller is a singleton object // This class conforms to two IKImageBrowserView informal protocols: // IKImageBrowserDataSource and IKImageBrowserDelegate. #import <Cocoa/Cocoa.h> @class ImageShareService; @class IKImageBrowserView; @interface ApplicationController : NSObject { NSTextView* logTextField_; ImageShareService* imageShareService_; IKImageBrowserView* imageBrowser_; NSSlider* zoomSlider_; + // MVC Model object NSMutableArray* images_; + + NSProgressIndicator* progressIndicator; } - +// Apple recommends on Mac assign IBOutlet, on iPhone retain IBOutlet +// applies only to nib top-level objects? @property (nonatomic, assign) IBOutlet NSTextView* logTextField; @property (nonatomic, assign) IBOutlet IKImageBrowserView* imageBrowser; @property (nonatomic, assign) IBOutlet NSSlider* zoomSlider; +@property(nonatomic, assign)IBOutlet NSProgressIndicator *progressIndicator; + + (ApplicationController*)sharedApplicationController; - (void) startService; - (void) appendStringToLog:(NSString*)logString; - (IBAction) sendImage:(id)sender; - (IBAction) addImages:(id)sender; - (IBAction) zoomChanged:(id)sender; @end diff --git a/ApplicationController.m b/ApplicationController.m index 351410f..6e2769f 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,436 +1,447 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; +@synthesize progressIndicator; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; + [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"soyuz" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { - // L denotes a wide-character literal - if ( [filename characterAtIndex:0] == L'.') + // L denotes a wide-character literal (16 bit) + if ( L'.' == [filename characterAtIndex:0] ) return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if selectedImages is nil, don't try to select or send an image if (nil == selectedImages) { NSLog(@"selectedImages is nil"); return; } // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { NSLog(@"selectedImages count is zero"); return; } // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; // if no images were selected, don't try to send an image // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) if (NSNotFound == selectedImageIndex) { NSLog(@"selectedImageIndex not found"); return; } // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question // this check may be unnecessarily defensive programming if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { NSLog(@"selectedImageIndex outside of images_ array bounds"); return; } // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); - // send NSImage + // in IB, set progressIndicator to display when stopped. + // usually the send completes quickly, especially when sending to the simulator. + // if the progressIndicator is not set to display when stopped, + // the send may complete before the progressIndicator and animation appear. + // can test a "display when stopped" progressIndicator by attempting to send a pdf file, + // which isn't supported and so takes forever + [self.progressIndicator startAnimation:self]; + + // send NSImage [imageShareService_ sendImageToClients:image]; + + [self.progressIndicator stopAnimation:self]; [image release]; } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model - // [[view visibleItemIndexes] count] only counts visible items? - NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); + NSLog(@"number of images in the model = %d", [images_ count]); + NSLog(@"number of items visible = %d", [[view visibleItemIndexes] count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { - // HW_TODO : - // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX + // return the image model object at the given index return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index c2679dc..2d7a294 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1067,1028 +1067,1037 @@ <object class="NSMenuItem" id="163117631"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="31516759"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Writing Direction</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="956096989"> <string key="NSTitle">Writing Direction</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="257099033"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Paragraph</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="551969625"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="249532473"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="607364498"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="508151438"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="981751889"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Selection</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="380031999"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="825984362"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="560145579"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="908105787"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="644046920"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Show Ruler</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="231811626"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Copy Ruler</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="883618387"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Paste Ruler</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> </object> </object> </object> <object class="NSMenuItem" id="586577488"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">View</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="466310130"> <string key="NSTitle">View</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="102151532"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Show Toolbar</string> <string key="NSKeyEquiv">t</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="237841660"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Customize Toolbar…</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="713487014"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Window</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="835318025"> <string key="NSTitle">Window</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1011231497"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Minimize</string> <string key="NSKeyEquiv">m</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="575023229"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Zoom</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="299356726"> <reference key="NSMenu" ref="835318025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="625202149"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Bring All to Front</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSWindowsMenu</string> </object> </object> <object class="NSMenuItem" id="448692316"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Help</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="992780483"> <string key="NSTitle">Help</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="105068016"> <reference key="NSMenu" ref="992780483"/> <string key="NSTitle">DesktopService Help</string> <string key="NSKeyEquiv">?</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSHelpMenu</string> </object> </object> </object> <string key="NSName">_NSMainMenu</string> </object> <object class="NSWindowTemplate" id="972006081"> <int key="NSWindowStyleMask">15</int> <int key="NSWindowBacking">2</int> <string key="NSWindowRect">{{335, 81}, {1011, 669}}</string> <int key="NSWTFlags">1954021376</int> <string key="NSWindowTitle">GalleryDesktopService</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <string key="NSWindowContentMinSize">{720, 480}</string> <object class="NSView" key="NSWindowView" id="439893737"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextField" id="542196890"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 414}, {38, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="959611778"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Log</string> <object class="NSFont" key="NSSupport" id="1000618677"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="542196890"/> <object class="NSColor" key="NSBackgroundColor" id="760086907"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor" id="104511740"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> </object> </object> <object class="NSColor" key="NSTextColor" id="178691194"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlTextColor</string> <object class="NSColor" key="NSColor" id="733687712"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MAA</bytes> </object> </object> </object> </object> <object class="NSTextField" id="988469753"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 632}, {454, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="325691760"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Homework 7 :</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande-Bold</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="988469753"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSTextField" id="18745654"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 439}, {303, 185}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="833549254"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">272629760</int> <string type="base64-UTF8" key="NSContents">VGhpcyBhcHBsaWNhaXRvbiBwdWJsaXNoZXMgYSBzZXJ2aWNlIHZpYSBCb25qb3VyLiBBIGNvbXBhbmlv biBpUGhvbmUgYXBwbGljYXRpb24gYnJvd3NlcyBmb3IgdGhpcyBzZXJ2aWNlLiBDb25uZWN0ZWQgaVBo b25lIGNsaWVudHMgd2lsbCByZWNpZXZlIGFuIGltYWdlIGZyb20gdGhpcyBzZXJ2aWNlIHRvIGRpc3Bs YXkuIAoKVGhlIEltYWdlIGlzIHNlbGVjdGVkIGF0IHRoZSByaWdodCBhbmQgc2VudCB1c2luZyB0aGUg IlNlbmQgSW1hZ2UiIGJ1dHRvbi4gQWRkaXRpb25hbCBpbWFnZXMgb3IgZm9sZGVycyBvZiBpbWFnZXMg Y2FuIGJlIGFkZGVkIHRvIHRoZSBicm93c2VyIHVzaW5nIHRoZSAiQWRkIEltYWdlcy4uLiIgYnV0dG9u LiA</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="18745654"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSScrollView" id="305991980"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">4368</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="432592696"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextView" id="981802596"> <reference key="NSNextResponder" ref="432592696"/> <int key="NSvFlags">6418</int> <string key="NSFrameSize">{295, 14}</string> <reference key="NSSuperview" ref="432592696"/> <object class="NSTextContainer" key="NSTextContainer" id="735441310"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> <object class="NSMutableString" key="NSString"> <characters key="NS.bytes"/> </object> <nil key="NSDelegate"/> </object> <object class="NSMutableArray" key="NSTextContainers"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="735441310"/> </object> <int key="NSLMFlags">134</int> <nil key="NSDelegate"/> </object> <reference key="NSTextView" ref="981802596"/> <double key="NSWidth">295</double> <int key="NSTCFlags">1</int> </object> <object class="NSTextViewSharedData" key="NSSharedData"> <int key="NSFlags">11557</int> <int key="NSTextCheckingTypes">0</int> <nil key="NSMarkedAttributes"/> <object class="NSColor" key="NSBackgroundColor" id="786488440"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MQA</bytes> </object> <object class="NSDictionary" key="NSSelectedAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSBackgroundColor</string> <string>NSColor</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextBackgroundColor</string> <reference key="NSColor" ref="104511740"/> </object> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextColor</string> <reference key="NSColor" ref="733687712"/> </object> </object> </object> <reference key="NSInsertionColor" ref="733687712"/> <object class="NSDictionary" key="NSLinkAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSColor</string> <string>NSCursor</string> <string>NSUnderline</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">1</int> <bytes key="NSRGB">MCAwIDEAA</bytes> </object> <object class="NSCursor"> <string key="NSHotSpot">{8, -8}</string> <int key="NSCursorType">13</int> </object> <integer value="1"/> </object> </object> <nil key="NSDefaultParagraphStyle"/> </object> <int key="NSTVFlags">6</int> <string key="NSMaxSize">{463, 1e+07}</string> <string key="NSMinize">{223, 0}</string> <nil key="NSDelegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {295, 360}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSNextKeyView" ref="981802596"/> <reference key="NSDocView" ref="981802596"/> <reference key="NSBGColor" ref="786488440"/> <object class="NSCursor" key="NSCursor"> <string key="NSHotSpot">{4, -5}</string> <int key="NSCursorType">1</int> </object> <int key="NScvFlags">4</int> </object> <object class="NSScroller" id="786198283"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {15, 318}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.85256409645080566</double> </object> <object class="NSScroller" id="773550805"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {431, 15}}</string> <reference key="NSSuperview" ref="305991980"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">1</double> <double key="NSPercent">0.94565218687057495</double> </object> </object> <string key="NSFrame">{{20, 44}, {297, 362}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="432592696"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="786198283"/> <reference key="NSHScroller" ref="773550805"/> <reference key="NSContentView" ref="432592696"/> </object> <object class="NSButton" id="468638438"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{884, 8}, {113, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1061814889"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Send Image</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="468638438"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> + <object class="NSProgressIndicator" id="48802473"> + <reference key="NSNextResponder" ref="439893737"/> + <int key="NSvFlags">1313</int> + <object class="NSPSMatrix" key="NSDrawMatrix"/> + <string key="NSFrame">{{850, 10}, {32, 32}}</string> + <reference key="NSSuperview" ref="439893737"/> + <int key="NSpiFlags">20490</int> + <double key="NSMaxValue">100</double> + </object> <object class="NSButton" id="934936218"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{757, 8}, {127, 32}}</string> + <string key="NSFrame">{{629, 8}, {127, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="367445469"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Add Images...</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="934936218"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSSlider" id="562298877"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">256</int> <string key="NSFrame">{{325, 20}, {100, 16}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="589268444"> <int key="NSCellFlags">-2079981824</int> <int key="NSCellFlags2">262144</int> <string key="NSContents"/> <reference key="NSControlView" ref="562298877"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.5714285714285714</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">8</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">YES</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSScrollView" id="352236955"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">274</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="302360068"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IKImageBrowserView" id="887580421"> <reference key="NSNextResponder" ref="302360068"/> <int key="NSvFlags">18</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple PDF pasteboard type</string> <string>Apple PICT pasteboard type</string> <string>Apple PNG pasteboard type</string> <string>Apple URL pasteboard type</string> <string>NSFilenamesPboardType</string> <string>NSTypedFilenamesPboardType:'.SGI'</string> <string>NSTypedFilenamesPboardType:'8BPS'</string> <string>NSTypedFilenamesPboardType:'BMP '</string> <string>NSTypedFilenamesPboardType:'BMPf'</string> <string>NSTypedFilenamesPboardType:'EPSF'</string> <string>NSTypedFilenamesPboardType:'FPix'</string> <string>NSTypedFilenamesPboardType:'GIFf'</string> <string>NSTypedFilenamesPboardType:'ICO '</string> <string>NSTypedFilenamesPboardType:'JPEG'</string> <string>NSTypedFilenamesPboardType:'PDF '</string> <string>NSTypedFilenamesPboardType:'PICT'</string> <string>NSTypedFilenamesPboardType:'PNGf'</string> <string>NSTypedFilenamesPboardType:'PNTG'</string> <string>NSTypedFilenamesPboardType:'TIFF'</string> <string>NSTypedFilenamesPboardType:'TPIC'</string> <string>NSTypedFilenamesPboardType:'icns'</string> <string>NSTypedFilenamesPboardType:'jp2 '</string> <string>NSTypedFilenamesPboardType:'qtif'</string> <string>NSTypedFilenamesPboardType:3FR</string> <string>NSTypedFilenamesPboardType:3fr</string> <string>NSTypedFilenamesPboardType:ARW</string> <string>NSTypedFilenamesPboardType:BMP</string> <string>NSTypedFilenamesPboardType:CR2</string> <string>NSTypedFilenamesPboardType:CRW</string> <string>NSTypedFilenamesPboardType:CUR</string> <string>NSTypedFilenamesPboardType:DCR</string> <string>NSTypedFilenamesPboardType:DNG</string> <string>NSTypedFilenamesPboardType:EFX</string> <string>NSTypedFilenamesPboardType:EPI</string> <string>NSTypedFilenamesPboardType:EPS</string> <string>NSTypedFilenamesPboardType:EPSF</string> <string>NSTypedFilenamesPboardType:EPSI</string> <string>NSTypedFilenamesPboardType:ERF</string> <string>NSTypedFilenamesPboardType:EXR</string> <string>NSTypedFilenamesPboardType:FAX</string> <string>NSTypedFilenamesPboardType:FFF</string> <string>NSTypedFilenamesPboardType:FPIX</string> <string>NSTypedFilenamesPboardType:FPX</string> <string>NSTypedFilenamesPboardType:G3</string> <string>NSTypedFilenamesPboardType:GIF</string> <string>NSTypedFilenamesPboardType:HDR</string> <string>NSTypedFilenamesPboardType:ICNS</string> <string>NSTypedFilenamesPboardType:ICO</string> <string>NSTypedFilenamesPboardType:JFAX</string> <string>NSTypedFilenamesPboardType:JFX</string> <string>NSTypedFilenamesPboardType:JP2</string> <string>NSTypedFilenamesPboardType:JPE</string> <string>NSTypedFilenamesPboardType:JPEG</string> <string>NSTypedFilenamesPboardType:JPF</string> <string>NSTypedFilenamesPboardType:JPG</string> <string>NSTypedFilenamesPboardType:MAC</string> <string>NSTypedFilenamesPboardType:MOS</string> <string>NSTypedFilenamesPboardType:MRW</string> <string>NSTypedFilenamesPboardType:NEF</string> <string>NSTypedFilenamesPboardType:NRW</string> <string>NSTypedFilenamesPboardType:ORF</string> <string>NSTypedFilenamesPboardType:PCT</string> <string>NSTypedFilenamesPboardType:PDF</string> <string>NSTypedFilenamesPboardType:PEF</string> <string>NSTypedFilenamesPboardType:PIC</string> <string>NSTypedFilenamesPboardType:PICT</string> <string>NSTypedFilenamesPboardType:PNG</string> <string>NSTypedFilenamesPboardType:PNT</string> <string>NSTypedFilenamesPboardType:PNTG</string> <string>NSTypedFilenamesPboardType:PS</string> <string>NSTypedFilenamesPboardType:PSD</string> <string>NSTypedFilenamesPboardType:QTI</string> <string>NSTypedFilenamesPboardType:QTIF</string> <string>NSTypedFilenamesPboardType:RAF</string> <string>NSTypedFilenamesPboardType:RAW</string> <string>NSTypedFilenamesPboardType:RGB</string> <string>NSTypedFilenamesPboardType:RW2</string> <string>NSTypedFilenamesPboardType:RWL</string> <string>NSTypedFilenamesPboardType:SGI</string> <string>NSTypedFilenamesPboardType:SR2</string> <string>NSTypedFilenamesPboardType:SRF</string> <string>NSTypedFilenamesPboardType:TARGA</string> <string>NSTypedFilenamesPboardType:TGA</string> <string>NSTypedFilenamesPboardType:TIF</string> <string>NSTypedFilenamesPboardType:TIFF</string> <string>NSTypedFilenamesPboardType:XBM</string> <string>NSTypedFilenamesPboardType:arw</string> <string>NSTypedFilenamesPboardType:bmp</string> <string>NSTypedFilenamesPboardType:cr2</string> <string>NSTypedFilenamesPboardType:crw</string> <string>NSTypedFilenamesPboardType:cur</string> <string>NSTypedFilenamesPboardType:dcr</string> <string>NSTypedFilenamesPboardType:dng</string> <string>NSTypedFilenamesPboardType:efx</string> <string>NSTypedFilenamesPboardType:epi</string> <string>NSTypedFilenamesPboardType:eps</string> <string>NSTypedFilenamesPboardType:epsf</string> <string>NSTypedFilenamesPboardType:epsi</string> <string>NSTypedFilenamesPboardType:erf</string> <string>NSTypedFilenamesPboardType:exr</string> <string>NSTypedFilenamesPboardType:fax</string> <string>NSTypedFilenamesPboardType:fff</string> <string>NSTypedFilenamesPboardType:fpix</string> <string>NSTypedFilenamesPboardType:fpx</string> <string>NSTypedFilenamesPboardType:g3</string> <string>NSTypedFilenamesPboardType:gif</string> <string>NSTypedFilenamesPboardType:hdr</string> <string>NSTypedFilenamesPboardType:icns</string> <string>NSTypedFilenamesPboardType:ico</string> <string>NSTypedFilenamesPboardType:jfax</string> <string>NSTypedFilenamesPboardType:jfx</string> <string>NSTypedFilenamesPboardType:jp2</string> <string>NSTypedFilenamesPboardType:jpe</string> <string>NSTypedFilenamesPboardType:jpeg</string> <string>NSTypedFilenamesPboardType:jpf</string> <string>NSTypedFilenamesPboardType:jpg</string> <string>NSTypedFilenamesPboardType:mac</string> <string>NSTypedFilenamesPboardType:mos</string> <string>NSTypedFilenamesPboardType:mrw</string> <string>NSTypedFilenamesPboardType:nef</string> <string>NSTypedFilenamesPboardType:nrw</string> <string>NSTypedFilenamesPboardType:orf</string> <string>NSTypedFilenamesPboardType:pct</string> <string>NSTypedFilenamesPboardType:pdf</string> <string>NSTypedFilenamesPboardType:pef</string> <string>NSTypedFilenamesPboardType:pic</string> <string>NSTypedFilenamesPboardType:pict</string> <string>NSTypedFilenamesPboardType:png</string> <string>NSTypedFilenamesPboardType:pnt</string> <string>NSTypedFilenamesPboardType:pntg</string> <string>NSTypedFilenamesPboardType:ps</string> <string>NSTypedFilenamesPboardType:psd</string> <string>NSTypedFilenamesPboardType:qti</string> <string>NSTypedFilenamesPboardType:qtif</string> <string>NSTypedFilenamesPboardType:raf</string> <string>NSTypedFilenamesPboardType:raw</string> <string>NSTypedFilenamesPboardType:rgb</string> <string>NSTypedFilenamesPboardType:rw2</string> <string>NSTypedFilenamesPboardType:rwl</string> <string>NSTypedFilenamesPboardType:sgi</string> <string>NSTypedFilenamesPboardType:sr2</string> <string>NSTypedFilenamesPboardType:srf</string> <string>NSTypedFilenamesPboardType:targa</string> <string>NSTypedFilenamesPboardType:tga</string> <string>NSTypedFilenamesPboardType:tif</string> <string>NSTypedFilenamesPboardType:tiff</string> <string>NSTypedFilenamesPboardType:xbm</string> <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> <string>NeXT TIFF v4.0 pasteboard type</string> </object> </object> <string key="NSFrameSize">{664, 603}</string> <reference key="NSSuperview" ref="302360068"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="constrainsToOriginalSize">NO</bool> <bool key="cellsHaveSubtitle">NO</bool> <bool key="cellsHaveTitle">NO</bool> <bool key="outlinesCells">NO</bool> <bool key="shadowsCells">YES</bool> <bool key="animates">NO</bool> <bool key="allowsReordering">YES</bool> <bool key="allowsMultipleSelection">NO</bool> <float key="cellWidth">100</float> <float key="cellHeight">100</float> <reference key="dataSource"/> <reference key="delegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {664, 603}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSNextKeyView" ref="887580421"/> <reference key="NSDocView" ref="887580421"/> <reference key="NSBGColor" ref="760086907"/> <int key="NScvFlags">6</int> </object> <object class="NSScroller" id="1064542466"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{575, 1}, {15, 588}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">0.98009950248756217</double> <double key="NSPercent">0.96363627910614014</double> </object> <object class="NSScroller" id="242271987"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 589}, {574, 15}}</string> <reference key="NSSuperview" ref="352236955"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.50602412223815918</double> </object> </object> <string key="NSFrame">{{325, 44}, {666, 605}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="302360068"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="1064542466"/> <reference key="NSHScroller" ref="242271987"/> <reference key="NSContentView" ref="302360068"/> <bytes key="NSScrollAmts">QSAAAEEgAABDAszNQvAAAA</bytes> </object> </object> <string key="NSFrameSize">{1011, 669}</string> <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{720, 502}</string> <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> </object> <object class="NSCustomObject" id="976324537"> <string key="NSClassName">GalleryDesktopServiceAppDelegate</string> </object> <object class="NSCustomObject" id="755631768"> <string key="NSClassName">NSFontManager</string> </object> <object class="NSUserDefaultsController" id="1054695559"> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSCustomObject" id="295914207"> <string key="NSClassName">ApplicationController</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performMiniaturize:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1011231497"/> </object> <int key="connectionID">37</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">arrangeInFront:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="625202149"/> </object> <int key="connectionID">39</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">print:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="49223823"/> </object> <int key="connectionID">86</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">runPageLayout:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="294629803"/> </object> <int key="connectionID">87</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">clearRecentDocuments:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="759406840"/> </object> <int key="connectionID">127</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontStandardAboutPanel:</string> <reference key="source" ref="1021"/> <reference key="destination" ref="238522557"/> </object> <int key="connectionID">142</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performClose:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="776162233"/> </object> <int key="connectionID">193</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleContinuousSpellChecking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="948374510"/> </object> <int key="connectionID">222</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">undo:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1058277027"/> </object> <int key="connectionID">223</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copy:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="860595796"/> </object> <int key="connectionID">224</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">checkSpelling:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="96193923"/> </object> <int key="connectionID">225</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">paste:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="29853731"/> </object> <int key="connectionID">226</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">stopSpeaking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="680220178"/> </object> <int key="connectionID">227</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">cut:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="296257095"/> </object> <int key="connectionID">228</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">showGuessPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="679648819"/> </object> <int key="connectionID">230</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">redo:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="790794224"/> </object> <int key="connectionID">231</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">selectAll:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="583158037"/> </object> <int key="connectionID">232</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">startSpeaking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="731782645"/> </object> <int key="connectionID">233</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">delete:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="437104165"/> </object> <int key="connectionID">235</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performZoom:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="575023229"/> </object> <int key="connectionID">240</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="447796847"/> </object> <int key="connectionID">241</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">centerSelectionInVisibleArea:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="88285865"/> </object> <int key="connectionID">245</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleGrammarChecking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="967646866"/> </object> <int key="connectionID">347</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleSmartInsertDelete:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="605118523"/> </object> <int key="connectionID">355</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticQuoteSubstitution:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="197661976"/> </object> <int key="connectionID">356</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticLinkDetection:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="708854459"/> </object> <int key="connectionID">357</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">saveDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1023925487"/> </object> <int key="connectionID">362</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">saveDocumentAs:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="117038363"/> </object> <int key="connectionID">363</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">revertDocumentToSaved:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="579971712"/> @@ -2138,3135 +2147,3161 @@ LiA</string> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">newDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="705341025"/> </object> <int key="connectionID">373</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">openDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="722745758"/> </object> <int key="connectionID">374</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">addFontTrait:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="305399458"/> </object> <int key="connectionID">421</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">addFontTrait:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="814362025"/> </object> <int key="connectionID">422</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">modifyFont:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="885547335"/> </object> <int key="connectionID">423</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontFontPanel:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="159677712"/> </object> <int key="connectionID">424</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">modifyFont:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="158063935"/> </object> <int key="connectionID">425</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">raiseBaseline:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="941806246"/> </object> <int key="connectionID">426</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">lowerBaseline:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1045724900"/> </object> <int key="connectionID">427</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copyFont:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="596732606"/> </object> <int key="connectionID">428</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">subscript:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1037576581"/> </object> <int key="connectionID">429</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">superscript:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="644725453"/> </object> <int key="connectionID">430</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">tightenKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="677519740"/> </object> <int key="connectionID">431</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">underline:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="330926929"/> </object> <int key="connectionID">432</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontColorPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1012600125"/> </object> <int key="connectionID">433</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">useAllLigatures:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="663508465"/> </object> <int key="connectionID">434</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">loosenKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="238351151"/> </object> <int key="connectionID">435</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">pasteFont:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="393423671"/> </object> <int key="connectionID">436</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">unscript:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="257962622"/> </object> <int key="connectionID">437</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">useStandardKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="252969304"/> </object> <int key="connectionID">438</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">useStandardLigatures:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="706297211"/> </object> <int key="connectionID">439</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">turnOffLigatures:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="568384683"/> </object> <int key="connectionID">440</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">turnOffKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="766922938"/> </object> <int key="connectionID">441</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">terminate:</string> <reference key="source" ref="1050"/> <reference key="destination" ref="632727374"/> </object> <int key="connectionID">449</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticSpellingCorrection:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="795346622"/> </object> <int key="connectionID">456</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontSubstitutionsPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="65139061"/> </object> <int key="connectionID">458</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticDashSubstitution:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="672708820"/> </object> <int key="connectionID">461</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticTextReplacement:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="537092702"/> </object> <int key="connectionID">463</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">uppercaseWord:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1060694897"/> </object> <int key="connectionID">464</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">capitalizeWord:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="56570060"/> </object> <int key="connectionID">467</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">lowercaseWord:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="879586729"/> </object> <int key="connectionID">468</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">pasteAsPlainText:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="82994268"/> </object> <int key="connectionID">486</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="326711663"/> </object> <int key="connectionID">487</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="270902937"/> </object> <int key="connectionID">488</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="159080638"/> </object> <int key="connectionID">489</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">showHelp:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="105068016"/> </object> <int key="connectionID">493</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="1021"/> <reference key="destination" ref="976324537"/> </object> <int key="connectionID">495</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignCenter:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="630155264"/> </object> <int key="connectionID">518</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">pasteRuler:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="883618387"/> </object> <int key="connectionID">519</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleRuler:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="644046920"/> </object> <int key="connectionID">520</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="512868991"/> </object> <int key="connectionID">521</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copyRuler:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="231811626"/> </object> <int key="connectionID">522</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignJustified:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="945678886"/> </object> <int key="connectionID">523</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="875092757"/> </object> <int key="connectionID">524</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionNatural:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="551969625"/> </object> <int key="connectionID">525</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionLeftToRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="249532473"/> </object> <int key="connectionID">526</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionRightToLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="607364498"/> </object> <int key="connectionID">527</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionNatural:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="380031999"/> </object> <int key="connectionID">528</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionLeftToRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="825984362"/> </object> <int key="connectionID">529</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionRightToLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="560145579"/> </object> <int key="connectionID">530</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">window</string> <reference key="source" ref="976324537"/> <reference key="destination" ref="972006081"/> </object> <int key="connectionID">532</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">logTextField</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="981802596"/> </object> <int key="connectionID">549</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">appController</string> <reference key="source" ref="976324537"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">550</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">sendImage:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="468638438"/> </object> <int key="connectionID">589</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">imageBrowser</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="887580421"/> </object> <int key="connectionID">594</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">dataSource</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">603</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">604</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">dragDestinationDelegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">605</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">zoomSlider</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="562298877"/> </object> <int key="connectionID">614</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">addImages:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="934936218"/> </object> <int key="connectionID">615</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_dragDestinationDelegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">616</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_delegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">617</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_dataSource</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">618</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">zoomChanged:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="562298877"/> </object> <int key="connectionID">619</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">progressIndicator</string> + <reference key="source" ref="295914207"/> + <reference key="destination" ref="48802473"/> + </object> + <int key="connectionID">623</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> <reference key="object" ref="0"/> <reference key="children" ref="1048"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="1021"/> <reference key="parent" ref="0"/> <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1014"/> <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1050"/> <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> <int key="objectID">29</int> <reference key="object" ref="649796088"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="713487014"/> <reference ref="694149608"/> <reference ref="952259628"/> <reference ref="379814623"/> <reference ref="586577488"/> <reference ref="302598603"/> <reference ref="448692316"/> </object> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">19</int> <reference key="object" ref="713487014"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="835318025"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">56</int> <reference key="object" ref="694149608"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="110575045"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">217</int> <reference key="object" ref="952259628"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="789758025"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">83</int> <reference key="object" ref="379814623"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="720053764"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">81</int> <reference key="object" ref="720053764"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1023925487"/> <reference ref="117038363"/> <reference ref="49223823"/> <reference ref="722745758"/> <reference ref="705341025"/> <reference ref="1025936716"/> <reference ref="294629803"/> <reference ref="776162233"/> <reference ref="425164168"/> <reference ref="579971712"/> <reference ref="1010469920"/> </object> <reference key="parent" ref="379814623"/> </object> <object class="IBObjectRecord"> <int key="objectID">75</int> <reference key="object" ref="1023925487"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">80</int> <reference key="object" ref="117038363"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">78</int> <reference key="object" ref="49223823"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">72</int> <reference key="object" ref="722745758"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">82</int> <reference key="object" ref="705341025"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">124</int> <reference key="object" ref="1025936716"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1065607017"/> </object> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">77</int> <reference key="object" ref="294629803"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">73</int> <reference key="object" ref="776162233"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">79</int> <reference key="object" ref="425164168"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">112</int> <reference key="object" ref="579971712"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">74</int> <reference key="object" ref="1010469920"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">125</int> <reference key="object" ref="1065607017"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="759406840"/> </object> <reference key="parent" ref="1025936716"/> </object> <object class="IBObjectRecord"> <int key="objectID">126</int> <reference key="object" ref="759406840"/> <reference key="parent" ref="1065607017"/> </object> <object class="IBObjectRecord"> <int key="objectID">205</int> <reference key="object" ref="789758025"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="437104165"/> <reference ref="583158037"/> <reference ref="1058277027"/> <reference ref="212016141"/> <reference ref="296257095"/> <reference ref="29853731"/> <reference ref="860595796"/> <reference ref="1040322652"/> <reference ref="790794224"/> <reference ref="892235320"/> <reference ref="972420730"/> <reference ref="676164635"/> <reference ref="507821607"/> <reference ref="288088188"/> <reference ref="82994268"/> </object> <reference key="parent" ref="952259628"/> </object> <object class="IBObjectRecord"> <int key="objectID">202</int> <reference key="object" ref="437104165"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">198</int> <reference key="object" ref="583158037"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">207</int> <reference key="object" ref="1058277027"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">214</int> <reference key="object" ref="212016141"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">199</int> <reference key="object" ref="296257095"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">203</int> <reference key="object" ref="29853731"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">197</int> <reference key="object" ref="860595796"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">206</int> <reference key="object" ref="1040322652"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">215</int> <reference key="object" ref="790794224"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">218</int> <reference key="object" ref="892235320"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="963351320"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">216</int> <reference key="object" ref="972420730"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="769623530"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">200</int> <reference key="object" ref="769623530"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="948374510"/> <reference ref="96193923"/> <reference ref="679648819"/> <reference ref="967646866"/> <reference ref="859480356"/> <reference ref="795346622"/> </object> <reference key="parent" ref="972420730"/> </object> <object class="IBObjectRecord"> <int key="objectID">219</int> <reference key="object" ref="948374510"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">201</int> <reference key="object" ref="96193923"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">204</int> <reference key="object" ref="679648819"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">220</int> <reference key="object" ref="963351320"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="270902937"/> <reference ref="88285865"/> <reference ref="159080638"/> <reference ref="326711663"/> <reference ref="447796847"/> </object> <reference key="parent" ref="892235320"/> </object> <object class="IBObjectRecord"> <int key="objectID">213</int> <reference key="object" ref="270902937"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">210</int> <reference key="object" ref="88285865"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">221</int> <reference key="object" ref="159080638"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">208</int> <reference key="object" ref="326711663"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">209</int> <reference key="object" ref="447796847"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">57</int> <reference key="object" ref="110575045"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="238522557"/> <reference ref="755159360"/> <reference ref="908899353"/> <reference ref="632727374"/> <reference ref="646227648"/> <reference ref="609285721"/> <reference ref="481834944"/> <reference ref="304266470"/> <reference ref="1046388886"/> <reference ref="1056857174"/> <reference ref="342932134"/> </object> <reference key="parent" ref="694149608"/> </object> <object class="IBObjectRecord"> <int key="objectID">58</int> <reference key="object" ref="238522557"/> <reference key="parent" ref="110575045"/> <string key="objectName">Menu Item (About GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">134</int> <reference key="object" ref="755159360"/> <reference key="parent" ref="110575045"/> <string key="objectName">Menu Item (Hide GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">150</int> <reference key="object" ref="908899353"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">136</int> <reference key="object" ref="632727374"/> <reference key="parent" ref="110575045"/> <string key="objectName">Menu Item (Quit GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">144</int> <reference key="object" ref="646227648"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">129</int> <reference key="object" ref="609285721"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">143</int> <reference key="object" ref="481834944"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">236</int> <reference key="object" ref="304266470"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">131</int> <reference key="object" ref="1046388886"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="752062318"/> </object> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">149</int> <reference key="object" ref="1056857174"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">145</int> <reference key="object" ref="342932134"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">130</int> <reference key="object" ref="752062318"/> <reference key="parent" ref="1046388886"/> </object> <object class="IBObjectRecord"> <int key="objectID">24</int> <reference key="object" ref="835318025"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="299356726"/> <reference ref="625202149"/> <reference ref="575023229"/> <reference ref="1011231497"/> </object> <reference key="parent" ref="713487014"/> </object> <object class="IBObjectRecord"> <int key="objectID">92</int> <reference key="object" ref="299356726"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">5</int> <reference key="object" ref="625202149"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">239</int> <reference key="object" ref="575023229"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">23</int> <reference key="object" ref="1011231497"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">295</int> <reference key="object" ref="586577488"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="466310130"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">296</int> <reference key="object" ref="466310130"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="102151532"/> <reference ref="237841660"/> </object> <reference key="parent" ref="586577488"/> </object> <object class="IBObjectRecord"> <int key="objectID">297</int> <reference key="object" ref="102151532"/> <reference key="parent" ref="466310130"/> </object> <object class="IBObjectRecord"> <int key="objectID">298</int> <reference key="object" ref="237841660"/> <reference key="parent" ref="466310130"/> </object> <object class="IBObjectRecord"> <int key="objectID">211</int> <reference key="object" ref="676164635"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="785027613"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">212</int> <reference key="object" ref="785027613"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="680220178"/> <reference ref="731782645"/> </object> <reference key="parent" ref="676164635"/> </object> <object class="IBObjectRecord"> <int key="objectID">195</int> <reference key="object" ref="680220178"/> <reference key="parent" ref="785027613"/> </object> <object class="IBObjectRecord"> <int key="objectID">196</int> <reference key="object" ref="731782645"/> <reference key="parent" ref="785027613"/> </object> <object class="IBObjectRecord"> <int key="objectID">346</int> <reference key="object" ref="967646866"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">348</int> <reference key="object" ref="507821607"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="698887838"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">349</int> <reference key="object" ref="698887838"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="605118523"/> <reference ref="197661976"/> <reference ref="708854459"/> <reference ref="65139061"/> <reference ref="19036812"/> <reference ref="672708820"/> <reference ref="537092702"/> </object> <reference key="parent" ref="507821607"/> </object> <object class="IBObjectRecord"> <int key="objectID">350</int> <reference key="object" ref="605118523"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">351</int> <reference key="object" ref="197661976"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">354</int> <reference key="object" ref="708854459"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">371</int> <reference key="object" ref="972006081"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="439893737"/> </object> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">372</int> <reference key="object" ref="439893737"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="988469753"/> <reference ref="542196890"/> <reference ref="18745654"/> <reference ref="305991980"/> <reference ref="468638438"/> - <reference ref="934936218"/> <reference ref="562298877"/> <reference ref="352236955"/> + <reference ref="934936218"/> + <reference ref="48802473"/> </object> <reference key="parent" ref="972006081"/> </object> <object class="IBObjectRecord"> <int key="objectID">375</int> <reference key="object" ref="302598603"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="941447902"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">376</int> <reference key="object" ref="941447902"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="792887677"/> <reference ref="215659978"/> </object> <reference key="parent" ref="302598603"/> </object> <object class="IBObjectRecord"> <int key="objectID">377</int> <reference key="object" ref="792887677"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="786677654"/> </object> <reference key="parent" ref="941447902"/> </object> <object class="IBObjectRecord"> <int key="objectID">388</int> <reference key="object" ref="786677654"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="159677712"/> <reference ref="305399458"/> <reference ref="814362025"/> <reference ref="330926929"/> <reference ref="533507878"/> <reference ref="158063935"/> <reference ref="885547335"/> <reference ref="901062459"/> <reference ref="767671776"/> <reference ref="691570813"/> <reference ref="769124883"/> <reference ref="739652853"/> <reference ref="1012600125"/> <reference ref="214559597"/> <reference ref="596732606"/> <reference ref="393423671"/> </object> <reference key="parent" ref="792887677"/> </object> <object class="IBObjectRecord"> <int key="objectID">389</int> <reference key="object" ref="159677712"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">390</int> <reference key="object" ref="305399458"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">391</int> <reference key="object" ref="814362025"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">392</int> <reference key="object" ref="330926929"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">393</int> <reference key="object" ref="533507878"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">394</int> <reference key="object" ref="158063935"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">395</int> <reference key="object" ref="885547335"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">396</int> <reference key="object" ref="901062459"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">397</int> <reference key="object" ref="767671776"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="175441468"/> </object> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">398</int> <reference key="object" ref="691570813"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1058217995"/> </object> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">399</int> <reference key="object" ref="769124883"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="18263474"/> </object> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">400</int> <reference key="object" ref="739652853"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">401</int> <reference key="object" ref="1012600125"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">402</int> <reference key="object" ref="214559597"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">403</int> <reference key="object" ref="596732606"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">404</int> <reference key="object" ref="393423671"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">405</int> <reference key="object" ref="18263474"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="257962622"/> <reference ref="644725453"/> <reference ref="1037576581"/> <reference ref="941806246"/> <reference ref="1045724900"/> </object> <reference key="parent" ref="769124883"/> </object> <object class="IBObjectRecord"> <int key="objectID">406</int> <reference key="object" ref="257962622"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">407</int> <reference key="object" ref="644725453"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">408</int> <reference key="object" ref="1037576581"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">409</int> <reference key="object" ref="941806246"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">410</int> <reference key="object" ref="1045724900"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">411</int> <reference key="object" ref="1058217995"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="706297211"/> <reference ref="568384683"/> <reference ref="663508465"/> </object> <reference key="parent" ref="691570813"/> </object> <object class="IBObjectRecord"> <int key="objectID">412</int> <reference key="object" ref="706297211"/> <reference key="parent" ref="1058217995"/> </object> <object class="IBObjectRecord"> <int key="objectID">413</int> <reference key="object" ref="568384683"/> <reference key="parent" ref="1058217995"/> </object> <object class="IBObjectRecord"> <int key="objectID">414</int> <reference key="object" ref="663508465"/> <reference key="parent" ref="1058217995"/> </object> <object class="IBObjectRecord"> <int key="objectID">415</int> <reference key="object" ref="175441468"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="252969304"/> <reference ref="766922938"/> <reference ref="677519740"/> <reference ref="238351151"/> </object> <reference key="parent" ref="767671776"/> </object> <object class="IBObjectRecord"> <int key="objectID">416</int> <reference key="object" ref="252969304"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">417</int> <reference key="object" ref="766922938"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">418</int> <reference key="object" ref="677519740"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">419</int> <reference key="object" ref="238351151"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">420</int> <reference key="object" ref="755631768"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">450</int> <reference key="object" ref="288088188"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="579392910"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">451</int> <reference key="object" ref="579392910"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1060694897"/> <reference ref="879586729"/> <reference ref="56570060"/> </object> <reference key="parent" ref="288088188"/> </object> <object class="IBObjectRecord"> <int key="objectID">452</int> <reference key="object" ref="1060694897"/> <reference key="parent" ref="579392910"/> </object> <object class="IBObjectRecord"> <int key="objectID">453</int> <reference key="object" ref="859480356"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">454</int> <reference key="object" ref="795346622"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">457</int> <reference key="object" ref="65139061"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">459</int> <reference key="object" ref="19036812"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">460</int> <reference key="object" ref="672708820"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">462</int> <reference key="object" ref="537092702"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">465</int> <reference key="object" ref="879586729"/> <reference key="parent" ref="579392910"/> </object> <object class="IBObjectRecord"> <int key="objectID">466</int> <reference key="object" ref="56570060"/> <reference key="parent" ref="579392910"/> </object> <object class="IBObjectRecord"> <int key="objectID">485</int> <reference key="object" ref="82994268"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">490</int> <reference key="object" ref="448692316"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="992780483"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">491</int> <reference key="object" ref="992780483"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="105068016"/> </object> <reference key="parent" ref="448692316"/> </object> <object class="IBObjectRecord"> <int key="objectID">492</int> <reference key="object" ref="105068016"/> <reference key="parent" ref="992780483"/> </object> <object class="IBObjectRecord"> <int key="objectID">494</int> <reference key="object" ref="976324537"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">496</int> <reference key="object" ref="215659978"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="446991534"/> </object> <reference key="parent" ref="941447902"/> </object> <object class="IBObjectRecord"> <int key="objectID">497</int> <reference key="object" ref="446991534"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="875092757"/> <reference ref="630155264"/> <reference ref="945678886"/> <reference ref="512868991"/> <reference ref="163117631"/> <reference ref="31516759"/> <reference ref="908105787"/> <reference ref="644046920"/> <reference ref="231811626"/> <reference ref="883618387"/> </object> <reference key="parent" ref="215659978"/> </object> <object class="IBObjectRecord"> <int key="objectID">498</int> <reference key="object" ref="875092757"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">499</int> <reference key="object" ref="630155264"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">500</int> <reference key="object" ref="945678886"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">501</int> <reference key="object" ref="512868991"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">502</int> <reference key="object" ref="163117631"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">503</int> <reference key="object" ref="31516759"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="956096989"/> </object> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">504</int> <reference key="object" ref="908105787"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">505</int> <reference key="object" ref="644046920"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">506</int> <reference key="object" ref="231811626"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">507</int> <reference key="object" ref="883618387"/> <reference key="parent" ref="446991534"/> </object> <object class="IBObjectRecord"> <int key="objectID">508</int> <reference key="object" ref="956096989"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="257099033"/> <reference ref="551969625"/> <reference ref="249532473"/> <reference ref="607364498"/> <reference ref="508151438"/> <reference ref="981751889"/> <reference ref="380031999"/> <reference ref="825984362"/> <reference ref="560145579"/> </object> <reference key="parent" ref="31516759"/> </object> <object class="IBObjectRecord"> <int key="objectID">509</int> <reference key="object" ref="257099033"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">510</int> <reference key="object" ref="551969625"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">511</int> <reference key="object" ref="249532473"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">512</int> <reference key="object" ref="607364498"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">513</int> <reference key="object" ref="508151438"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">514</int> <reference key="object" ref="981751889"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">515</int> <reference key="object" ref="380031999"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">516</int> <reference key="object" ref="825984362"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">517</int> <reference key="object" ref="560145579"/> <reference key="parent" ref="956096989"/> </object> <object class="IBObjectRecord"> <int key="objectID">535</int> <reference key="object" ref="542196890"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="959611778"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">536</int> <reference key="object" ref="959611778"/> <reference key="parent" ref="542196890"/> </object> <object class="IBObjectRecord"> <int key="objectID">541</int> <reference key="object" ref="988469753"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="325691760"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">542</int> <reference key="object" ref="325691760"/> <reference key="parent" ref="988469753"/> </object> <object class="IBObjectRecord"> <int key="objectID">543</int> <reference key="object" ref="18745654"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="833549254"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">544</int> <reference key="object" ref="833549254"/> <reference key="parent" ref="18745654"/> </object> <object class="IBObjectRecord"> <int key="objectID">545</int> <reference key="object" ref="305991980"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="786198283"/> <reference ref="773550805"/> <reference ref="981802596"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">546</int> <reference key="object" ref="786198283"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">547</int> <reference key="object" ref="773550805"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">548</int> <reference key="object" ref="981802596"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">558</int> <reference key="object" ref="468638438"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1061814889"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">559</int> <reference key="object" ref="1061814889"/> <reference key="parent" ref="468638438"/> </object> <object class="IBObjectRecord"> <int key="objectID">577</int> <reference key="object" ref="1054695559"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">591</int> <reference key="object" ref="934936218"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="367445469"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">592</int> <reference key="object" ref="367445469"/> <reference key="parent" ref="934936218"/> </object> <object class="IBObjectRecord"> <int key="objectID">537</int> <reference key="object" ref="295914207"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">597</int> <reference key="object" ref="562298877"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="589268444"/> </object> <reference key="parent" ref="439893737"/> <string key="objectName">Zoom Slider</string> </object> <object class="IBObjectRecord"> <int key="objectID">598</int> <reference key="object" ref="589268444"/> <reference key="parent" ref="562298877"/> </object> <object class="IBObjectRecord"> <int key="objectID">609</int> <reference key="object" ref="352236955"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1064542466"/> <reference ref="242271987"/> <reference ref="887580421"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">610</int> <reference key="object" ref="1064542466"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">611</int> <reference key="object" ref="242271987"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">590</int> <reference key="object" ref="887580421"/> <reference key="parent" ref="352236955"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">622</int> + <reference key="object" ref="48802473"/> + <reference key="parent" ref="439893737"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-3.IBPluginDependency</string> <string>112.IBPluginDependency</string> <string>112.ImportedFromIB2</string> <string>124.IBPluginDependency</string> <string>124.ImportedFromIB2</string> <string>125.IBPluginDependency</string> <string>125.ImportedFromIB2</string> <string>125.editorWindowContentRectSynchronizationRect</string> <string>126.IBPluginDependency</string> <string>126.ImportedFromIB2</string> <string>129.IBPluginDependency</string> <string>129.ImportedFromIB2</string> <string>130.IBPluginDependency</string> <string>130.ImportedFromIB2</string> <string>130.editorWindowContentRectSynchronizationRect</string> <string>131.IBPluginDependency</string> <string>131.ImportedFromIB2</string> <string>134.IBPluginDependency</string> <string>134.ImportedFromIB2</string> <string>136.IBPluginDependency</string> <string>136.ImportedFromIB2</string> <string>143.IBPluginDependency</string> <string>143.ImportedFromIB2</string> <string>144.IBPluginDependency</string> <string>144.ImportedFromIB2</string> <string>145.IBPluginDependency</string> <string>145.ImportedFromIB2</string> <string>149.IBPluginDependency</string> <string>149.ImportedFromIB2</string> <string>150.IBPluginDependency</string> <string>150.ImportedFromIB2</string> <string>19.IBPluginDependency</string> <string>19.ImportedFromIB2</string> <string>195.IBPluginDependency</string> <string>195.ImportedFromIB2</string> <string>196.IBPluginDependency</string> <string>196.ImportedFromIB2</string> <string>197.IBPluginDependency</string> <string>197.ImportedFromIB2</string> <string>198.IBPluginDependency</string> <string>198.ImportedFromIB2</string> <string>199.IBPluginDependency</string> <string>199.ImportedFromIB2</string> <string>200.IBEditorWindowLastContentRect</string> <string>200.IBPluginDependency</string> <string>200.ImportedFromIB2</string> <string>200.editorWindowContentRectSynchronizationRect</string> <string>201.IBPluginDependency</string> <string>201.ImportedFromIB2</string> <string>202.IBPluginDependency</string> <string>202.ImportedFromIB2</string> <string>203.IBPluginDependency</string> <string>203.ImportedFromIB2</string> <string>204.IBPluginDependency</string> <string>204.ImportedFromIB2</string> <string>205.IBEditorWindowLastContentRect</string> <string>205.IBPluginDependency</string> <string>205.ImportedFromIB2</string> <string>205.editorWindowContentRectSynchronizationRect</string> <string>206.IBPluginDependency</string> <string>206.ImportedFromIB2</string> <string>207.IBPluginDependency</string> <string>207.ImportedFromIB2</string> <string>208.IBPluginDependency</string> <string>208.ImportedFromIB2</string> <string>209.IBPluginDependency</string> <string>209.ImportedFromIB2</string> <string>210.IBPluginDependency</string> <string>210.ImportedFromIB2</string> <string>211.IBPluginDependency</string> <string>211.ImportedFromIB2</string> <string>212.IBPluginDependency</string> <string>212.ImportedFromIB2</string> <string>212.editorWindowContentRectSynchronizationRect</string> <string>213.IBPluginDependency</string> <string>213.ImportedFromIB2</string> <string>214.IBPluginDependency</string> <string>214.ImportedFromIB2</string> <string>215.IBPluginDependency</string> <string>215.ImportedFromIB2</string> <string>216.IBPluginDependency</string> <string>216.ImportedFromIB2</string> <string>217.IBPluginDependency</string> <string>217.ImportedFromIB2</string> <string>218.IBPluginDependency</string> <string>218.ImportedFromIB2</string> <string>219.IBPluginDependency</string> <string>219.ImportedFromIB2</string> <string>220.IBEditorWindowLastContentRect</string> <string>220.IBPluginDependency</string> <string>220.ImportedFromIB2</string> <string>220.editorWindowContentRectSynchronizationRect</string> <string>221.IBPluginDependency</string> <string>221.ImportedFromIB2</string> <string>23.IBPluginDependency</string> <string>23.ImportedFromIB2</string> <string>236.IBPluginDependency</string> <string>236.ImportedFromIB2</string> <string>239.IBPluginDependency</string> <string>239.ImportedFromIB2</string> <string>24.IBEditorWindowLastContentRect</string> <string>24.IBPluginDependency</string> <string>24.ImportedFromIB2</string> <string>24.editorWindowContentRectSynchronizationRect</string> <string>29.IBEditorWindowLastContentRect</string> <string>29.IBPluginDependency</string> <string>29.ImportedFromIB2</string> <string>29.WindowOrigin</string> <string>29.editorWindowContentRectSynchronizationRect</string> <string>295.IBPluginDependency</string> <string>296.IBEditorWindowLastContentRect</string> <string>296.IBPluginDependency</string> <string>296.editorWindowContentRectSynchronizationRect</string> <string>297.IBPluginDependency</string> <string>298.IBPluginDependency</string> <string>346.IBPluginDependency</string> <string>346.ImportedFromIB2</string> <string>348.IBPluginDependency</string> <string>348.ImportedFromIB2</string> <string>349.IBEditorWindowLastContentRect</string> <string>349.IBPluginDependency</string> <string>349.ImportedFromIB2</string> <string>349.editorWindowContentRectSynchronizationRect</string> <string>350.IBPluginDependency</string> <string>350.ImportedFromIB2</string> <string>351.IBPluginDependency</string> <string>351.ImportedFromIB2</string> <string>354.IBPluginDependency</string> <string>354.ImportedFromIB2</string> <string>371.IBEditorWindowLastContentRect</string> <string>371.IBPluginDependency</string> <string>371.IBWindowTemplateEditedContentRect</string> <string>371.NSWindowTemplate.visibleAtLaunch</string> <string>371.editorWindowContentRectSynchronizationRect</string> <string>371.windowTemplate.hasMinSize</string> <string>371.windowTemplate.maxSize</string> <string>371.windowTemplate.minSize</string> <string>372.IBPluginDependency</string> <string>375.IBPluginDependency</string> <string>376.IBEditorWindowLastContentRect</string> <string>376.IBPluginDependency</string> <string>377.IBPluginDependency</string> <string>388.IBEditorWindowLastContentRect</string> <string>388.IBPluginDependency</string> <string>389.IBPluginDependency</string> <string>390.IBPluginDependency</string> <string>391.IBPluginDependency</string> <string>392.IBPluginDependency</string> <string>393.IBPluginDependency</string> <string>394.IBPluginDependency</string> <string>395.IBPluginDependency</string> <string>396.IBPluginDependency</string> <string>397.IBPluginDependency</string> <string>398.IBPluginDependency</string> <string>399.IBPluginDependency</string> <string>400.IBPluginDependency</string> <string>401.IBPluginDependency</string> <string>402.IBPluginDependency</string> <string>403.IBPluginDependency</string> <string>404.IBPluginDependency</string> <string>405.IBPluginDependency</string> <string>406.IBPluginDependency</string> <string>407.IBPluginDependency</string> <string>408.IBPluginDependency</string> <string>409.IBPluginDependency</string> <string>410.IBPluginDependency</string> <string>411.IBPluginDependency</string> <string>412.IBPluginDependency</string> <string>413.IBPluginDependency</string> <string>414.IBPluginDependency</string> <string>415.IBPluginDependency</string> <string>416.IBPluginDependency</string> <string>417.IBPluginDependency</string> <string>418.IBPluginDependency</string> <string>419.IBPluginDependency</string> <string>450.IBPluginDependency</string> <string>451.IBEditorWindowLastContentRect</string> <string>451.IBPluginDependency</string> <string>452.IBPluginDependency</string> <string>453.IBPluginDependency</string> <string>454.IBPluginDependency</string> <string>457.IBPluginDependency</string> <string>459.IBPluginDependency</string> <string>460.IBPluginDependency</string> <string>462.IBPluginDependency</string> <string>465.IBPluginDependency</string> <string>466.IBPluginDependency</string> <string>485.IBPluginDependency</string> <string>490.IBPluginDependency</string> <string>491.IBEditorWindowLastContentRect</string> <string>491.IBPluginDependency</string> <string>492.IBPluginDependency</string> <string>496.IBPluginDependency</string> <string>497.IBEditorWindowLastContentRect</string> <string>497.IBPluginDependency</string> <string>498.IBPluginDependency</string> <string>499.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>5.ImportedFromIB2</string> <string>500.IBPluginDependency</string> <string>501.IBPluginDependency</string> <string>502.IBPluginDependency</string> <string>503.IBPluginDependency</string> <string>504.IBPluginDependency</string> <string>505.IBPluginDependency</string> <string>506.IBPluginDependency</string> <string>507.IBPluginDependency</string> <string>508.IBEditorWindowLastContentRect</string> <string>508.IBPluginDependency</string> <string>509.IBPluginDependency</string> <string>510.IBPluginDependency</string> <string>511.IBPluginDependency</string> <string>512.IBPluginDependency</string> <string>513.IBPluginDependency</string> <string>514.IBPluginDependency</string> <string>515.IBPluginDependency</string> <string>516.IBPluginDependency</string> <string>517.IBPluginDependency</string> <string>535.IBPluginDependency</string> <string>536.IBPluginDependency</string> <string>541.IBPluginDependency</string> <string>542.IBPluginDependency</string> <string>543.IBPluginDependency</string> <string>544.IBPluginDependency</string> <string>545.IBPluginDependency</string> <string>546.IBPluginDependency</string> <string>547.IBPluginDependency</string> <string>548.IBPluginDependency</string> <string>558.IBPluginDependency</string> <string>559.IBPluginDependency</string> <string>56.IBPluginDependency</string> <string>56.ImportedFromIB2</string> <string>57.IBEditorWindowLastContentRect</string> <string>57.IBPluginDependency</string> <string>57.ImportedFromIB2</string> <string>57.editorWindowContentRectSynchronizationRect</string> <string>577.IBPluginDependency</string> <string>58.IBPluginDependency</string> <string>58.ImportedFromIB2</string> <string>590.IBPluginDependency</string> <string>591.IBPluginDependency</string> <string>592.IBPluginDependency</string> <string>597.IBPluginDependency</string> <string>598.IBPluginDependency</string> <string>609.IBPluginDependency</string> <string>610.IBPluginDependency</string> <string>611.IBPluginDependency</string> + <string>622.IBPluginDependency</string> <string>72.IBPluginDependency</string> <string>72.ImportedFromIB2</string> <string>73.IBPluginDependency</string> <string>73.ImportedFromIB2</string> <string>74.IBPluginDependency</string> <string>74.ImportedFromIB2</string> <string>75.IBPluginDependency</string> <string>75.ImportedFromIB2</string> <string>77.IBPluginDependency</string> <string>77.ImportedFromIB2</string> <string>78.IBPluginDependency</string> <string>78.ImportedFromIB2</string> <string>79.IBPluginDependency</string> <string>79.ImportedFromIB2</string> <string>80.IBPluginDependency</string> <string>80.ImportedFromIB2</string> <string>81.IBEditorWindowLastContentRect</string> <string>81.IBPluginDependency</string> <string>81.ImportedFromIB2</string> <string>81.editorWindowContentRectSynchronizationRect</string> <string>82.IBPluginDependency</string> <string>82.ImportedFromIB2</string> <string>83.IBPluginDependency</string> <string>83.ImportedFromIB2</string> <string>92.IBPluginDependency</string> <string>92.ImportedFromIB2</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{522, 812}, {146, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{436, 809}, {64, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 187}, {275, 113}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {275, 83}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{547, 180}, {254, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{187, 434}, {243, 243}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {167, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 217}, {238, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {241, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{654, 239}, {194, 73}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{525, 802}, {197, 73}}</string> <string>{{299, 836}, {476, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{74, 862}</string> <string>{{6, 978}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{604, 269}, {231, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{746, 287}, {220, 133}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {215, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{274, 100}, {1011, 669}}</string> + <string>{{1560, 120}, {1011, 669}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{274, 100}, {1011, 669}}</string> + <string>{{1560, 120}, {1011, 669}}</string> <integer value="1"/> <string>{{33, 99}, {480, 360}}</string> <boolean value="YES"/> <string>{3.40282e+38, 3.40282e+38}</string> <string>{720, 480}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{591, 420}, {83, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{523, 2}, {178, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{753, 197}, {170, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{725, 289}, {246, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{674, 260}, {204, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{878, 180}, {164, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{286, 129}, {275, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{23, 794}, {245, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{452, 109}, {196, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{145, 474}, {199, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">621</int> + <int key="maxID">623</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">ApplicationController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addImages:</string> <string>sendImage:</string> <string>zoomChanged:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>imageBrowser</string> <string>logTextField</string> + <string>progressIndicator</string> <string>zoomSlider</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>IKImageBrowserView</string> <string>NSTextView</string> + <string>NSProgressIndicator</string> <string>NSSlider</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">ApplicationController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">GalleryDesktopServiceAppDelegate</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>appController</string> <string>window</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>ApplicationController</string> <string>NSWindow</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">GalleryDesktopServiceAppDelegate.h</string> </object> </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">IKImageBrowserView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>_dataSource</string> <string>_delegate</string> <string>_dragDestinationDelegate</string> <string>_horizontalScroller</string> <string>_verticalScroller</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>NSScroller</string> <string>NSScroller</string> </object> </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="278480848"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="119117330"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSActionCell</string> <string key="superclassName">NSCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <string key="superclassName">NSResponder</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="170563987"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="848393276"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="641296341"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="935018811"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1059350257"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="385905261"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSBrowser</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButton</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButtonCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSCell</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSControl</string> <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="381234011"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="164379373"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSController</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>printDocument:</string> <string>revertDocumentToSaved:</string> <string>runPageLayout:</string> <string>saveDocument:</string> <string>saveDocumentAs:</string> <string>saveDocumentTo:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocumentController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>clearRecentDocuments:</string> <string>newDocument:</string> <string>openDocument:</string> <string>saveAllDocuments:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFontManager</string> <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1017856300"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="149916190"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMatrix</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMatrix.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenu</string> <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1071376953"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="55896286"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenuItem</string> <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="738316654"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="359201979"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMovieView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="170563987"/> + <reference key="sourceIdentifier" ref="848393276"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="641296341"/> + <reference key="sourceIdentifier" ref="935018811"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="1059350257"/> + <reference key="sourceIdentifier" ref="385905261"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="381234011"/> + <reference key="sourceIdentifier" ref="164379373"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="1017856300"/> + <reference key="sourceIdentifier" ref="149916190"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="1071376953"/> + <reference key="sourceIdentifier" ref="55896286"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="982259079"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="230437095"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="665570567"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="52177548"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSError.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="278480848"/> + <reference key="sourceIdentifier" ref="119117330"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/IKSaveOptions.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/ImageKitDeprecated.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">PDFKit.framework/Headers/PDFDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="135889388"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="970242148"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">PDFKit.framework/Headers/PDFView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzComposer.framework/Headers/QCCompositionParameterView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzComposer.framework/Headers/QCCompositionPickerView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuickLookUI.framework/Headers/QLPreviewPanel.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">NSProgressIndicator</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSProgressIndicator.h</string> + </object> + </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSScrollView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSScroller</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSScroller.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSSlider</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSlider.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSSliderCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSliderCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTableView</string> <string key="superclassName">NSControl</string> - <reference key="sourceIdentifier" ref="982259079"/> + <reference key="sourceIdentifier" ref="230437095"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSText</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSText.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextField</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextFieldCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextView</string> <string key="superclassName">NSText</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSUserDefaultsController</string> <string key="superclassName">NSController</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserDefaultsController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> - <reference key="sourceIdentifier" ref="738316654"/> + <reference key="sourceIdentifier" ref="359201979"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <string key="superclassName">NSResponder</string> - <reference key="sourceIdentifier" ref="665570567"/> + <reference key="sourceIdentifier" ref="52177548"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">PDFView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>goBack:</string> <string>goForward:</string> <string>goToFirstPage:</string> <string>goToLastPage:</string> <string>goToNextPage:</string> <string>goToPreviousPage:</string> <string>selectAll:</string> <string>takeBackgroundColorFrom:</string> <string>zoomIn:</string> <string>zoomOut:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> - <reference key="sourceIdentifier" ref="135889388"/> + <reference key="sourceIdentifier" ref="970242148"/> </object> <object class="IBPartialClassDescription"> <string key="className">QCView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>play:</string> <string>start:</string> <string>stop:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzComposer.framework/Headers/QCView.h</string> </object> </object> </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> <integer value="1060" key="NS.object.0"/> </object> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> <integer value="3000" key="NS.object.0"/> </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../GalleryDesktopService.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSMenuCheckmark</string> <string>NSMenuMixedState</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>{9, 8}</string> <string>{7, 2}</string> </object> </object> </data> </archive> diff --git a/FilePathImageObject.m b/FilePathImageObject.m index e0b839d..a600d60 100644 --- a/FilePathImageObject.m +++ b/FilePathImageObject.m @@ -1,57 +1,56 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "FilePathImageObject.h" #import <Quartz/Quartz.h> @implementation FilePathImageObject #pragma mark - #pragma mark properties @synthesize filePath; - (void) dealloc { - // TODO: BE SURE TO CLEAN UP HERE! [filePath release], filePath = nil; [super dealloc]; } #pragma mark - #pragma mark IKImageBrowserItem // Implement IKImageBrowserView's informal protocol IKImageBrowserItem - (NSString*) imageRepresentationType { return IKImageBrowserPathRepresentationType; } - (id) imageRepresentation { // Returns the image to display return self.filePath; } - (id) imageTitle { return [self.filePath lastPathComponent]; } - (NSString *) imageUID { // use filePath as a unique identifier for the image return self.filePath; } #pragma mark - @end
beepscore/GalleryDesktopService
660e372783759133f13035f21ec84d2dca4ef6c0
In sendImage:, add checks on image selection.
diff --git a/ApplicationController.m b/ApplicationController.m index e4ca795..351410f 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,416 +1,436 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { - + } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; - + // add images from application bundle NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; [self addImageWithPath:gifPath]; NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:jpgPath]; // pdf shows in Mac browser but not on iPhone NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; [self addImageWithPath:pdfPath]; NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"soyuz" ofType:@"png"]; [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; - + // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { - // THIS IS WHERE WE CREATE NEW MODEL OBJECTS + // Create a new model object // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal if ( [filename characterAtIndex:0] == L'.') return; } - + // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data - // This message was in addImagesFromDirectory:, which calls addImageWithPath: methods. + // This message (aka method call) was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { - // Use the imageBrowser selection to get a model object (FilePathImageObject) + // Use the imageBrowser selection to get a model object and send an image NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; - - // if no images were selected, don't try to send an image + + // if selectedImages is nil, don't try to select or send an image + if (nil == selectedImages) + { + NSLog(@"selectedImages is nil"); + return; + } + + // if selectedImages is empty, don't try to select or send an image if (0 == selectedImages.count) { - NSLog(@"No image selected"); + NSLog(@"selectedImages count is zero"); return; } - // select only the first image in the set. + // select only the first image in the set NSUInteger selectedImageIndex = [selectedImages firstIndex]; - - // defensive programming- check index is within images_ array bounds + + // if no images were selected, don't try to send an image + // *** Note: Richard Fuhr told me if the NSIndexSet is empty, firstIndex returns -1 (NSNotFound) + if (NSNotFound == selectedImageIndex) + { + NSLog(@"selectedImageIndex not found"); + return; + } + + // if index is outside images_ array bounds, don't try to send an image // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question - if (0 <= selectedImageIndex && [images_ count] > selectedImageIndex) + // this check may be unnecessarily defensive programming + if (0 > selectedImageIndex || [images_ count] <= selectedImageIndex) { - // get the model object - FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; - - // Create NSImage using the model object's filePath - NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; - - NSLog(@"selectedImageIndex = %d selectedFilePath = %@", - selectedImageIndex, selectedFilePathImageObject.filePath); - - // send NSImage - [imageShareService_ sendImageToClients:image]; - [image release]; + NSLog(@"selectedImageIndex outside of images_ array bounds"); + return; } + + // get the model object + FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; + + // Create NSImage using the model object's filePath + NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; + + NSLog(@"selectedImageIndex = %d selectedFilePath = %@", + selectedImageIndex, selectedFilePathImageObject.filePath); + + // send NSImage + [imageShareService_ sendImageToClients:image]; + [image release]; } + - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; - + [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; - index != NSNotFound; - index = [indexes indexLessThanIndex:index] ) + index != NSNotFound; + index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; - + NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } - + [imageBrowser_ reloadData]; } return YES; } @end
beepscore/GalleryDesktopService
d6b86495c7b02700d3069cb81bc99940aa7cae0e
Add gif, pdf, and png public domain images. All show on Mac, pdf doesn't show on iPhone.
diff --git a/ApplicationController.m b/ApplicationController.m index 6814b07..e4ca795 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,411 +1,416 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; // declare anonymous category for "private" methods, avoid showing in .h file // Note in Objective C no method is private, it can be called from elsewhere. // Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle - NSString* baileyPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; - [self addImageWithPath:baileyPath]; - NSString *lavaPath = [[NSBundle mainBundle] pathForResource:@"Lava" ofType:@"jpg"]; - [self addImageWithPath:lavaPath]; + NSString* gifPath = [[NSBundle mainBundle] pathForResource:@"predict" ofType:@"gif"]; + [self addImageWithPath:gifPath]; + NSString* jpgPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; + [self addImageWithPath:jpgPath]; + // pdf shows in Mac browser but not on iPhone + NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"sunRed" ofType:@"pdf"]; + [self addImageWithPath:pdfPath]; + NSString *pngPath = [[NSBundle mainBundle] pathForResource:@"soyuz" ofType:@"png"]; + [self addImageWithPath:pngPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // set browser cells style // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal if ( [filename characterAtIndex:0] == L'.') return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object (FilePathImageObject) NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if no images were selected, don't try to send an image if (0 == selectedImages.count) { NSLog(@"No image selected"); return; } // select only the first image in the set. NSUInteger selectedImageIndex = [selectedImages firstIndex]; // defensive programming- check index is within images_ array bounds // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question if (0 <= selectedImageIndex && [images_ count] > selectedImageIndex) { // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // send NSImage [imageShareService_ sendImageToClients:image]; [image release]; } } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/GalleryDesktopService.xcodeproj/project.pbxproj b/GalleryDesktopService.xcodeproj/project.pbxproj index 020e2bf..70407f7 100644 --- a/GalleryDesktopService.xcodeproj/project.pbxproj +++ b/GalleryDesktopService.xcodeproj/project.pbxproj @@ -1,322 +1,330 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXBuildFile section */ 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */; }; 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCAC1196603D00069E79 /* QuartzCore.framework */; }; 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCB21196604C00069E79 /* Quartz.framework */; }; - 01837DC71191CEB800650F7F /* Lava.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 01837DC61191CEB800650F7F /* Lava.jpg */; }; 018C928C1155977C003349E5 /* ImageShareService.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C928B1155977C003349E5 /* ImageShareService.m */; }; 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C92B211559ABF003349E5 /* ApplicationController.m */; }; 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; DE0E5073119BCA2500D4E903 /* README in Resources */ = {isa = PBXBuildFile; fileRef = DE0E5072119BCA2500D4E903 /* README */; }; + DE4BE952119E70F300A8BBFC /* soyuz.png in Resources */ = {isa = PBXBuildFile; fileRef = DE4BE951119E70F300A8BBFC /* soyuz.png */; }; + DE4BE954119E712700A8BBFC /* sunRed.pdf in Resources */ = {isa = PBXBuildFile; fileRef = DE4BE953119E712700A8BBFC /* sunRed.pdf */; }; + DE4BE956119E713900A8BBFC /* predict.gif in Resources */ = {isa = PBXBuildFile; fileRef = DE4BE955119E713900A8BBFC /* predict.gif */; }; DEBF281B119E24D100F3A293 /* baileySit100514.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DEBF281A119E24D100F3A293 /* baileySit100514.jpg */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePathImageObject.h; sourceTree = "<group>"; }; 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilePathImageObject.m; sourceTree = "<group>"; }; 0170BCAC1196603D00069E79 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0170BCB21196604C00069E79 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; - 01837DC61191CEB800650F7F /* Lava.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Lava.jpg; sourceTree = "<group>"; }; 018C928A1155977C003349E5 /* ImageShareService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageShareService.h; sourceTree = "<group>"; }; 018C928B1155977C003349E5 /* ImageShareService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageShareService.m; sourceTree = "<group>"; }; 018C92B111559ABF003349E5 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = "<group>"; }; 018C92B211559ABF003349E5 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = "<group>"; }; 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopServiceAppDelegate.h; sourceTree = "<group>"; }; 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryDesktopServiceAppDelegate.m; sourceTree = "<group>"; }; 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopService_Prefix.pch; sourceTree = "<group>"; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GalleryDesktopService-Info.plist"; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* GalleryDesktopService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GalleryDesktopService.app; sourceTree = BUILT_PRODUCTS_DIR; }; DE0E5072119BCA2500D4E903 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; + DE4BE951119E70F300A8BBFC /* soyuz.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = soyuz.png; sourceTree = "<group>"; }; + DE4BE953119E712700A8BBFC /* sunRed.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = sunRed.pdf; sourceTree = "<group>"; }; + DE4BE955119E713900A8BBFC /* predict.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = predict.gif; sourceTree = "<group>"; }; DEBF281A119E24D100F3A293 /* baileySit100514.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = baileySit100514.jpg; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D11072E0486CEB800E47090 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */, 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( 018C92B111559ABF003349E5 /* ApplicationController.h */, 018C92B211559ABF003349E5 /* ApplicationController.m */, 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */, 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */, 018C928A1155977C003349E5 /* ImageShareService.h */, 018C928B1155977C003349E5 /* ImageShareService.m */, 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */, 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */, ); name = Classes; sourceTree = "<group>"; }; 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 0170BCAC1196603D00069E79 /* QuartzCore.framework */, 0170BCB21196604C00069E79 /* Quartz.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* GalleryDesktopService.app */, ); name = Products; sourceTree = "<group>"; }; 29B97314FDCFA39411CA2CEA /* DesktopService */ = { isa = PBXGroup; children = ( 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = DesktopService; sourceTree = "<group>"; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, ); name = "Other Sources"; sourceTree = "<group>"; }; 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( DEBF281A119E24D100F3A293 /* baileySit100514.jpg */, 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - 01837DC61191CEB800650F7F /* Lava.jpg */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + DE4BE955119E713900A8BBFC /* predict.gif */, DE0E5072119BCA2500D4E903 /* README */, + DE4BE951119E70F300A8BBFC /* soyuz.png */, + DE4BE953119E712700A8BBFC /* sunRed.pdf */, ); name = Resources; sourceTree = "<group>"; }; 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8D1107260486CEB800E47090 /* GalleryDesktopService */ = { isa = PBXNativeTarget; buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */; buildPhases = ( 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, 8D11072E0486CEB800E47090 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = GalleryDesktopService; productInstallPath = "$(HOME)/Applications"; productName = DesktopService; productReference = 8D1107320486CEB800E47090 /* GalleryDesktopService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 29B97314FDCFA39411CA2CEA /* DesktopService */; projectDirPath = ""; projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* GalleryDesktopService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D1107290486CEB800E47090 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, - 01837DC71191CEB800650F7F /* Lava.jpg in Resources */, DE0E5073119BCA2500D4E903 /* README in Resources */, DEBF281B119E24D100F3A293 /* baileySit100514.jpg in Resources */, + DE4BE952119E70F300A8BBFC /* soyuz.png in Resources */, + DE4BE954119E712700A8BBFC /* sunRed.pdf in Resources */, + DE4BE956119E713900A8BBFC /* predict.gif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D11072C0486CEB800E47090 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072D0486CEB800E47090 /* main.m in Sources */, 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */, 018C928C1155977C003349E5 /* ImageShareService.m in Sources */, 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */, 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C165DFE840E0CC02AAC07 /* English */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( 1DDD58150DA1D0A300B32029 /* English */, ); name = MainMenu.xib; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Debug; }; C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4B08A954540054247B /* Debug */, C01FCF4C08A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, C01FCF5008A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; } diff --git a/Lava.jpg b/Lava.jpg deleted file mode 100644 index 2838dd6..0000000 Binary files a/Lava.jpg and /dev/null differ diff --git a/predict.gif b/predict.gif new file mode 100644 index 0000000..59282a8 Binary files /dev/null and b/predict.gif differ diff --git a/soyuz.png b/soyuz.png new file mode 100644 index 0000000..6b900b4 Binary files /dev/null and b/soyuz.png differ diff --git a/sunRed.pdf b/sunRed.pdf new file mode 100644 index 0000000..306ecc1 Binary files /dev/null and b/sunRed.pdf differ
beepscore/GalleryDesktopService
bda12eaff284d62a9727b60d308d059644363d00
Set browser cells style to show title. Shorten title to lastPathComponent.
diff --git a/ApplicationController.m b/ApplicationController.m index 2d0b38b..6814b07 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,408 +1,411 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; +// declare anonymous category for "private" methods, avoid showing in .h file +// Note in Objective C no method is private, it can be called from elsewhere. +// Ref http://stackoverflow.com/questions/1052233/iphone-obj-c-anonymous-category-or-private-category @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; - @end + @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // add images from application bundle NSString* baileyPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; [self addImageWithPath:baileyPath]; NSString *lavaPath = [[NSBundle mainBundle] pathForResource:@"Lava" ofType:@"jpg"]; [self addImageWithPath:lavaPath]; // add images from library [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; - // TODO: HW_TODO: - //SETUP THE STYLE OF THE BROWSER CELLS HERE - //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC + // set browser cells style + // ref http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#//apple_ref/doc/c_ref/IKCellsStyleTitled + [self.imageBrowser setCellsStyleMask:IKCellsStyleTitled]; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { // L denotes a wide-character literal if ( [filename characterAtIndex:0] == L'.') return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; // We changed the model so make sure the image browser reloads its data // This message was in addImagesFromDirectory:, which calls addImageWithPath: methods. // Move here so it gets sent when calling addImageWithPath: alone [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object (FilePathImageObject) NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if no images were selected, don't try to send an image if (0 == selectedImages.count) { NSLog(@"No image selected"); return; } // select only the first image in the set. NSUInteger selectedImageIndex = [selectedImages firstIndex]; // defensive programming- check index is within images_ array bounds // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question if (0 <= selectedImageIndex && [images_ count] > selectedImageIndex) { // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // send NSImage [imageShareService_ sendImageToClients:image]; [image release]; } } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/FilePathImageObject.m b/FilePathImageObject.m index 2365bda..e0b839d 100644 --- a/FilePathImageObject.m +++ b/FilePathImageObject.m @@ -1,57 +1,57 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "FilePathImageObject.h" #import <Quartz/Quartz.h> @implementation FilePathImageObject #pragma mark - #pragma mark properties @synthesize filePath; - (void) dealloc { - // BE SURE TO CLEAN UP HERE! + // TODO: BE SURE TO CLEAN UP HERE! [filePath release], filePath = nil; [super dealloc]; } #pragma mark - #pragma mark IKImageBrowserItem // Implement IKImageBrowserView's informal protocol IKImageBrowserItem - (NSString*) imageRepresentationType { return IKImageBrowserPathRepresentationType; } - (id) imageRepresentation { // Returns the image to display return self.filePath; } - (id) imageTitle { - return self.filePath; + return [self.filePath lastPathComponent]; } - (NSString *) imageUID { // use filePath as a unique identifier for the image return self.filePath; } #pragma mark - @end
beepscore/GalleryDesktopService
15c82ef86e22534b8b922ceee8a726bdafb0b956
Add images from application bundle.
diff --git a/ApplicationController.m b/ApplicationController.m index bee074a..2d0b38b 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,402 +1,408 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; - - [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; - // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE - // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN - // WE GRADE THIS - - // sync browser zoom to slider + // add images from application bundle + NSString* baileyPath = [[NSBundle mainBundle] pathForResource:@"baileySit100514" ofType:@"jpg"]; + [self addImageWithPath:baileyPath]; + NSString *lavaPath = [[NSBundle mainBundle] pathForResource:@"Lava" ofType:@"jpg"]; + [self addImageWithPath:lavaPath]; + + // add images from library + [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; + + // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // TODO: HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { + // L denotes a wide-character literal if ( [filename characterAtIndex:0] == L'.') return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; - [tempFilePathImageObject release]; + [tempFilePathImageObject release]; + + // We changed the model so make sure the image browser reloads its data + // This message was in addImagesFromDirectory:, which calls addImageWithPath: methods. + // Move here so it gets sent when calling addImageWithPath: alone + [imageBrowser_ reloadData]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } - - // We changed the model so make sure the image browser reloads its data - [imageBrowser_ reloadData]; } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // Use the imageBrowser selection to get a model object (FilePathImageObject) NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; // if no images were selected, don't try to send an image if (0 == selectedImages.count) { NSLog(@"No image selected"); return; } // select only the first image in the set. NSUInteger selectedImageIndex = [selectedImages firstIndex]; // defensive programming- check index is within images_ array bounds // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question if (0 <= selectedImageIndex && [images_ count] > selectedImageIndex) { // get the model object FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; // Create NSImage using the model object's filePath NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; NSLog(@"selectedImageIndex = %d selectedFilePath = %@", selectedImageIndex, selectedFilePathImageObject.filePath); // send NSImage [imageShareService_ sendImageToClients:image]; [image release]; } } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/GalleryDesktopService.xcodeproj/project.pbxproj b/GalleryDesktopService.xcodeproj/project.pbxproj index e6edbd5..020e2bf 100644 --- a/GalleryDesktopService.xcodeproj/project.pbxproj +++ b/GalleryDesktopService.xcodeproj/project.pbxproj @@ -1,318 +1,322 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXBuildFile section */ 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */; }; 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCAC1196603D00069E79 /* QuartzCore.framework */; }; 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCB21196604C00069E79 /* Quartz.framework */; }; 01837DC71191CEB800650F7F /* Lava.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 01837DC61191CEB800650F7F /* Lava.jpg */; }; 018C928C1155977C003349E5 /* ImageShareService.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C928B1155977C003349E5 /* ImageShareService.m */; }; 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C92B211559ABF003349E5 /* ApplicationController.m */; }; 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; DE0E5073119BCA2500D4E903 /* README in Resources */ = {isa = PBXBuildFile; fileRef = DE0E5072119BCA2500D4E903 /* README */; }; + DEBF281B119E24D100F3A293 /* baileySit100514.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DEBF281A119E24D100F3A293 /* baileySit100514.jpg */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePathImageObject.h; sourceTree = "<group>"; }; 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilePathImageObject.m; sourceTree = "<group>"; }; 0170BCAC1196603D00069E79 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0170BCB21196604C00069E79 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; 01837DC61191CEB800650F7F /* Lava.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Lava.jpg; sourceTree = "<group>"; }; 018C928A1155977C003349E5 /* ImageShareService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageShareService.h; sourceTree = "<group>"; }; 018C928B1155977C003349E5 /* ImageShareService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageShareService.m; sourceTree = "<group>"; }; 018C92B111559ABF003349E5 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = "<group>"; }; 018C92B211559ABF003349E5 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = "<group>"; }; 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopServiceAppDelegate.h; sourceTree = "<group>"; }; 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryDesktopServiceAppDelegate.m; sourceTree = "<group>"; }; 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopService_Prefix.pch; sourceTree = "<group>"; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GalleryDesktopService-Info.plist"; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* GalleryDesktopService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GalleryDesktopService.app; sourceTree = BUILT_PRODUCTS_DIR; }; DE0E5072119BCA2500D4E903 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; + DEBF281A119E24D100F3A293 /* baileySit100514.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = baileySit100514.jpg; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D11072E0486CEB800E47090 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */, 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( 018C92B111559ABF003349E5 /* ApplicationController.h */, 018C92B211559ABF003349E5 /* ApplicationController.m */, 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */, 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */, 018C928A1155977C003349E5 /* ImageShareService.h */, 018C928B1155977C003349E5 /* ImageShareService.m */, 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */, 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */, ); name = Classes; sourceTree = "<group>"; }; 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 0170BCAC1196603D00069E79 /* QuartzCore.framework */, 0170BCB21196604C00069E79 /* Quartz.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* GalleryDesktopService.app */, ); name = Products; sourceTree = "<group>"; }; 29B97314FDCFA39411CA2CEA /* DesktopService */ = { isa = PBXGroup; children = ( 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = DesktopService; sourceTree = "<group>"; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, ); name = "Other Sources"; sourceTree = "<group>"; }; 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - DE0E5072119BCA2500D4E903 /* README */, - 01837DC61191CEB800650F7F /* Lava.jpg */, + DEBF281A119E24D100F3A293 /* baileySit100514.jpg */, 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 01837DC61191CEB800650F7F /* Lava.jpg */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + DE0E5072119BCA2500D4E903 /* README */, ); name = Resources; sourceTree = "<group>"; }; 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8D1107260486CEB800E47090 /* GalleryDesktopService */ = { isa = PBXNativeTarget; buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */; buildPhases = ( 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, 8D11072E0486CEB800E47090 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = GalleryDesktopService; productInstallPath = "$(HOME)/Applications"; productName = DesktopService; productReference = 8D1107320486CEB800E47090 /* GalleryDesktopService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 29B97314FDCFA39411CA2CEA /* DesktopService */; projectDirPath = ""; projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* GalleryDesktopService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D1107290486CEB800E47090 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, 01837DC71191CEB800650F7F /* Lava.jpg in Resources */, DE0E5073119BCA2500D4E903 /* README in Resources */, + DEBF281B119E24D100F3A293 /* baileySit100514.jpg in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D11072C0486CEB800E47090 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072D0486CEB800E47090 /* main.m in Sources */, 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */, 018C928C1155977C003349E5 /* ImageShareService.m in Sources */, 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */, 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C165DFE840E0CC02AAC07 /* English */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( 1DDD58150DA1D0A300B32029 /* English */, ); name = MainMenu.xib; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Debug; }; C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4B08A954540054247B /* Debug */, C01FCF4C08A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, C01FCF5008A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; } diff --git a/baileySit100514.jpg b/baileySit100514.jpg new file mode 100644 index 0000000..21aeb4e Binary files /dev/null and b/baileySit100514.jpg differ
beepscore/GalleryDesktopService
fb252b43c187a8786865daebe09c937d76921453
In sendImage, add check for no selected image and for array index out of bounds.
diff --git a/ApplicationController.m b/ApplicationController.m index f1e7664..bee074a 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,388 +1,402 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS // sync browser zoom to slider [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; // Make sure the image browser allows reordering [self.imageBrowser setAllowsReordering:YES]; [self.imageBrowser setAnimates:YES]; // TODO: HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { if ( [filename characterAtIndex:0] == L'.') return; } // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // otherwise add just this file // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else { [self addImageWithPath:path]; } // We changed the model so make sure the image browser reloads its data [imageBrowser_ reloadData]; } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { - // TODO: HW_TODO: + // Use the imageBrowser selection to get a model object (FilePathImageObject) + + NSIndexSet* selectedImages = [self.imageBrowser selectionIndexes]; - // GET THE SELECTED IMAGE FROM THE BROWSER - // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) - // If multiple images are selected, send only the first one - NSUInteger selectedImageIndex = [[self.imageBrowser selectionIndexes] firstIndex]; + // if no images were selected, don't try to send an image + if (0 == selectedImages.count) + { + NSLog(@"No image selected"); + return; + } - FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; - - // Create NSImage from the file the model object is pointing to - NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; - - NSLog(@"selectedImageIndex = %d selectedFilePath = %@", - selectedImageIndex, selectedFilePathImageObject.filePath); - // send NSImage - [imageShareService_ sendImageToClients:image]; - [image release]; + // select only the first image in the set. + NSUInteger selectedImageIndex = [selectedImages firstIndex]; + + // defensive programming- check index is within images_ array bounds + // ref http://stackoverflow.com/questions/771185/cocoa-objective-c-array-beyond-bounds-question + if (0 <= selectedImageIndex && [images_ count] > selectedImageIndex) + { + // get the model object + FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; + + // Create NSImage using the model object's filePath + NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; + + NSLog(@"selectedImageIndex = %d selectedFilePath = %@", + selectedImageIndex, selectedFilePathImageObject.filePath); + + // send NSImage + [imageShareService_ sendImageToClients:image]; + [image release]; + } } - (IBAction) addImages:(id)sender { // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // return the number of images in the model // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop // Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end
beepscore/GalleryDesktopService
ed8e3de6bf791c12d6438197f2c1f39a1f7014eb
Passed manual test- send image.
diff --git a/ApplicationController.m b/ApplicationController.m index 099e3e3..f1e7664 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,396 +1,388 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { - // Setup the browser with some default images that should be installed on the system + // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; - // HW_TODO : + [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; - // ADD SOME IMAGES TO THE MODEL TO START OFF - // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS - [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; - // HW_TODO: - // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC - + // sync browser zoom to slider + [self.imageBrowser setZoomValue:[self.zoomSlider floatValue]]; + // Make sure the image browser allows reordering - [imageBrowser_ setAllowsReordering:YES]; - [imageBrowser_ setAnimates:YES]; + [self.imageBrowser setAllowsReordering:YES]; + [self.imageBrowser setAnimates:YES]; - //HW_TODO: + // TODO: HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } + - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { - // HW_TODO : - // THIS IS WHERE WE CREATE NEW MODEL OBJECTS - // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES - // USE THIS CODE OR YOUR OWN : - + // skip hidden directories and files NSString* filename = [path lastPathComponent]; if([filename length] > 0) { if ( [filename characterAtIndex:0] == L'.') return; } - - - // CHECK IF THIS PATH IS A DIRECTORY - // IF IT IS, ADD EACH FILE IN IT RECURSIVELY - // YOU CAN USE THIS CODE OR YOUR OWN : + + // Check if this path is a directory. If it is, recursively add each file in it BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } - // OTHERWISE JUST ADD THIS FILE - // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ + // otherwise add just this file + // create a new model object and add it to images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; - [tempFilePathImageObject release]; - + [tempFilePathImageObject release]; } + - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } - else - [self addImageWithPath:path]; - + else + { + [self addImageWithPath:path]; + } + + // We changed the model so make sure the image browser reloads its data [imageBrowser_ reloadData]; - - // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - - (IBAction) sendImage:(id)sender { - // HW_TODO : + // TODO: HW_TODO: // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) + // If multiple images are selected, send only the first one + NSUInteger selectedImageIndex = [[self.imageBrowser selectionIndexes] firstIndex]; + + FilePathImageObject* selectedFilePathImageObject = [images_ objectAtIndex:selectedImageIndex]; + // Create NSImage from the file the model object is pointing to + NSImage* image = [[NSImage alloc] initWithContentsOfFile:selectedFilePathImageObject.filePath]; - // TO SEND YOU NEED AN NSIMAGE - // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO - - - // FINALLY SEND IT USING THE LINE BELOW - //[imageShareService_ sendImageToClients:image]; + NSLog(@"selectedImageIndex = %d selectedFilePath = %@", + selectedImageIndex, selectedFilePathImageObject.filePath); + // send NSImage + [imageShareService_ sendImageToClients:image]; + [image release]; } - (IBAction) addImages:(id)sender { - - // This is how to create a standard open file panel - // and add the results - + // Create a standard open file panel and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } - } - + } } + - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { - // HW_TODO : - // RETURN THE # OF IMAGES IN THE MODEL + // return the number of images in the model // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - +// Conform to NSDraggingDestination informal protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/FilePathImageObject.h b/FilePathImageObject.h index a1059a6..b20e0dc 100644 --- a/FilePathImageObject.h +++ b/FilePathImageObject.h @@ -1,29 +1,30 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.h // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // This class conforms to IKImageBrowserView's informal protocol IKImageBrowserItem // IKImageBrowserItem is a simple data object that holds an image path for use by IKImageBrowserDataSource +// Ref http://17.254.2.129/mac/library/documentation/GraphicsImaging/Reference/IKImageBrowserItem_Protocol/IKImageBrowserItem_Reference.html#//apple_ref/doc/uid/TP40004709 #import <Foundation/Foundation.h> @interface FilePathImageObject : NSObject // DECLARE ANY PROPERTY OR IVARS YOU NEED // TO MANAGE YOUR IMAGE MODEL // I SUGGEST A SIMPLE NSSTRING FOR THE FILE PATH { #pragma mark instance variables NSString *filePath; } #pragma mark properties @property(nonatomic,retain)NSString *filePath; @end diff --git a/FilePathImageObject.m b/FilePathImageObject.m index 06a678b..2365bda 100644 --- a/FilePathImageObject.m +++ b/FilePathImageObject.m @@ -1,56 +1,57 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "FilePathImageObject.h" #import <Quartz/Quartz.h> @implementation FilePathImageObject #pragma mark - #pragma mark properties @synthesize filePath; - (void) dealloc { // BE SURE TO CLEAN UP HERE! [filePath release], filePath = nil; [super dealloc]; } #pragma mark - #pragma mark IKImageBrowserItem // Implement IKImageBrowserView's informal protocol IKImageBrowserItem - (NSString*) imageRepresentationType { return IKImageBrowserPathRepresentationType; } - (id) imageRepresentation { + // Returns the image to display return self.filePath; } - (id) imageTitle { return self.filePath; } - (NSString *) imageUID { // use filePath as a unique identifier for the image return self.filePath; } #pragma mark - @end diff --git a/README b/README index 962de83..93c7a11 100644 --- a/README +++ b/README @@ -1 +1,3 @@ -References: UW Q3 HW7 \ No newline at end of file +References: UW Q3 HW7 + +http://www.macresearch.org/cocoa-tutorial-image-kit-and-image-browser-views-part-i
beepscore/GalleryDesktopService
66450256af5b7ba1f1fc95c8aeb799809be8f678
App passed manual tests-
diff --git a/ApplicationController.m b/ApplicationController.m index d913d53..099e3e3 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,398 +1,396 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // HW_TODO : // ADD SOME IMAGES TO THE MODEL TO START OFF // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // HW_TODO: // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC // Make sure the image browser allows reordering [imageBrowser_ setAllowsReordering:YES]; [imageBrowser_ setAnimates:YES]; //HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // HW_TODO : // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES // USE THIS CODE OR YOUR OWN : NSString* filename = [path lastPathComponent]; if([filename length] > 0) { if ( [filename characterAtIndex:0] == L'.') return; } // CHECK IF THIS PATH IS A DIRECTORY // IF IT IS, ADD EACH FILE IN IT RECURSIVELY // YOU CAN USE THIS CODE OR YOUR OWN : BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // OTHERWISE JUST ADD THIS FILE // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else [self addImageWithPath:path]; [imageBrowser_ reloadData]; // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // HW_TODO : // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) // TO SEND YOU NEED AN NSIMAGE // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO // FINALLY SEND IT USING THE LINE BELOW //[imageShareService_ sendImageToClients:image]; } - (IBAction) addImages:(id)sender { // This is how to create a standard open file panel // and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource // Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource // Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // HW_TODO : // RETURN THE # OF IMAGES IN THE MODEL // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { - // HW_TODO : - // REMOVE THE IMAGE OBJECTS AT THE GIVEN INDICES [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate // Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end
beepscore/GalleryDesktopService
0542df68f8826c1d4b7679c47f0d0f1a01faaacc
Implement zoomChanged: On Mac, use NSSlider and [sender floatValue].
diff --git a/ApplicationController.h b/ApplicationController.h index f60b05d..bae76cb 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -1,42 +1,44 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // App controller is a singleton object +// This class conforms to two IKImageBrowserView informal protocols: +// IKImageBrowserDataSource and IKImageBrowserDelegate. #import <Cocoa/Cocoa.h> @class ImageShareService; @class IKImageBrowserView; @interface ApplicationController : NSObject { NSTextView* logTextField_; ImageShareService* imageShareService_; IKImageBrowserView* imageBrowser_; NSSlider* zoomSlider_; NSMutableArray* images_; } @property (nonatomic, assign) IBOutlet NSTextView* logTextField; @property (nonatomic, assign) IBOutlet IKImageBrowserView* imageBrowser; @property (nonatomic, assign) IBOutlet NSSlider* zoomSlider; + (ApplicationController*)sharedApplicationController; - (void) startService; - (void) appendStringToLog:(NSString*)logString; - (IBAction) sendImage:(id)sender; - (IBAction) addImages:(id)sender; - (IBAction) zoomChanged:(id)sender; @end diff --git a/ApplicationController.m b/ApplicationController.m index 7926298..d913d53 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,402 +1,398 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton - // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // HW_TODO : // ADD SOME IMAGES TO THE MODEL TO START OFF // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // HW_TODO: // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC // Make sure the image browser allows reordering [imageBrowser_ setAllowsReordering:YES]; [imageBrowser_ setAnimates:YES]; //HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // HW_TODO : // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES // USE THIS CODE OR YOUR OWN : NSString* filename = [path lastPathComponent]; if([filename length] > 0) { if ( [filename characterAtIndex:0] == L'.') return; } // CHECK IF THIS PATH IS A DIRECTORY // IF IT IS, ADD EACH FILE IN IT RECURSIVELY // YOU CAN USE THIS CODE OR YOUR OWN : BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // OTHERWISE JUST ADD THIS FILE // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else [self addImageWithPath:path]; [imageBrowser_ reloadData]; // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // HW_TODO : // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) // TO SEND YOU NEED AN NSIMAGE // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO // FINALLY SEND IT USING THE LINE BELOW //[imageShareService_ sendImageToClients:image]; } - (IBAction) addImages:(id)sender { // This is how to create a standard open file panel // and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { - // HW_TODO : - // UPDATE THE ZOOM ON THE BROWSER VIEW - + [self.imageBrowser setZoomValue:[sender floatValue]]; } #pragma mark - #pragma mark IKImageBrowserDataSource - -/* implement image-browser's datasource protocol - Our datasource representation is a simple mutable array - */ +// Implement IKImageBrowserView's informal protocol IKImageBrowserDataSource +// Our datasource representation is a simple mutable array - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // HW_TODO : // RETURN THE # OF IMAGES IN THE MODEL // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { // HW_TODO : // REMOVE THE IMAGE OBJECTS AT THE GIVEN INDICES [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate +// Implement IKImageBrowserView's informal protocol IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 473418d..c2679dc 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1,535 +1,536 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> <string key="IBDocument.SystemVersion">10D573</string> <string key="IBDocument.InterfaceBuilderVersion">762</string> <string key="IBDocument.AppKitVersion">1038.29</string> <string key="IBDocument.HIToolboxVersion">460.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.imagekit.ibplugin</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>762</string> <string>1.1</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="372"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="1021"> <string key="NSClassName">NSApplication</string> </object> <object class="NSCustomObject" id="1014"> <string key="NSClassName">FirstResponder</string> </object> <object class="NSCustomObject" id="1050"> <string key="NSClassName">NSApplication</string> </object> <object class="NSMenu" id="649796088"> <string key="NSTitle">AMainMenu</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="694149608"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">GalleryDesktopService</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <object class="NSCustomResource" key="NSOnImage" id="35465992"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSMenuCheckmark</string> </object> <object class="NSCustomResource" key="NSMixedImage" id="502551668"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSMenuMixedState</string> </object> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="110575045"> <string key="NSTitle">GalleryDesktopService</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="238522557"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">About GalleryDesktopService</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="304266470"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="609285721"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Preferences…</string> <string key="NSKeyEquiv">,</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="481834944"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1046388886"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Services</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="752062318"> <string key="NSTitle">Services</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <string key="NSName">_NSServicesMenu</string> </object> </object> <object class="NSMenuItem" id="646227648"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="755159360"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Hide GalleryDesktopService</string> <string key="NSKeyEquiv">h</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="342932134"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Hide Others</string> <string key="NSKeyEquiv">h</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="908899353"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Show All</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1056857174"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="632727374"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Quit GalleryDesktopService</string> <string key="NSKeyEquiv">q</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSAppleMenu</string> </object> </object> <object class="NSMenuItem" id="379814623"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">File</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="720053764"> <string key="NSTitle">File</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="705341025"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">New</string> <string key="NSKeyEquiv">n</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="722745758"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Open…</string> <string key="NSKeyEquiv">o</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1025936716"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Open Recent</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="1065607017"> <string key="NSTitle">Open Recent</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="759406840"> <reference key="NSMenu" ref="1065607017"/> <string key="NSTitle">Clear Menu</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSRecentDocumentsMenu</string> </object> </object> <object class="NSMenuItem" id="425164168"> <reference key="NSMenu" ref="720053764"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="776162233"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Close</string> <string key="NSKeyEquiv">w</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1023925487"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Save</string> <string key="NSKeyEquiv">s</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="117038363"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Save As…</string> <string key="NSKeyEquiv">S</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="579971712"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Revert to Saved</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1010469920"> <reference key="NSMenu" ref="720053764"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="294629803"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Page Setup...</string> <string key="NSKeyEquiv">P</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSToolTip"/> </object> <object class="NSMenuItem" id="49223823"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Print…</string> <string key="NSKeyEquiv">p</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="952259628"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Edit</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="789758025"> <string key="NSTitle">Edit</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1058277027"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Undo</string> <string key="NSKeyEquiv">z</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="790794224"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Redo</string> <string key="NSKeyEquiv">Z</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1040322652"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="296257095"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Cut</string> <string key="NSKeyEquiv">x</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="860595796"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Copy</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="29853731"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Paste</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="82994268"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Paste and Match Style</string> <string key="NSKeyEquiv">V</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="437104165"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Delete</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="583158037"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Select All</string> <string key="NSKeyEquiv">a</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="212016141"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="892235320"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Find</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="963351320"> <string key="NSTitle">Find</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="447796847"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find…</string> <string key="NSKeyEquiv">f</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">1</int> </object> <object class="NSMenuItem" id="326711663"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find Next</string> <string key="NSKeyEquiv">g</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">2</int> </object> <object class="NSMenuItem" id="270902937"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find Previous</string> <string key="NSKeyEquiv">G</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">3</int> </object> <object class="NSMenuItem" id="159080638"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Use Selection for Find</string> <string key="NSKeyEquiv">e</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">7</int> </object> <object class="NSMenuItem" id="88285865"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Jump to Selection</string> <string key="NSKeyEquiv">j</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="972420730"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Spelling and Grammar</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="769623530"> <string key="NSTitle">Spelling and Grammar</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="679648819"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Show Spelling and Grammar</string> <string key="NSKeyEquiv">:</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="96193923"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Check Document Now</string> <string key="NSKeyEquiv">;</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="859480356"> <reference key="NSMenu" ref="769623530"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> @@ -825,2334 +826,2335 @@ <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="767671776"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Kern</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="175441468"> <string key="NSTitle">Kern</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="252969304"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Use Default</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="766922938"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Use None</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="677519740"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Tighten</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="238351151"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Loosen</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="691570813"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Ligature</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="1058217995"> <string key="NSTitle">Ligature</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="706297211"> <reference key="NSMenu" ref="1058217995"/> <string key="NSTitle">Use Default</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="568384683"> <reference key="NSMenu" ref="1058217995"/> <string key="NSTitle">Use None</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="663508465"> <reference key="NSMenu" ref="1058217995"/> <string key="NSTitle">Use All</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="769124883"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Baseline</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="18263474"> <string key="NSTitle">Baseline</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="257962622"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Use Default</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="644725453"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Superscript</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1037576581"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Subscript</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="941806246"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Raise</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1045724900"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Lower</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="739652853"> <reference key="NSMenu" ref="786677654"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1012600125"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Show Colors</string> <string key="NSKeyEquiv">C</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="214559597"> <reference key="NSMenu" ref="786677654"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="596732606"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Copy Style</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="393423671"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Paste Style</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSFontMenu</string> </object> </object> <object class="NSMenuItem" id="215659978"> <reference key="NSMenu" ref="941447902"/> <string key="NSTitle">Text</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="446991534"> <string key="NSTitle">Text</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="875092757"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Align Left</string> <string key="NSKeyEquiv">{</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="630155264"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Center</string> <string key="NSKeyEquiv">|</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="945678886"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Justify</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="512868991"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Align Right</string> <string key="NSKeyEquiv">}</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="163117631"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="31516759"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Writing Direction</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="956096989"> <string key="NSTitle">Writing Direction</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="257099033"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Paragraph</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="551969625"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="249532473"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="607364498"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="508151438"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="981751889"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Selection</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="380031999"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="825984362"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="560145579"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="908105787"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="644046920"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Show Ruler</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="231811626"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Copy Ruler</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="883618387"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Paste Ruler</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> </object> </object> </object> <object class="NSMenuItem" id="586577488"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">View</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="466310130"> <string key="NSTitle">View</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="102151532"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Show Toolbar</string> <string key="NSKeyEquiv">t</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="237841660"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Customize Toolbar…</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="713487014"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Window</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="835318025"> <string key="NSTitle">Window</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1011231497"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Minimize</string> <string key="NSKeyEquiv">m</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="575023229"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Zoom</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="299356726"> <reference key="NSMenu" ref="835318025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="625202149"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Bring All to Front</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSWindowsMenu</string> </object> </object> <object class="NSMenuItem" id="448692316"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Help</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="992780483"> <string key="NSTitle">Help</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="105068016"> <reference key="NSMenu" ref="992780483"/> <string key="NSTitle">DesktopService Help</string> <string key="NSKeyEquiv">?</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSHelpMenu</string> </object> </object> </object> <string key="NSName">_NSMainMenu</string> </object> <object class="NSWindowTemplate" id="972006081"> <int key="NSWindowStyleMask">15</int> <int key="NSWindowBacking">2</int> <string key="NSWindowRect">{{335, 81}, {1011, 669}}</string> <int key="NSWTFlags">1954021376</int> <string key="NSWindowTitle">GalleryDesktopService</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <string key="NSWindowContentMinSize">{720, 480}</string> <object class="NSView" key="NSWindowView" id="439893737"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextField" id="542196890"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 414}, {38, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="959611778"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Log</string> <object class="NSFont" key="NSSupport" id="1000618677"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="542196890"/> <object class="NSColor" key="NSBackgroundColor" id="760086907"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor" id="104511740"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> </object> </object> <object class="NSColor" key="NSTextColor" id="178691194"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlTextColor</string> <object class="NSColor" key="NSColor" id="733687712"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MAA</bytes> </object> </object> </object> </object> <object class="NSTextField" id="988469753"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 632}, {454, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="325691760"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Homework 7 :</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande-Bold</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="988469753"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSTextField" id="18745654"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 439}, {303, 185}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="833549254"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">272629760</int> <string type="base64-UTF8" key="NSContents">VGhpcyBhcHBsaWNhaXRvbiBwdWJsaXNoZXMgYSBzZXJ2aWNlIHZpYSBCb25qb3VyLiBBIGNvbXBhbmlv biBpUGhvbmUgYXBwbGljYXRpb24gYnJvd3NlcyBmb3IgdGhpcyBzZXJ2aWNlLiBDb25uZWN0ZWQgaVBo b25lIGNsaWVudHMgd2lsbCByZWNpZXZlIGFuIGltYWdlIGZyb20gdGhpcyBzZXJ2aWNlIHRvIGRpc3Bs YXkuIAoKVGhlIEltYWdlIGlzIHNlbGVjdGVkIGF0IHRoZSByaWdodCBhbmQgc2VudCB1c2luZyB0aGUg IlNlbmQgSW1hZ2UiIGJ1dHRvbi4gQWRkaXRpb25hbCBpbWFnZXMgb3IgZm9sZGVycyBvZiBpbWFnZXMg Y2FuIGJlIGFkZGVkIHRvIHRoZSBicm93c2VyIHVzaW5nIHRoZSAiQWRkIEltYWdlcy4uLiIgYnV0dG9u LiA</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="18745654"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSScrollView" id="305991980"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">4368</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="432592696"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextView" id="981802596"> <reference key="NSNextResponder" ref="432592696"/> <int key="NSvFlags">6418</int> <string key="NSFrameSize">{295, 14}</string> <reference key="NSSuperview" ref="432592696"/> <object class="NSTextContainer" key="NSTextContainer" id="735441310"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> <object class="NSMutableString" key="NSString"> <characters key="NS.bytes"/> </object> <nil key="NSDelegate"/> </object> <object class="NSMutableArray" key="NSTextContainers"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="735441310"/> </object> <int key="NSLMFlags">134</int> <nil key="NSDelegate"/> </object> <reference key="NSTextView" ref="981802596"/> <double key="NSWidth">295</double> <int key="NSTCFlags">1</int> </object> <object class="NSTextViewSharedData" key="NSSharedData"> <int key="NSFlags">11557</int> <int key="NSTextCheckingTypes">0</int> <nil key="NSMarkedAttributes"/> <object class="NSColor" key="NSBackgroundColor" id="786488440"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MQA</bytes> </object> <object class="NSDictionary" key="NSSelectedAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSBackgroundColor</string> <string>NSColor</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextBackgroundColor</string> <reference key="NSColor" ref="104511740"/> </object> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextColor</string> <reference key="NSColor" ref="733687712"/> </object> </object> </object> <reference key="NSInsertionColor" ref="733687712"/> <object class="NSDictionary" key="NSLinkAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSColor</string> <string>NSCursor</string> <string>NSUnderline</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">1</int> <bytes key="NSRGB">MCAwIDEAA</bytes> </object> <object class="NSCursor"> <string key="NSHotSpot">{8, -8}</string> <int key="NSCursorType">13</int> </object> <integer value="1"/> </object> </object> <nil key="NSDefaultParagraphStyle"/> </object> <int key="NSTVFlags">6</int> <string key="NSMaxSize">{463, 1e+07}</string> <string key="NSMinize">{223, 0}</string> <nil key="NSDelegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {295, 360}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSNextKeyView" ref="981802596"/> <reference key="NSDocView" ref="981802596"/> <reference key="NSBGColor" ref="786488440"/> <object class="NSCursor" key="NSCursor"> <string key="NSHotSpot">{4, -5}</string> <int key="NSCursorType">1</int> </object> <int key="NScvFlags">4</int> </object> <object class="NSScroller" id="786198283"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {15, 318}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.85256409645080566</double> </object> <object class="NSScroller" id="773550805"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {431, 15}}</string> <reference key="NSSuperview" ref="305991980"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">1</double> <double key="NSPercent">0.94565218687057495</double> </object> </object> <string key="NSFrame">{{20, 44}, {297, 362}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="432592696"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="786198283"/> <reference key="NSHScroller" ref="773550805"/> <reference key="NSContentView" ref="432592696"/> </object> <object class="NSButton" id="468638438"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{884, 8}, {113, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1061814889"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Send Image</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="468638438"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSButton" id="934936218"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{757, 8}, {127, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="367445469"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Add Images...</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="934936218"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSSlider" id="562298877"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">256</int> <string key="NSFrame">{{325, 20}, {100, 16}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="589268444"> <int key="NSCellFlags">-2079981824</int> <int key="NSCellFlags2">262144</int> <string key="NSContents"/> <reference key="NSControlView" ref="562298877"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.5714285714285714</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">8</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">YES</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSScrollView" id="352236955"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">274</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="302360068"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IKImageBrowserView" id="887580421"> <reference key="NSNextResponder" ref="302360068"/> <int key="NSvFlags">18</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple PDF pasteboard type</string> <string>Apple PICT pasteboard type</string> <string>Apple PNG pasteboard type</string> <string>Apple URL pasteboard type</string> <string>NSFilenamesPboardType</string> <string>NSTypedFilenamesPboardType:'.SGI'</string> <string>NSTypedFilenamesPboardType:'8BPS'</string> <string>NSTypedFilenamesPboardType:'BMP '</string> <string>NSTypedFilenamesPboardType:'BMPf'</string> <string>NSTypedFilenamesPboardType:'EPSF'</string> <string>NSTypedFilenamesPboardType:'FPix'</string> <string>NSTypedFilenamesPboardType:'GIFf'</string> <string>NSTypedFilenamesPboardType:'ICO '</string> <string>NSTypedFilenamesPboardType:'JPEG'</string> <string>NSTypedFilenamesPboardType:'PDF '</string> <string>NSTypedFilenamesPboardType:'PICT'</string> <string>NSTypedFilenamesPboardType:'PNGf'</string> <string>NSTypedFilenamesPboardType:'PNTG'</string> <string>NSTypedFilenamesPboardType:'TIFF'</string> <string>NSTypedFilenamesPboardType:'TPIC'</string> <string>NSTypedFilenamesPboardType:'icns'</string> <string>NSTypedFilenamesPboardType:'jp2 '</string> <string>NSTypedFilenamesPboardType:'qtif'</string> <string>NSTypedFilenamesPboardType:3FR</string> <string>NSTypedFilenamesPboardType:3fr</string> <string>NSTypedFilenamesPboardType:ARW</string> <string>NSTypedFilenamesPboardType:BMP</string> <string>NSTypedFilenamesPboardType:CR2</string> <string>NSTypedFilenamesPboardType:CRW</string> <string>NSTypedFilenamesPboardType:CUR</string> <string>NSTypedFilenamesPboardType:DCR</string> <string>NSTypedFilenamesPboardType:DNG</string> <string>NSTypedFilenamesPboardType:EFX</string> <string>NSTypedFilenamesPboardType:EPI</string> <string>NSTypedFilenamesPboardType:EPS</string> <string>NSTypedFilenamesPboardType:EPSF</string> <string>NSTypedFilenamesPboardType:EPSI</string> <string>NSTypedFilenamesPboardType:ERF</string> <string>NSTypedFilenamesPboardType:EXR</string> <string>NSTypedFilenamesPboardType:FAX</string> <string>NSTypedFilenamesPboardType:FFF</string> <string>NSTypedFilenamesPboardType:FPIX</string> <string>NSTypedFilenamesPboardType:FPX</string> <string>NSTypedFilenamesPboardType:G3</string> <string>NSTypedFilenamesPboardType:GIF</string> <string>NSTypedFilenamesPboardType:HDR</string> <string>NSTypedFilenamesPboardType:ICNS</string> <string>NSTypedFilenamesPboardType:ICO</string> <string>NSTypedFilenamesPboardType:JFAX</string> <string>NSTypedFilenamesPboardType:JFX</string> <string>NSTypedFilenamesPboardType:JP2</string> <string>NSTypedFilenamesPboardType:JPE</string> <string>NSTypedFilenamesPboardType:JPEG</string> <string>NSTypedFilenamesPboardType:JPF</string> <string>NSTypedFilenamesPboardType:JPG</string> <string>NSTypedFilenamesPboardType:MAC</string> <string>NSTypedFilenamesPboardType:MOS</string> <string>NSTypedFilenamesPboardType:MRW</string> <string>NSTypedFilenamesPboardType:NEF</string> <string>NSTypedFilenamesPboardType:NRW</string> <string>NSTypedFilenamesPboardType:ORF</string> <string>NSTypedFilenamesPboardType:PCT</string> <string>NSTypedFilenamesPboardType:PDF</string> <string>NSTypedFilenamesPboardType:PEF</string> <string>NSTypedFilenamesPboardType:PIC</string> <string>NSTypedFilenamesPboardType:PICT</string> <string>NSTypedFilenamesPboardType:PNG</string> <string>NSTypedFilenamesPboardType:PNT</string> <string>NSTypedFilenamesPboardType:PNTG</string> <string>NSTypedFilenamesPboardType:PS</string> <string>NSTypedFilenamesPboardType:PSD</string> <string>NSTypedFilenamesPboardType:QTI</string> <string>NSTypedFilenamesPboardType:QTIF</string> <string>NSTypedFilenamesPboardType:RAF</string> <string>NSTypedFilenamesPboardType:RAW</string> <string>NSTypedFilenamesPboardType:RGB</string> <string>NSTypedFilenamesPboardType:RW2</string> <string>NSTypedFilenamesPboardType:RWL</string> <string>NSTypedFilenamesPboardType:SGI</string> <string>NSTypedFilenamesPboardType:SR2</string> <string>NSTypedFilenamesPboardType:SRF</string> <string>NSTypedFilenamesPboardType:TARGA</string> <string>NSTypedFilenamesPboardType:TGA</string> <string>NSTypedFilenamesPboardType:TIF</string> <string>NSTypedFilenamesPboardType:TIFF</string> <string>NSTypedFilenamesPboardType:XBM</string> <string>NSTypedFilenamesPboardType:arw</string> <string>NSTypedFilenamesPboardType:bmp</string> <string>NSTypedFilenamesPboardType:cr2</string> <string>NSTypedFilenamesPboardType:crw</string> <string>NSTypedFilenamesPboardType:cur</string> <string>NSTypedFilenamesPboardType:dcr</string> <string>NSTypedFilenamesPboardType:dng</string> <string>NSTypedFilenamesPboardType:efx</string> <string>NSTypedFilenamesPboardType:epi</string> <string>NSTypedFilenamesPboardType:eps</string> <string>NSTypedFilenamesPboardType:epsf</string> <string>NSTypedFilenamesPboardType:epsi</string> <string>NSTypedFilenamesPboardType:erf</string> <string>NSTypedFilenamesPboardType:exr</string> <string>NSTypedFilenamesPboardType:fax</string> <string>NSTypedFilenamesPboardType:fff</string> <string>NSTypedFilenamesPboardType:fpix</string> <string>NSTypedFilenamesPboardType:fpx</string> <string>NSTypedFilenamesPboardType:g3</string> <string>NSTypedFilenamesPboardType:gif</string> <string>NSTypedFilenamesPboardType:hdr</string> <string>NSTypedFilenamesPboardType:icns</string> <string>NSTypedFilenamesPboardType:ico</string> <string>NSTypedFilenamesPboardType:jfax</string> <string>NSTypedFilenamesPboardType:jfx</string> <string>NSTypedFilenamesPboardType:jp2</string> <string>NSTypedFilenamesPboardType:jpe</string> <string>NSTypedFilenamesPboardType:jpeg</string> <string>NSTypedFilenamesPboardType:jpf</string> <string>NSTypedFilenamesPboardType:jpg</string> <string>NSTypedFilenamesPboardType:mac</string> <string>NSTypedFilenamesPboardType:mos</string> <string>NSTypedFilenamesPboardType:mrw</string> <string>NSTypedFilenamesPboardType:nef</string> <string>NSTypedFilenamesPboardType:nrw</string> <string>NSTypedFilenamesPboardType:orf</string> <string>NSTypedFilenamesPboardType:pct</string> <string>NSTypedFilenamesPboardType:pdf</string> <string>NSTypedFilenamesPboardType:pef</string> <string>NSTypedFilenamesPboardType:pic</string> <string>NSTypedFilenamesPboardType:pict</string> <string>NSTypedFilenamesPboardType:png</string> <string>NSTypedFilenamesPboardType:pnt</string> <string>NSTypedFilenamesPboardType:pntg</string> <string>NSTypedFilenamesPboardType:ps</string> <string>NSTypedFilenamesPboardType:psd</string> <string>NSTypedFilenamesPboardType:qti</string> <string>NSTypedFilenamesPboardType:qtif</string> <string>NSTypedFilenamesPboardType:raf</string> <string>NSTypedFilenamesPboardType:raw</string> <string>NSTypedFilenamesPboardType:rgb</string> <string>NSTypedFilenamesPboardType:rw2</string> <string>NSTypedFilenamesPboardType:rwl</string> <string>NSTypedFilenamesPboardType:sgi</string> <string>NSTypedFilenamesPboardType:sr2</string> <string>NSTypedFilenamesPboardType:srf</string> <string>NSTypedFilenamesPboardType:targa</string> <string>NSTypedFilenamesPboardType:tga</string> <string>NSTypedFilenamesPboardType:tif</string> <string>NSTypedFilenamesPboardType:tiff</string> <string>NSTypedFilenamesPboardType:xbm</string> <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> <string>NeXT TIFF v4.0 pasteboard type</string> </object> </object> <string key="NSFrameSize">{664, 603}</string> <reference key="NSSuperview" ref="302360068"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="constrainsToOriginalSize">NO</bool> <bool key="cellsHaveSubtitle">NO</bool> <bool key="cellsHaveTitle">NO</bool> <bool key="outlinesCells">NO</bool> <bool key="shadowsCells">YES</bool> <bool key="animates">NO</bool> <bool key="allowsReordering">YES</bool> <bool key="allowsMultipleSelection">NO</bool> <float key="cellWidth">100</float> <float key="cellHeight">100</float> <reference key="dataSource"/> <reference key="delegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {664, 603}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSNextKeyView" ref="887580421"/> <reference key="NSDocView" ref="887580421"/> <reference key="NSBGColor" ref="760086907"/> <int key="NScvFlags">6</int> </object> <object class="NSScroller" id="1064542466"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{575, 1}, {15, 588}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> - <double key="NSCurValue">0.81260364842454402</double> + <double key="NSCurValue">0.98009950248756217</double> <double key="NSPercent">0.96363627910614014</double> </object> <object class="NSScroller" id="242271987"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 589}, {574, 15}}</string> <reference key="NSSuperview" ref="352236955"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.50602412223815918</double> </object> </object> <string key="NSFrame">{{325, 44}, {666, 605}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="302360068"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="1064542466"/> <reference key="NSHScroller" ref="242271987"/> <reference key="NSContentView" ref="302360068"/> <bytes key="NSScrollAmts">QSAAAEEgAABDAszNQvAAAA</bytes> </object> </object> <string key="NSFrameSize">{1011, 669}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{720, 502}</string> <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> </object> <object class="NSCustomObject" id="976324537"> <string key="NSClassName">GalleryDesktopServiceAppDelegate</string> </object> <object class="NSCustomObject" id="755631768"> <string key="NSClassName">NSFontManager</string> </object> <object class="NSUserDefaultsController" id="1054695559"> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSCustomObject" id="295914207"> <string key="NSClassName">ApplicationController</string> </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performMiniaturize:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1011231497"/> </object> <int key="connectionID">37</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">arrangeInFront:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="625202149"/> </object> <int key="connectionID">39</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">print:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="49223823"/> </object> <int key="connectionID">86</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">runPageLayout:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="294629803"/> </object> <int key="connectionID">87</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">clearRecentDocuments:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="759406840"/> </object> <int key="connectionID">127</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontStandardAboutPanel:</string> <reference key="source" ref="1021"/> <reference key="destination" ref="238522557"/> </object> <int key="connectionID">142</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performClose:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="776162233"/> </object> <int key="connectionID">193</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleContinuousSpellChecking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="948374510"/> </object> <int key="connectionID">222</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">undo:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1058277027"/> </object> <int key="connectionID">223</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copy:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="860595796"/> </object> <int key="connectionID">224</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">checkSpelling:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="96193923"/> </object> <int key="connectionID">225</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">paste:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="29853731"/> </object> <int key="connectionID">226</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">stopSpeaking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="680220178"/> </object> <int key="connectionID">227</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">cut:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="296257095"/> </object> <int key="connectionID">228</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">showGuessPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="679648819"/> </object> <int key="connectionID">230</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">redo:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="790794224"/> </object> <int key="connectionID">231</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">selectAll:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="583158037"/> </object> <int key="connectionID">232</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">startSpeaking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="731782645"/> </object> <int key="connectionID">233</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">delete:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="437104165"/> </object> <int key="connectionID">235</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performZoom:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="575023229"/> </object> <int key="connectionID">240</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="447796847"/> </object> <int key="connectionID">241</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">centerSelectionInVisibleArea:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="88285865"/> </object> <int key="connectionID">245</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleGrammarChecking:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="967646866"/> </object> <int key="connectionID">347</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleSmartInsertDelete:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="605118523"/> </object> <int key="connectionID">355</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticQuoteSubstitution:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="197661976"/> </object> <int key="connectionID">356</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticLinkDetection:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="708854459"/> </object> <int key="connectionID">357</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">saveDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1023925487"/> </object> <int key="connectionID">362</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">saveDocumentAs:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="117038363"/> </object> <int key="connectionID">363</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">revertDocumentToSaved:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="579971712"/> </object> <int key="connectionID">364</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">runToolbarCustomizationPalette:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="237841660"/> </object> <int key="connectionID">365</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleToolbarShown:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="102151532"/> </object> <int key="connectionID">366</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">hide:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="755159360"/> </object> <int key="connectionID">367</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">hideOtherApplications:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="342932134"/> </object> <int key="connectionID">368</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">unhideAllApplications:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="908899353"/> </object> <int key="connectionID">370</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">newDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="705341025"/> </object> <int key="connectionID">373</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">openDocument:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="722745758"/> </object> <int key="connectionID">374</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">addFontTrait:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="305399458"/> </object> <int key="connectionID">421</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">addFontTrait:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="814362025"/> </object> <int key="connectionID">422</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">modifyFont:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="885547335"/> </object> <int key="connectionID">423</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontFontPanel:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="159677712"/> </object> <int key="connectionID">424</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">modifyFont:</string> <reference key="source" ref="755631768"/> <reference key="destination" ref="158063935"/> </object> <int key="connectionID">425</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">raiseBaseline:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="941806246"/> </object> <int key="connectionID">426</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">lowerBaseline:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1045724900"/> </object> <int key="connectionID">427</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copyFont:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="596732606"/> </object> <int key="connectionID">428</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">subscript:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1037576581"/> </object> <int key="connectionID">429</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">superscript:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="644725453"/> </object> <int key="connectionID">430</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">tightenKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="677519740"/> </object> <int key="connectionID">431</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">underline:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="330926929"/> </object> <int key="connectionID">432</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontColorPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1012600125"/> </object> <int key="connectionID">433</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">useAllLigatures:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="663508465"/> </object> <int key="connectionID">434</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">loosenKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="238351151"/> </object> <int key="connectionID">435</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">pasteFont:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="393423671"/> </object> <int key="connectionID">436</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">unscript:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="257962622"/> </object> <int key="connectionID">437</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">useStandardKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="252969304"/> </object> <int key="connectionID">438</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">useStandardLigatures:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="706297211"/> </object> <int key="connectionID">439</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">turnOffLigatures:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="568384683"/> </object> <int key="connectionID">440</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">turnOffKerning:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="766922938"/> </object> <int key="connectionID">441</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">terminate:</string> <reference key="source" ref="1050"/> <reference key="destination" ref="632727374"/> </object> <int key="connectionID">449</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticSpellingCorrection:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="795346622"/> </object> <int key="connectionID">456</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">orderFrontSubstitutionsPanel:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="65139061"/> </object> <int key="connectionID">458</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticDashSubstitution:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="672708820"/> </object> <int key="connectionID">461</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleAutomaticTextReplacement:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="537092702"/> </object> <int key="connectionID">463</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">uppercaseWord:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="1060694897"/> </object> <int key="connectionID">464</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">capitalizeWord:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="56570060"/> </object> <int key="connectionID">467</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">lowercaseWord:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="879586729"/> </object> <int key="connectionID">468</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">pasteAsPlainText:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="82994268"/> </object> <int key="connectionID">486</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="326711663"/> </object> <int key="connectionID">487</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="270902937"/> </object> <int key="connectionID">488</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">performFindPanelAction:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="159080638"/> </object> <int key="connectionID">489</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">showHelp:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="105068016"/> </object> <int key="connectionID">493</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="1021"/> <reference key="destination" ref="976324537"/> </object> <int key="connectionID">495</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignCenter:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="630155264"/> </object> <int key="connectionID">518</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">pasteRuler:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="883618387"/> </object> <int key="connectionID">519</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">toggleRuler:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="644046920"/> </object> <int key="connectionID">520</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="512868991"/> </object> <int key="connectionID">521</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">copyRuler:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="231811626"/> </object> <int key="connectionID">522</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignJustified:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="945678886"/> </object> <int key="connectionID">523</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">alignLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="875092757"/> </object> <int key="connectionID">524</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionNatural:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="551969625"/> </object> <int key="connectionID">525</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionLeftToRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="249532473"/> </object> <int key="connectionID">526</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionRightToLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="607364498"/> </object> <int key="connectionID">527</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionNatural:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="380031999"/> </object> <int key="connectionID">528</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionLeftToRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="825984362"/> </object> <int key="connectionID">529</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionRightToLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="560145579"/> </object> <int key="connectionID">530</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">window</string> <reference key="source" ref="976324537"/> <reference key="destination" ref="972006081"/> </object> <int key="connectionID">532</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">logTextField</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="981802596"/> </object> <int key="connectionID">549</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">appController</string> <reference key="source" ref="976324537"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">550</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">sendImage:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="468638438"/> </object> <int key="connectionID">589</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">imageBrowser</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="887580421"/> </object> <int key="connectionID">594</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">dataSource</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">603</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">604</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">dragDestinationDelegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">605</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">_dataSource</string> - <reference key="source" ref="887580421"/> - <reference key="destination" ref="295914207"/> + <string key="label">zoomSlider</string> + <reference key="source" ref="295914207"/> + <reference key="destination" ref="562298877"/> </object> - <int key="connectionID">606</int> + <int key="connectionID">614</int> </object> <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">_delegate</string> - <reference key="source" ref="887580421"/> - <reference key="destination" ref="295914207"/> + <object class="IBActionConnection" key="connection"> + <string key="label">addImages:</string> + <reference key="source" ref="295914207"/> + <reference key="destination" ref="934936218"/> </object> - <int key="connectionID">607</int> + <int key="connectionID">615</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_dragDestinationDelegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> - <int key="connectionID">608</int> + <int key="connectionID">616</int> </object> <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">zoomChanged:</string> - <reference key="source" ref="295914207"/> - <reference key="destination" ref="562298877"/> + <object class="IBOutletConnection" key="connection"> + <string key="label">_delegate</string> + <reference key="source" ref="887580421"/> + <reference key="destination" ref="295914207"/> </object> - <int key="connectionID">613</int> + <int key="connectionID">617</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">zoomSlider</string> - <reference key="source" ref="295914207"/> - <reference key="destination" ref="562298877"/> + <string key="label">_dataSource</string> + <reference key="source" ref="887580421"/> + <reference key="destination" ref="295914207"/> </object> - <int key="connectionID">614</int> + <int key="connectionID">618</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">addImages:</string> + <string key="label">zoomChanged:</string> <reference key="source" ref="295914207"/> - <reference key="destination" ref="934936218"/> + <reference key="destination" ref="562298877"/> </object> - <int key="connectionID">615</int> + <int key="connectionID">619</int> </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> <reference key="object" ref="0"/> <reference key="children" ref="1048"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="1021"/> <reference key="parent" ref="0"/> <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1014"/> <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1050"/> <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> <int key="objectID">29</int> <reference key="object" ref="649796088"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="713487014"/> <reference ref="694149608"/> <reference ref="952259628"/> <reference ref="379814623"/> <reference ref="586577488"/> <reference ref="302598603"/> <reference ref="448692316"/> </object> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">19</int> <reference key="object" ref="713487014"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="835318025"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">56</int> <reference key="object" ref="694149608"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="110575045"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">217</int> <reference key="object" ref="952259628"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="789758025"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">83</int> <reference key="object" ref="379814623"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="720053764"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">81</int> <reference key="object" ref="720053764"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1023925487"/> <reference ref="117038363"/> <reference ref="49223823"/> <reference ref="722745758"/> <reference ref="705341025"/> <reference ref="1025936716"/> <reference ref="294629803"/> <reference ref="776162233"/> <reference ref="425164168"/> <reference ref="579971712"/> <reference ref="1010469920"/> </object> <reference key="parent" ref="379814623"/> </object> <object class="IBObjectRecord"> <int key="objectID">75</int> <reference key="object" ref="1023925487"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">80</int> <reference key="object" ref="117038363"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">78</int> <reference key="object" ref="49223823"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">72</int> <reference key="object" ref="722745758"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">82</int> <reference key="object" ref="705341025"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">124</int> <reference key="object" ref="1025936716"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1065607017"/> </object> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">77</int> <reference key="object" ref="294629803"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">73</int> <reference key="object" ref="776162233"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">79</int> <reference key="object" ref="425164168"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">112</int> <reference key="object" ref="579971712"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">74</int> <reference key="object" ref="1010469920"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">125</int> <reference key="object" ref="1065607017"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="759406840"/> </object> <reference key="parent" ref="1025936716"/> </object> <object class="IBObjectRecord"> <int key="objectID">126</int> <reference key="object" ref="759406840"/> <reference key="parent" ref="1065607017"/> </object> <object class="IBObjectRecord"> <int key="objectID">205</int> <reference key="object" ref="789758025"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="437104165"/> <reference ref="583158037"/> <reference ref="1058277027"/> <reference ref="212016141"/> <reference ref="296257095"/> <reference ref="29853731"/> <reference ref="860595796"/> <reference ref="1040322652"/> <reference ref="790794224"/> <reference ref="892235320"/> <reference ref="972420730"/> <reference ref="676164635"/> <reference ref="507821607"/> <reference ref="288088188"/> <reference ref="82994268"/> </object> <reference key="parent" ref="952259628"/> </object> <object class="IBObjectRecord"> <int key="objectID">202</int> <reference key="object" ref="437104165"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">198</int> <reference key="object" ref="583158037"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">207</int> <reference key="object" ref="1058277027"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">214</int> <reference key="object" ref="212016141"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">199</int> <reference key="object" ref="296257095"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">203</int> <reference key="object" ref="29853731"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">197</int> <reference key="object" ref="860595796"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">206</int> <reference key="object" ref="1040322652"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">215</int> <reference key="object" ref="790794224"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">218</int> <reference key="object" ref="892235320"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="963351320"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">216</int> <reference key="object" ref="972420730"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="769623530"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">200</int> <reference key="object" ref="769623530"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="948374510"/> <reference ref="96193923"/> <reference ref="679648819"/> <reference ref="967646866"/> <reference ref="859480356"/> <reference ref="795346622"/> </object> <reference key="parent" ref="972420730"/> </object> <object class="IBObjectRecord"> <int key="objectID">219</int> <reference key="object" ref="948374510"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">201</int> <reference key="object" ref="96193923"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">204</int> <reference key="object" ref="679648819"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">220</int> <reference key="object" ref="963351320"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="270902937"/> <reference ref="88285865"/> <reference ref="159080638"/> <reference ref="326711663"/> <reference ref="447796847"/> </object> <reference key="parent" ref="892235320"/> </object> <object class="IBObjectRecord"> <int key="objectID">213</int> <reference key="object" ref="270902937"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">210</int> <reference key="object" ref="88285865"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">221</int> <reference key="object" ref="159080638"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">208</int> <reference key="object" ref="326711663"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">209</int> <reference key="object" ref="447796847"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">57</int> <reference key="object" ref="110575045"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="238522557"/> <reference ref="755159360"/> <reference ref="908899353"/> <reference ref="632727374"/> <reference ref="646227648"/> <reference ref="609285721"/> <reference ref="481834944"/> <reference ref="304266470"/> <reference ref="1046388886"/> <reference ref="1056857174"/> <reference ref="342932134"/> </object> <reference key="parent" ref="694149608"/> </object> <object class="IBObjectRecord"> <int key="objectID">58</int> <reference key="object" ref="238522557"/> <reference key="parent" ref="110575045"/> <string key="objectName">Menu Item (About GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">134</int> <reference key="object" ref="755159360"/> <reference key="parent" ref="110575045"/> <string key="objectName">Menu Item (Hide GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">150</int> <reference key="object" ref="908899353"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">136</int> <reference key="object" ref="632727374"/> <reference key="parent" ref="110575045"/> <string key="objectName">Menu Item (Quit GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">144</int> <reference key="object" ref="646227648"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">129</int> <reference key="object" ref="609285721"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">143</int> <reference key="object" ref="481834944"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">236</int> <reference key="object" ref="304266470"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">131</int> <reference key="object" ref="1046388886"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="752062318"/> </object> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">149</int> <reference key="object" ref="1056857174"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">145</int> <reference key="object" ref="342932134"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">130</int> <reference key="object" ref="752062318"/> <reference key="parent" ref="1046388886"/> </object> <object class="IBObjectRecord"> <int key="objectID">24</int> <reference key="object" ref="835318025"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="299356726"/> <reference ref="625202149"/> <reference ref="575023229"/> <reference ref="1011231497"/> </object> <reference key="parent" ref="713487014"/> </object> <object class="IBObjectRecord"> <int key="objectID">92</int> <reference key="object" ref="299356726"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">5</int> <reference key="object" ref="625202149"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">239</int> <reference key="object" ref="575023229"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">23</int> <reference key="object" ref="1011231497"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">295</int> <reference key="object" ref="586577488"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="466310130"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">296</int> <reference key="object" ref="466310130"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="102151532"/> <reference ref="237841660"/> </object> <reference key="parent" ref="586577488"/> </object> <object class="IBObjectRecord"> <int key="objectID">297</int> <reference key="object" ref="102151532"/> <reference key="parent" ref="466310130"/> </object> <object class="IBObjectRecord"> <int key="objectID">298</int> <reference key="object" ref="237841660"/> <reference key="parent" ref="466310130"/> </object> <object class="IBObjectRecord"> <int key="objectID">211</int> <reference key="object" ref="676164635"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="785027613"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">212</int> <reference key="object" ref="785027613"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="680220178"/> <reference ref="731782645"/> </object> <reference key="parent" ref="676164635"/> </object> <object class="IBObjectRecord"> <int key="objectID">195</int> <reference key="object" ref="680220178"/> <reference key="parent" ref="785027613"/> </object> <object class="IBObjectRecord"> <int key="objectID">196</int> <reference key="object" ref="731782645"/> <reference key="parent" ref="785027613"/> </object> <object class="IBObjectRecord"> <int key="objectID">346</int> <reference key="object" ref="967646866"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">348</int> <reference key="object" ref="507821607"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="698887838"/> @@ -3749,1187 +3751,1187 @@ LiA</string> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="786198283"/> <reference ref="773550805"/> <reference ref="981802596"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">546</int> <reference key="object" ref="786198283"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">547</int> <reference key="object" ref="773550805"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">548</int> <reference key="object" ref="981802596"/> <reference key="parent" ref="305991980"/> </object> <object class="IBObjectRecord"> <int key="objectID">558</int> <reference key="object" ref="468638438"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1061814889"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">559</int> <reference key="object" ref="1061814889"/> <reference key="parent" ref="468638438"/> </object> <object class="IBObjectRecord"> <int key="objectID">577</int> <reference key="object" ref="1054695559"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">591</int> <reference key="object" ref="934936218"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="367445469"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">592</int> <reference key="object" ref="367445469"/> <reference key="parent" ref="934936218"/> </object> <object class="IBObjectRecord"> <int key="objectID">537</int> <reference key="object" ref="295914207"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">597</int> <reference key="object" ref="562298877"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="589268444"/> </object> <reference key="parent" ref="439893737"/> <string key="objectName">Zoom Slider</string> </object> <object class="IBObjectRecord"> <int key="objectID">598</int> <reference key="object" ref="589268444"/> <reference key="parent" ref="562298877"/> </object> <object class="IBObjectRecord"> <int key="objectID">609</int> <reference key="object" ref="352236955"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1064542466"/> <reference ref="242271987"/> <reference ref="887580421"/> </object> <reference key="parent" ref="439893737"/> </object> <object class="IBObjectRecord"> <int key="objectID">610</int> <reference key="object" ref="1064542466"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">611</int> <reference key="object" ref="242271987"/> <reference key="parent" ref="352236955"/> </object> <object class="IBObjectRecord"> <int key="objectID">590</int> <reference key="object" ref="887580421"/> <reference key="parent" ref="352236955"/> </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-3.IBPluginDependency</string> <string>112.IBPluginDependency</string> <string>112.ImportedFromIB2</string> <string>124.IBPluginDependency</string> <string>124.ImportedFromIB2</string> <string>125.IBPluginDependency</string> <string>125.ImportedFromIB2</string> <string>125.editorWindowContentRectSynchronizationRect</string> <string>126.IBPluginDependency</string> <string>126.ImportedFromIB2</string> <string>129.IBPluginDependency</string> <string>129.ImportedFromIB2</string> <string>130.IBPluginDependency</string> <string>130.ImportedFromIB2</string> <string>130.editorWindowContentRectSynchronizationRect</string> <string>131.IBPluginDependency</string> <string>131.ImportedFromIB2</string> <string>134.IBPluginDependency</string> <string>134.ImportedFromIB2</string> <string>136.IBPluginDependency</string> <string>136.ImportedFromIB2</string> <string>143.IBPluginDependency</string> <string>143.ImportedFromIB2</string> <string>144.IBPluginDependency</string> <string>144.ImportedFromIB2</string> <string>145.IBPluginDependency</string> <string>145.ImportedFromIB2</string> <string>149.IBPluginDependency</string> <string>149.ImportedFromIB2</string> <string>150.IBPluginDependency</string> <string>150.ImportedFromIB2</string> <string>19.IBPluginDependency</string> <string>19.ImportedFromIB2</string> <string>195.IBPluginDependency</string> <string>195.ImportedFromIB2</string> <string>196.IBPluginDependency</string> <string>196.ImportedFromIB2</string> <string>197.IBPluginDependency</string> <string>197.ImportedFromIB2</string> <string>198.IBPluginDependency</string> <string>198.ImportedFromIB2</string> <string>199.IBPluginDependency</string> <string>199.ImportedFromIB2</string> <string>200.IBEditorWindowLastContentRect</string> <string>200.IBPluginDependency</string> <string>200.ImportedFromIB2</string> <string>200.editorWindowContentRectSynchronizationRect</string> <string>201.IBPluginDependency</string> <string>201.ImportedFromIB2</string> <string>202.IBPluginDependency</string> <string>202.ImportedFromIB2</string> <string>203.IBPluginDependency</string> <string>203.ImportedFromIB2</string> <string>204.IBPluginDependency</string> <string>204.ImportedFromIB2</string> <string>205.IBEditorWindowLastContentRect</string> <string>205.IBPluginDependency</string> <string>205.ImportedFromIB2</string> <string>205.editorWindowContentRectSynchronizationRect</string> <string>206.IBPluginDependency</string> <string>206.ImportedFromIB2</string> <string>207.IBPluginDependency</string> <string>207.ImportedFromIB2</string> <string>208.IBPluginDependency</string> <string>208.ImportedFromIB2</string> <string>209.IBPluginDependency</string> <string>209.ImportedFromIB2</string> <string>210.IBPluginDependency</string> <string>210.ImportedFromIB2</string> <string>211.IBPluginDependency</string> <string>211.ImportedFromIB2</string> <string>212.IBPluginDependency</string> <string>212.ImportedFromIB2</string> <string>212.editorWindowContentRectSynchronizationRect</string> <string>213.IBPluginDependency</string> <string>213.ImportedFromIB2</string> <string>214.IBPluginDependency</string> <string>214.ImportedFromIB2</string> <string>215.IBPluginDependency</string> <string>215.ImportedFromIB2</string> <string>216.IBPluginDependency</string> <string>216.ImportedFromIB2</string> <string>217.IBPluginDependency</string> <string>217.ImportedFromIB2</string> <string>218.IBPluginDependency</string> <string>218.ImportedFromIB2</string> <string>219.IBPluginDependency</string> <string>219.ImportedFromIB2</string> <string>220.IBEditorWindowLastContentRect</string> <string>220.IBPluginDependency</string> <string>220.ImportedFromIB2</string> <string>220.editorWindowContentRectSynchronizationRect</string> <string>221.IBPluginDependency</string> <string>221.ImportedFromIB2</string> <string>23.IBPluginDependency</string> <string>23.ImportedFromIB2</string> <string>236.IBPluginDependency</string> <string>236.ImportedFromIB2</string> <string>239.IBPluginDependency</string> <string>239.ImportedFromIB2</string> <string>24.IBEditorWindowLastContentRect</string> <string>24.IBPluginDependency</string> <string>24.ImportedFromIB2</string> <string>24.editorWindowContentRectSynchronizationRect</string> <string>29.IBEditorWindowLastContentRect</string> <string>29.IBPluginDependency</string> <string>29.ImportedFromIB2</string> <string>29.WindowOrigin</string> <string>29.editorWindowContentRectSynchronizationRect</string> <string>295.IBPluginDependency</string> <string>296.IBEditorWindowLastContentRect</string> <string>296.IBPluginDependency</string> <string>296.editorWindowContentRectSynchronizationRect</string> <string>297.IBPluginDependency</string> <string>298.IBPluginDependency</string> <string>346.IBPluginDependency</string> <string>346.ImportedFromIB2</string> <string>348.IBPluginDependency</string> <string>348.ImportedFromIB2</string> <string>349.IBEditorWindowLastContentRect</string> <string>349.IBPluginDependency</string> <string>349.ImportedFromIB2</string> <string>349.editorWindowContentRectSynchronizationRect</string> <string>350.IBPluginDependency</string> <string>350.ImportedFromIB2</string> <string>351.IBPluginDependency</string> <string>351.ImportedFromIB2</string> <string>354.IBPluginDependency</string> <string>354.ImportedFromIB2</string> <string>371.IBEditorWindowLastContentRect</string> <string>371.IBPluginDependency</string> <string>371.IBWindowTemplateEditedContentRect</string> <string>371.NSWindowTemplate.visibleAtLaunch</string> <string>371.editorWindowContentRectSynchronizationRect</string> <string>371.windowTemplate.hasMinSize</string> <string>371.windowTemplate.maxSize</string> <string>371.windowTemplate.minSize</string> <string>372.IBPluginDependency</string> <string>375.IBPluginDependency</string> <string>376.IBEditorWindowLastContentRect</string> <string>376.IBPluginDependency</string> <string>377.IBPluginDependency</string> <string>388.IBEditorWindowLastContentRect</string> <string>388.IBPluginDependency</string> <string>389.IBPluginDependency</string> <string>390.IBPluginDependency</string> <string>391.IBPluginDependency</string> <string>392.IBPluginDependency</string> <string>393.IBPluginDependency</string> <string>394.IBPluginDependency</string> <string>395.IBPluginDependency</string> <string>396.IBPluginDependency</string> <string>397.IBPluginDependency</string> <string>398.IBPluginDependency</string> <string>399.IBPluginDependency</string> <string>400.IBPluginDependency</string> <string>401.IBPluginDependency</string> <string>402.IBPluginDependency</string> <string>403.IBPluginDependency</string> <string>404.IBPluginDependency</string> <string>405.IBPluginDependency</string> <string>406.IBPluginDependency</string> <string>407.IBPluginDependency</string> <string>408.IBPluginDependency</string> <string>409.IBPluginDependency</string> <string>410.IBPluginDependency</string> <string>411.IBPluginDependency</string> <string>412.IBPluginDependency</string> <string>413.IBPluginDependency</string> <string>414.IBPluginDependency</string> <string>415.IBPluginDependency</string> <string>416.IBPluginDependency</string> <string>417.IBPluginDependency</string> <string>418.IBPluginDependency</string> <string>419.IBPluginDependency</string> <string>450.IBPluginDependency</string> <string>451.IBEditorWindowLastContentRect</string> <string>451.IBPluginDependency</string> <string>452.IBPluginDependency</string> <string>453.IBPluginDependency</string> <string>454.IBPluginDependency</string> <string>457.IBPluginDependency</string> <string>459.IBPluginDependency</string> <string>460.IBPluginDependency</string> <string>462.IBPluginDependency</string> <string>465.IBPluginDependency</string> <string>466.IBPluginDependency</string> <string>485.IBPluginDependency</string> <string>490.IBPluginDependency</string> <string>491.IBEditorWindowLastContentRect</string> <string>491.IBPluginDependency</string> <string>492.IBPluginDependency</string> <string>496.IBPluginDependency</string> <string>497.IBEditorWindowLastContentRect</string> <string>497.IBPluginDependency</string> <string>498.IBPluginDependency</string> <string>499.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>5.ImportedFromIB2</string> <string>500.IBPluginDependency</string> <string>501.IBPluginDependency</string> <string>502.IBPluginDependency</string> <string>503.IBPluginDependency</string> <string>504.IBPluginDependency</string> <string>505.IBPluginDependency</string> <string>506.IBPluginDependency</string> <string>507.IBPluginDependency</string> <string>508.IBEditorWindowLastContentRect</string> <string>508.IBPluginDependency</string> <string>509.IBPluginDependency</string> <string>510.IBPluginDependency</string> <string>511.IBPluginDependency</string> <string>512.IBPluginDependency</string> <string>513.IBPluginDependency</string> <string>514.IBPluginDependency</string> <string>515.IBPluginDependency</string> <string>516.IBPluginDependency</string> <string>517.IBPluginDependency</string> <string>535.IBPluginDependency</string> <string>536.IBPluginDependency</string> <string>541.IBPluginDependency</string> <string>542.IBPluginDependency</string> <string>543.IBPluginDependency</string> <string>544.IBPluginDependency</string> <string>545.IBPluginDependency</string> <string>546.IBPluginDependency</string> <string>547.IBPluginDependency</string> <string>548.IBPluginDependency</string> <string>558.IBPluginDependency</string> <string>559.IBPluginDependency</string> <string>56.IBPluginDependency</string> <string>56.ImportedFromIB2</string> <string>57.IBEditorWindowLastContentRect</string> <string>57.IBPluginDependency</string> <string>57.ImportedFromIB2</string> <string>57.editorWindowContentRectSynchronizationRect</string> <string>577.IBPluginDependency</string> <string>58.IBPluginDependency</string> <string>58.ImportedFromIB2</string> <string>590.IBPluginDependency</string> <string>591.IBPluginDependency</string> <string>592.IBPluginDependency</string> <string>597.IBPluginDependency</string> <string>598.IBPluginDependency</string> <string>609.IBPluginDependency</string> <string>610.IBPluginDependency</string> <string>611.IBPluginDependency</string> <string>72.IBPluginDependency</string> <string>72.ImportedFromIB2</string> <string>73.IBPluginDependency</string> <string>73.ImportedFromIB2</string> <string>74.IBPluginDependency</string> <string>74.ImportedFromIB2</string> <string>75.IBPluginDependency</string> <string>75.ImportedFromIB2</string> <string>77.IBPluginDependency</string> <string>77.ImportedFromIB2</string> <string>78.IBPluginDependency</string> <string>78.ImportedFromIB2</string> <string>79.IBPluginDependency</string> <string>79.ImportedFromIB2</string> <string>80.IBPluginDependency</string> <string>80.ImportedFromIB2</string> <string>81.IBEditorWindowLastContentRect</string> <string>81.IBPluginDependency</string> <string>81.ImportedFromIB2</string> <string>81.editorWindowContentRectSynchronizationRect</string> <string>82.IBPluginDependency</string> <string>82.ImportedFromIB2</string> <string>83.IBPluginDependency</string> <string>83.ImportedFromIB2</string> <string>92.IBPluginDependency</string> <string>92.ImportedFromIB2</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{522, 812}, {146, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{436, 809}, {64, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 187}, {275, 113}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {275, 83}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{547, 180}, {254, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{187, 434}, {243, 243}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {167, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 217}, {238, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {241, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{654, 239}, {194, 73}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{525, 802}, {197, 73}}</string> <string>{{299, 836}, {476, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{74, 862}</string> <string>{{6, 978}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{604, 269}, {231, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{746, 287}, {220, 133}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {215, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{-1630, 40}, {1011, 669}}</string> + <string>{{274, 100}, {1011, 669}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{-1630, 40}, {1011, 669}}</string> + <string>{{274, 100}, {1011, 669}}</string> <integer value="1"/> <string>{{33, 99}, {480, 360}}</string> <boolean value="YES"/> <string>{3.40282e+38, 3.40282e+38}</string> <string>{720, 480}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{591, 420}, {83, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{523, 2}, {178, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{753, 197}, {170, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{725, 289}, {246, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{674, 260}, {204, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{878, 180}, {164, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{286, 129}, {275, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{23, 794}, {245, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{452, 109}, {196, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{145, 474}, {199, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">615</int> + <int key="maxID">621</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">ApplicationController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addImages:</string> <string>sendImage:</string> <string>zoomChanged:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>imageBrowser</string> <string>logTextField</string> <string>zoomSlider</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>IKImageBrowserView</string> <string>NSTextView</string> <string>NSSlider</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">ApplicationController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">GalleryDesktopServiceAppDelegate</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>appController</string> <string>window</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>ApplicationController</string> <string>NSWindow</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">GalleryDesktopServiceAppDelegate.h</string> </object> </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">IKImageBrowserView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>_dataSource</string> <string>_delegate</string> <string>_dragDestinationDelegate</string> <string>_horizontalScroller</string> <string>_verticalScroller</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>NSScroller</string> <string>NSScroller</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="278480848"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSActionCell</string> <string key="superclassName">NSCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="170563987"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="641296341"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1059350257"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSBrowser</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButton</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButtonCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSCell</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSControl</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="381234011"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSController</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>printDocument:</string> <string>revertDocumentToSaved:</string> <string>runPageLayout:</string> <string>saveDocument:</string> <string>saveDocumentAs:</string> <string>saveDocumentTo:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocumentController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>clearRecentDocuments:</string> <string>newDocument:</string> <string>openDocument:</string> <string>saveAllDocuments:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFontManager</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1017856300"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMatrix</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMatrix.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenu</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1071376953"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenuItem</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="738316654"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMovieView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="170563987"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="641296341"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="1059350257"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="381234011"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="1017856300"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <reference key="sourceIdentifier" ref="1071376953"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="982259079"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier" id="665570567"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSError.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> diff --git a/FilePathImageObject.h b/FilePathImageObject.h index 8245bc1..a1059a6 100644 --- a/FilePathImageObject.h +++ b/FilePathImageObject.h @@ -1,30 +1,29 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.h // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // -// An IKImageBrowserItem, a simple data object that holds an image path -// used by Image Kit Browser data source +// This class conforms to IKImageBrowserView's informal protocol IKImageBrowserItem +// IKImageBrowserItem is a simple data object that holds an image path for use by IKImageBrowserDataSource #import <Foundation/Foundation.h> @interface FilePathImageObject : NSObject + +// DECLARE ANY PROPERTY OR IVARS YOU NEED +// TO MANAGE YOUR IMAGE MODEL +// I SUGGEST A SIMPLE NSSTRING FOR THE FILE PATH { #pragma mark instance variables NSString *filePath; } -// DECLARE ANY PROPERTY OR IVARS YOU NEED -// TO MANAGE YOUR IMAGE MODEL -// I SUGGEST A SIMPLE NSSTRING FOR THE FILE PATH -#pragma mark - #pragma mark properties @property(nonatomic,retain)NSString *filePath; - @end diff --git a/FilePathImageObject.m b/FilePathImageObject.m index b0eb79f..06a678b 100644 --- a/FilePathImageObject.m +++ b/FilePathImageObject.m @@ -1,63 +1,56 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // -// A simple data object that holds an image path -// used by Image Kit Browser data source - #import "FilePathImageObject.h" #import <Quartz/Quartz.h> @implementation FilePathImageObject #pragma mark - #pragma mark properties @synthesize filePath; - (void) dealloc { // BE SURE TO CLEAN UP HERE! [filePath release], filePath = nil; [super dealloc]; } #pragma mark - #pragma mark IKImageBrowserItem - -// These methods implement the informal protocol -// required for objects returned by a IKImageBrowswerDataSource - -// You need to implement each of these +// Implement IKImageBrowserView's informal protocol IKImageBrowserItem - (NSString*) imageRepresentationType { return IKImageBrowserPathRepresentationType; } - (id) imageRepresentation { return self.filePath; } - (id) imageTitle { return self.filePath; } - (NSString *) imageUID { // use filePath as a unique identifier for the image return self.filePath; } - +#pragma mark - @end
beepscore/GalleryDesktopService
51b08c4505d4a207fbbf67401af4a1668401658b
Implement remove images.
diff --git a/ApplicationController.m b/ApplicationController.m index 07da5ee..7926298 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,403 +1,402 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // HW_TODO : // ADD SOME IMAGES TO THE MODEL TO START OFF // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // HW_TODO: // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC // Make sure the image browser allows reordering [imageBrowser_ setAllowsReordering:YES]; [imageBrowser_ setAnimates:YES]; //HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // HW_TODO : // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES // USE THIS CODE OR YOUR OWN : NSString* filename = [path lastPathComponent]; if([filename length] > 0) { if ( [filename characterAtIndex:0] == L'.') return; } // CHECK IF THIS PATH IS A DIRECTORY // IF IT IS, ADD EACH FILE IN IT RECURSIVELY // YOU CAN USE THIS CODE OR YOUR OWN : BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; if (isDirectory) { [self addImagesFromDirectory:path atIndex:index]; return; } // OTHERWISE JUST ADD THIS FILE // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; tempFilePathImageObject.filePath = path; [images_ addObject:tempFilePathImageObject]; [tempFilePathImageObject release]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else [self addImageWithPath:path]; [imageBrowser_ reloadData]; // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // HW_TODO : // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) // TO SEND YOU NEED AN NSIMAGE // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO // FINALLY SEND IT USING THE LINE BELOW //[imageShareService_ sendImageToClients:image]; } - (IBAction) addImages:(id)sender { // This is how to create a standard open file panel // and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { // HW_TODO : // UPDATE THE ZOOM ON THE BROWSER VIEW } #pragma mark - #pragma mark IKImageBrowserDataSource /* implement image-browser's datasource protocol Our datasource representation is a simple mutable array */ - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // HW_TODO : // RETURN THE # OF IMAGES IN THE MODEL // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { // HW_TODO : // REMOVE THE IMAGE OBJECTS AT THE GIVEN INDICES + [images_ removeObjectsAtIndexes:indexes]; } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; - } - + } return YES; } - @end
beepscore/GalleryDesktopService
216a35fc3733df9570157c4e1d5f334d30157705
In FilePathImageObject, implement required methods.
diff --git a/ApplicationController.m b/ApplicationController.m index 0a9ca9b..07da5ee 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,398 +1,403 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // HW_TODO : // ADD SOME IMAGES TO THE MODEL TO START OFF // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS + [self addImagesFromDirectory:@"/Library/Desktop Pictures/"]; // HW_TODO: // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC // Make sure the image browser allows reordering [imageBrowser_ setAllowsReordering:YES]; [imageBrowser_ setAnimates:YES]; //HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // HW_TODO : // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES // USE THIS CODE OR YOUR OWN : - //NSString* filename = [path lastPathComponent]; + NSString* filename = [path lastPathComponent]; - //if([filename length] > 0) - //{ - // if ( [filename characterAtIndex:0] == L'.') - // return; - //} + if([filename length] > 0) + { + if ( [filename characterAtIndex:0] == L'.') + return; + } // CHECK IF THIS PATH IS A DIRECTORY // IF IT IS, ADD EACH FILE IN IT RECURSIVELY // YOU CAN USE THIS CODE OR YOUR OWN : - //BOOL isDirectory = NO; - //[[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; + BOOL isDirectory = NO; + [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; - //if (isDirectory) - //{ - // [self addImagesFromDirectory:path atIndex:index]; - // return; - //} + if (isDirectory) + { + [self addImagesFromDirectory:path atIndex:index]; + return; + } // OTHERWISE JUST ADD THIS FILE // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ + FilePathImageObject* tempFilePathImageObject = [[FilePathImageObject alloc] init]; + tempFilePathImageObject.filePath = path; + [images_ addObject:tempFilePathImageObject]; + [tempFilePathImageObject release]; } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else [self addImageWithPath:path]; [imageBrowser_ reloadData]; // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // HW_TODO : // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) // TO SEND YOU NEED AN NSIMAGE // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO // FINALLY SEND IT USING THE LINE BELOW //[imageShareService_ sendImageToClients:image]; } - (IBAction) addImages:(id)sender { // This is how to create a standard open file panel // and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { // HW_TODO : // UPDATE THE ZOOM ON THE BROWSER VIEW } #pragma mark - #pragma mark IKImageBrowserDataSource /* implement image-browser's datasource protocol Our datasource representation is a simple mutable array */ - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // HW_TODO : // RETURN THE # OF IMAGES IN THE MODEL // [[view visibleItemIndexes] count] only counts visible items? NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { // HW_TODO : // REMOVE THE IMAGE OBJECTS AT THE GIVEN INDICES } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/FilePathImageObject.h b/FilePathImageObject.h index 48873a4..8245bc1 100644 --- a/FilePathImageObject.h +++ b/FilePathImageObject.h @@ -1,24 +1,30 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.h // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // -// A simple data object that holds an image path +// An IKImageBrowserItem, a simple data object that holds an image path // used by Image Kit Browser data source #import <Foundation/Foundation.h> @interface FilePathImageObject : NSObject { +#pragma mark instance variables + NSString *filePath; } // DECLARE ANY PROPERTY OR IVARS YOU NEED // TO MANAGE YOUR IMAGE MODEL // I SUGGEST A SIMPLE NSSTRING FOR THE FILE PATH +#pragma mark - +#pragma mark properties +@property(nonatomic,retain)NSString *filePath; + @end diff --git a/FilePathImageObject.m b/FilePathImageObject.m index f43d22e..b0eb79f 100644 --- a/FilePathImageObject.m +++ b/FilePathImageObject.m @@ -1,54 +1,63 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // A simple data object that holds an image path // used by Image Kit Browser data source #import "FilePathImageObject.h" #import <Quartz/Quartz.h> @implementation FilePathImageObject +#pragma mark - +#pragma mark properties +@synthesize filePath; - (void) dealloc { // BE SURE TO CLEAN UP HERE! + [filePath release], filePath = nil; [super dealloc]; } #pragma mark - #pragma mark IKImageBrowserItem // These methods implement the informal protocol // required for objects returned by a IKImageBrowswerDataSource // You need to implement each of these -/* - (NSString*) imageRepresentationType { + return IKImageBrowserPathRepresentationType; } + - (id) imageRepresentation { + return self.filePath; } + - (id) imageTitle { + return self.filePath; } - (NSString *) imageUID { - + // use filePath as a unique identifier for the image + return self.filePath; } -*/ + @end
beepscore/GalleryDesktopService
28023b019ba008c122755c96b5292cdab66fcd6c
Change Build Settings/Packaging/PRODUCT_NAME in Build and Target
diff --git a/ApplicationController.m b/ApplicationController.m index c1c0d16..0a9ca9b 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,394 +1,398 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // HW_TODO : // ADD SOME IMAGES TO THE MODEL TO START OFF // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS // HW_TODO: // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC // Make sure the image browser allows reordering [imageBrowser_ setAllowsReordering:YES]; [imageBrowser_ setAnimates:YES]; //HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // HW_TODO : // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES // USE THIS CODE OR YOUR OWN : //NSString* filename = [path lastPathComponent]; //if([filename length] > 0) //{ // if ( [filename characterAtIndex:0] == L'.') // return; //} // CHECK IF THIS PATH IS A DIRECTORY // IF IT IS, ADD EACH FILE IN IT RECURSIVELY // YOU CAN USE THIS CODE OR YOUR OWN : //BOOL isDirectory = NO; //[[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; //if (isDirectory) //{ // [self addImagesFromDirectory:path atIndex:index]; // return; //} // OTHERWISE JUST ADD THIS FILE // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else [self addImageWithPath:path]; [imageBrowser_ reloadData]; // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // HW_TODO : // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) // TO SEND YOU NEED AN NSIMAGE // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO // FINALLY SEND IT USING THE LINE BELOW //[imageShareService_ sendImageToClients:image]; } - (IBAction) addImages:(id)sender { // This is how to create a standard open file panel // and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { // HW_TODO : // UPDATE THE ZOOM ON THE BROWSER VIEW } #pragma mark - #pragma mark IKImageBrowserDataSource /* implement image-browser's datasource protocol Our datasource representation is a simple mutable array */ - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // HW_TODO : // RETURN THE # OF IMAGES IN THE MODEL + // [[view visibleItemIndexes] count] only counts visible items? + NSLog(@"numberOfItemsInImageBrowser = %d", [images_ count]); + return [images_ count]; } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX + return [images_ objectAtIndex:index]; } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { // HW_TODO : // REMOVE THE IMAGE OBJECTS AT THE GIVEN INDICES } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index f2d6944..473418d 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1,692 +1,692 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1060</int> <string key="IBDocument.SystemVersion">10D573</string> <string key="IBDocument.InterfaceBuilderVersion">762</string> <string key="IBDocument.AppKitVersion">1038.29</string> <string key="IBDocument.HIToolboxVersion">460.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.imagekit.ibplugin</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>762</string> <string>1.1</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="1021"> <string key="NSClassName">NSApplication</string> </object> <object class="NSCustomObject" id="1014"> <string key="NSClassName">FirstResponder</string> </object> <object class="NSCustomObject" id="1050"> <string key="NSClassName">NSApplication</string> </object> <object class="NSMenu" id="649796088"> <string key="NSTitle">AMainMenu</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="694149608"> <reference key="NSMenu" ref="649796088"/> - <string key="NSTitle">DesktopService</string> + <string key="NSTitle">GalleryDesktopService</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <object class="NSCustomResource" key="NSOnImage" id="35465992"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSMenuCheckmark</string> </object> <object class="NSCustomResource" key="NSMixedImage" id="502551668"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSMenuMixedState</string> </object> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="110575045"> - <string key="NSTitle">DesktopService</string> + <string key="NSTitle">GalleryDesktopService</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="238522557"> <reference key="NSMenu" ref="110575045"/> - <string key="NSTitle">About DesktopService</string> + <string key="NSTitle">About GalleryDesktopService</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="304266470"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="609285721"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Preferences…</string> <string key="NSKeyEquiv">,</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="481834944"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1046388886"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Services</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="752062318"> <string key="NSTitle">Services</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <string key="NSName">_NSServicesMenu</string> </object> </object> <object class="NSMenuItem" id="646227648"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="755159360"> <reference key="NSMenu" ref="110575045"/> - <string key="NSTitle">Hide DesktopService</string> + <string key="NSTitle">Hide GalleryDesktopService</string> <string key="NSKeyEquiv">h</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="342932134"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Hide Others</string> <string key="NSKeyEquiv">h</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="908899353"> <reference key="NSMenu" ref="110575045"/> <string key="NSTitle">Show All</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1056857174"> <reference key="NSMenu" ref="110575045"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="632727374"> <reference key="NSMenu" ref="110575045"/> - <string key="NSTitle">Quit DesktopService</string> + <string key="NSTitle">Quit GalleryDesktopService</string> <string key="NSKeyEquiv">q</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSAppleMenu</string> </object> </object> <object class="NSMenuItem" id="379814623"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">File</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="720053764"> <string key="NSTitle">File</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="705341025"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">New</string> <string key="NSKeyEquiv">n</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="722745758"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Open…</string> <string key="NSKeyEquiv">o</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1025936716"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Open Recent</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="1065607017"> <string key="NSTitle">Open Recent</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="759406840"> <reference key="NSMenu" ref="1065607017"/> <string key="NSTitle">Clear Menu</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSRecentDocumentsMenu</string> </object> </object> <object class="NSMenuItem" id="425164168"> <reference key="NSMenu" ref="720053764"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="776162233"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Close</string> <string key="NSKeyEquiv">w</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1023925487"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Save</string> <string key="NSKeyEquiv">s</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="117038363"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Save As…</string> <string key="NSKeyEquiv">S</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="579971712"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Revert to Saved</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1010469920"> <reference key="NSMenu" ref="720053764"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="294629803"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Page Setup...</string> <string key="NSKeyEquiv">P</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSToolTip"/> </object> <object class="NSMenuItem" id="49223823"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">Print…</string> <string key="NSKeyEquiv">p</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="952259628"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Edit</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="789758025"> <string key="NSTitle">Edit</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1058277027"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Undo</string> <string key="NSKeyEquiv">z</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="790794224"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Redo</string> <string key="NSKeyEquiv">Z</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1040322652"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="296257095"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Cut</string> <string key="NSKeyEquiv">x</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="860595796"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Copy</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="29853731"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Paste</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="82994268"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Paste and Match Style</string> <string key="NSKeyEquiv">V</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="437104165"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Delete</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="583158037"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Select All</string> <string key="NSKeyEquiv">a</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="212016141"> <reference key="NSMenu" ref="789758025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="892235320"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Find</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="963351320"> <string key="NSTitle">Find</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="447796847"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find…</string> <string key="NSKeyEquiv">f</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">1</int> </object> <object class="NSMenuItem" id="326711663"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find Next</string> <string key="NSKeyEquiv">g</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">2</int> </object> <object class="NSMenuItem" id="270902937"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Find Previous</string> <string key="NSKeyEquiv">G</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">3</int> </object> <object class="NSMenuItem" id="159080638"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Use Selection for Find</string> <string key="NSKeyEquiv">e</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">7</int> </object> <object class="NSMenuItem" id="88285865"> <reference key="NSMenu" ref="963351320"/> <string key="NSTitle">Jump to Selection</string> <string key="NSKeyEquiv">j</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="972420730"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Spelling and Grammar</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="769623530"> <string key="NSTitle">Spelling and Grammar</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="679648819"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Show Spelling and Grammar</string> <string key="NSKeyEquiv">:</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="96193923"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Check Document Now</string> <string key="NSKeyEquiv">;</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="859480356"> <reference key="NSMenu" ref="769623530"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="948374510"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Check Spelling While Typing</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="967646866"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Check Grammar With Spelling</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="795346622"> <reference key="NSMenu" ref="769623530"/> <string key="NSTitle">Correct Spelling Automatically</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="507821607"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Substitutions</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="698887838"> <string key="NSTitle">Substitutions</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="65139061"> <reference key="NSMenu" ref="698887838"/> <string key="NSTitle">Show Substitutions</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="19036812"> <reference key="NSMenu" ref="698887838"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="605118523"> <reference key="NSMenu" ref="698887838"/> <string key="NSTitle">Smart Copy/Paste</string> <string key="NSKeyEquiv">f</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">1</int> </object> <object class="NSMenuItem" id="197661976"> <reference key="NSMenu" ref="698887838"/> <string key="NSTitle">Smart Quotes</string> <string key="NSKeyEquiv">g</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">2</int> </object> <object class="NSMenuItem" id="672708820"> <reference key="NSMenu" ref="698887838"/> <string key="NSTitle">Smart Dashes</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="708854459"> <reference key="NSMenu" ref="698887838"/> <string key="NSTitle">Smart Links</string> <string key="NSKeyEquiv">G</string> <int key="NSKeyEquivModMask">1179648</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <int key="NSTag">3</int> </object> <object class="NSMenuItem" id="537092702"> <reference key="NSMenu" ref="698887838"/> <string key="NSTitle">Text Replacement</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="288088188"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Transformations</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="579392910"> <string key="NSTitle">Transformations</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1060694897"> <reference key="NSMenu" ref="579392910"/> <string key="NSTitle">Make Upper Case</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="879586729"> <reference key="NSMenu" ref="579392910"/> <string key="NSTitle">Make Lower Case</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="56570060"> <reference key="NSMenu" ref="579392910"/> <string key="NSTitle">Capitalize</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="676164635"> <reference key="NSMenu" ref="789758025"/> <string key="NSTitle">Speech</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> @@ -819,1025 +819,1025 @@ <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="767671776"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Kern</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="175441468"> <string key="NSTitle">Kern</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="252969304"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Use Default</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="766922938"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Use None</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="677519740"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Tighten</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="238351151"> <reference key="NSMenu" ref="175441468"/> <string key="NSTitle">Loosen</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="691570813"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Ligature</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="1058217995"> <string key="NSTitle">Ligature</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="706297211"> <reference key="NSMenu" ref="1058217995"/> <string key="NSTitle">Use Default</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="568384683"> <reference key="NSMenu" ref="1058217995"/> <string key="NSTitle">Use None</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="663508465"> <reference key="NSMenu" ref="1058217995"/> <string key="NSTitle">Use All</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="769124883"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Baseline</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="18263474"> <string key="NSTitle">Baseline</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="257962622"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Use Default</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="644725453"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Superscript</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1037576581"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Subscript</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="941806246"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Raise</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1045724900"> <reference key="NSMenu" ref="18263474"/> <string key="NSTitle">Lower</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="739652853"> <reference key="NSMenu" ref="786677654"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="1012600125"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Show Colors</string> <string key="NSKeyEquiv">C</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="214559597"> <reference key="NSMenu" ref="786677654"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="596732606"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Copy Style</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="393423671"> <reference key="NSMenu" ref="786677654"/> <string key="NSTitle">Paste Style</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSFontMenu</string> </object> </object> <object class="NSMenuItem" id="215659978"> <reference key="NSMenu" ref="941447902"/> <string key="NSTitle">Text</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="446991534"> <string key="NSTitle">Text</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="875092757"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Align Left</string> <string key="NSKeyEquiv">{</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="630155264"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Center</string> <string key="NSKeyEquiv">|</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="945678886"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Justify</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="512868991"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Align Right</string> <string key="NSKeyEquiv">}</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="163117631"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="31516759"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Writing Direction</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="956096989"> <string key="NSTitle">Writing Direction</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="257099033"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Paragraph</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="551969625"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="249532473"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="607364498"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="508151438"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="981751889"> <reference key="NSMenu" ref="956096989"/> <bool key="NSIsDisabled">YES</bool> <string key="NSTitle">Selection</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="380031999"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CURlZmF1bHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="825984362"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CUxlZnQgdG8gUmlnaHQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="560145579"> <reference key="NSMenu" ref="956096989"/> <string type="base64-UTF8" key="NSTitle">CVJpZ2h0IHRvIExlZnQ</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="908105787"> <reference key="NSMenu" ref="446991534"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="644046920"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Show Ruler</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="231811626"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Copy Ruler</string> <string key="NSKeyEquiv">c</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="883618387"> <reference key="NSMenu" ref="446991534"/> <string key="NSTitle">Paste Ruler</string> <string key="NSKeyEquiv">v</string> <int key="NSKeyEquivModMask">1310720</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> </object> </object> </object> <object class="NSMenuItem" id="586577488"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">View</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="466310130"> <string key="NSTitle">View</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="102151532"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Show Toolbar</string> <string key="NSKeyEquiv">t</string> <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="237841660"> <reference key="NSMenu" ref="466310130"/> <string key="NSTitle">Customize Toolbar…</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> </object> </object> <object class="NSMenuItem" id="713487014"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Window</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="835318025"> <string key="NSTitle">Window</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="1011231497"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Minimize</string> <string key="NSKeyEquiv">m</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="575023229"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Zoom</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="299356726"> <reference key="NSMenu" ref="835318025"/> <bool key="NSIsDisabled">YES</bool> <bool key="NSIsSeparator">YES</bool> <string key="NSTitle"/> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> <object class="NSMenuItem" id="625202149"> <reference key="NSMenu" ref="835318025"/> <string key="NSTitle">Bring All to Front</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSWindowsMenu</string> </object> </object> <object class="NSMenuItem" id="448692316"> <reference key="NSMenu" ref="649796088"/> <string key="NSTitle">Help</string> <string key="NSKeyEquiv"/> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> <string key="NSAction">submenuAction:</string> <object class="NSMenu" key="NSSubmenu" id="992780483"> <string key="NSTitle">Help</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="105068016"> <reference key="NSMenu" ref="992780483"/> <string key="NSTitle">DesktopService Help</string> <string key="NSKeyEquiv">?</string> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="35465992"/> <reference key="NSMixedImage" ref="502551668"/> </object> </object> <string key="NSName">_NSHelpMenu</string> </object> </object> </object> <string key="NSName">_NSMainMenu</string> </object> <object class="NSWindowTemplate" id="972006081"> <int key="NSWindowStyleMask">15</int> <int key="NSWindowBacking">2</int> <string key="NSWindowRect">{{335, 81}, {1011, 669}}</string> <int key="NSWTFlags">1954021376</int> - <string key="NSWindowTitle">DesktopService</string> + <string key="NSWindowTitle">GalleryDesktopService</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <string key="NSWindowContentMinSize">{720, 480}</string> <object class="NSView" key="NSWindowView" id="439893737"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextField" id="542196890"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 414}, {38, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="959611778"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Log</string> <object class="NSFont" key="NSSupport" id="1000618677"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="542196890"/> <object class="NSColor" key="NSBackgroundColor" id="760086907"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor" id="104511740"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> </object> </object> <object class="NSColor" key="NSTextColor" id="178691194"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlTextColor</string> <object class="NSColor" key="NSColor" id="733687712"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MAA</bytes> </object> </object> </object> </object> <object class="NSTextField" id="988469753"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 632}, {454, 17}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="325691760"> <int key="NSCellFlags">68288064</int> <int key="NSCellFlags2">272630784</int> <string key="NSContents">Homework 7 :</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande-Bold</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="988469753"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSTextField" id="18745654"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 439}, {303, 185}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="833549254"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">272629760</int> <string type="base64-UTF8" key="NSContents">VGhpcyBhcHBsaWNhaXRvbiBwdWJsaXNoZXMgYSBzZXJ2aWNlIHZpYSBCb25qb3VyLiBBIGNvbXBhbmlv biBpUGhvbmUgYXBwbGljYXRpb24gYnJvd3NlcyBmb3IgdGhpcyBzZXJ2aWNlLiBDb25uZWN0ZWQgaVBo b25lIGNsaWVudHMgd2lsbCByZWNpZXZlIGFuIGltYWdlIGZyb20gdGhpcyBzZXJ2aWNlIHRvIGRpc3Bs YXkuIAoKVGhlIEltYWdlIGlzIHNlbGVjdGVkIGF0IHRoZSByaWdodCBhbmQgc2VudCB1c2luZyB0aGUg IlNlbmQgSW1hZ2UiIGJ1dHRvbi4gQWRkaXRpb25hbCBpbWFnZXMgb3IgZm9sZGVycyBvZiBpbWFnZXMg Y2FuIGJlIGFkZGVkIHRvIHRoZSBicm93c2VyIHVzaW5nIHRoZSAiQWRkIEltYWdlcy4uLiIgYnV0dG9u LiA</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande</string> <double key="NSSize">13</double> <int key="NSfFlags">16</int> </object> <reference key="NSControlView" ref="18745654"/> <reference key="NSBackgroundColor" ref="760086907"/> <reference key="NSTextColor" ref="178691194"/> </object> </object> <object class="NSScrollView" id="305991980"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">4368</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="432592696"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTextView" id="981802596"> <reference key="NSNextResponder" ref="432592696"/> <int key="NSvFlags">6418</int> <string key="NSFrameSize">{295, 14}</string> <reference key="NSSuperview" ref="432592696"/> <object class="NSTextContainer" key="NSTextContainer" id="735441310"> <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> <object class="NSMutableString" key="NSString"> <characters key="NS.bytes"/> </object> <nil key="NSDelegate"/> </object> <object class="NSMutableArray" key="NSTextContainers"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="735441310"/> </object> <int key="NSLMFlags">134</int> <nil key="NSDelegate"/> </object> <reference key="NSTextView" ref="981802596"/> <double key="NSWidth">295</double> <int key="NSTCFlags">1</int> </object> <object class="NSTextViewSharedData" key="NSSharedData"> <int key="NSFlags">11557</int> <int key="NSTextCheckingTypes">0</int> <nil key="NSMarkedAttributes"/> <object class="NSColor" key="NSBackgroundColor" id="786488440"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MQA</bytes> </object> <object class="NSDictionary" key="NSSelectedAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSBackgroundColor</string> <string>NSColor</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextBackgroundColor</string> <reference key="NSColor" ref="104511740"/> </object> <object class="NSColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">selectedTextColor</string> <reference key="NSColor" ref="733687712"/> </object> </object> </object> <reference key="NSInsertionColor" ref="733687712"/> <object class="NSDictionary" key="NSLinkAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSColor</string> <string>NSCursor</string> <string>NSUnderline</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSColor"> <int key="NSColorSpace">1</int> <bytes key="NSRGB">MCAwIDEAA</bytes> </object> <object class="NSCursor"> <string key="NSHotSpot">{8, -8}</string> <int key="NSCursorType">13</int> </object> <integer value="1"/> </object> </object> <nil key="NSDefaultParagraphStyle"/> </object> <int key="NSTVFlags">6</int> <string key="NSMaxSize">{463, 1e+07}</string> <string key="NSMinize">{223, 0}</string> <nil key="NSDelegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {295, 360}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSNextKeyView" ref="981802596"/> <reference key="NSDocView" ref="981802596"/> <reference key="NSBGColor" ref="786488440"/> <object class="NSCursor" key="NSCursor"> <string key="NSHotSpot">{4, -5}</string> <int key="NSCursorType">1</int> </object> <int key="NScvFlags">4</int> </object> <object class="NSScroller" id="786198283"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {15, 318}}</string> <reference key="NSSuperview" ref="305991980"/> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.85256409645080566</double> </object> <object class="NSScroller" id="773550805"> <reference key="NSNextResponder" ref="305991980"/> <int key="NSvFlags">-2147479296</int> <string key="NSFrame">{{-100, -100}, {431, 15}}</string> <reference key="NSSuperview" ref="305991980"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="305991980"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">1</double> <double key="NSPercent">0.94565218687057495</double> </object> </object> <string key="NSFrame">{{20, 44}, {297, 362}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="432592696"/> <int key="NSsFlags">530</int> <reference key="NSVScroller" ref="786198283"/> <reference key="NSHScroller" ref="773550805"/> <reference key="NSContentView" ref="432592696"/> </object> <object class="NSButton" id="468638438"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{884, 8}, {113, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1061814889"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Send Image</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="468638438"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSButton" id="934936218"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">289</int> <string key="NSFrame">{{757, 8}, {127, 32}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="367445469"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134217728</int> <string key="NSContents">Add Images...</string> <reference key="NSSupport" ref="1000618677"/> <reference key="NSControlView" ref="934936218"/> <int key="NSButtonFlags">-2038284033</int> <int key="NSButtonFlags2">129</int> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">200</int> <int key="NSPeriodicInterval">25</int> </object> </object> <object class="NSSlider" id="562298877"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">256</int> <string key="NSFrame">{{325, 20}, {100, 16}}</string> <reference key="NSSuperview" ref="439893737"/> <bool key="NSEnabled">YES</bool> <object class="NSSliderCell" key="NSCell" id="589268444"> <int key="NSCellFlags">-2079981824</int> <int key="NSCellFlags2">262144</int> <string key="NSContents"/> <reference key="NSControlView" ref="562298877"/> <double key="NSMaxValue">1</double> <double key="NSMinValue">0.0</double> <double key="NSValue">0.5714285714285714</double> <double key="NSAltIncValue">0.0</double> <int key="NSNumberOfTickMarks">8</int> <int key="NSTickMarkPosition">1</int> <bool key="NSAllowsTickMarkValuesOnly">YES</bool> <bool key="NSVertical">NO</bool> </object> </object> <object class="NSScrollView" id="352236955"> <reference key="NSNextResponder" ref="439893737"/> <int key="NSvFlags">274</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSClipView" id="302360068"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">2304</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IKImageBrowserView" id="887580421"> <reference key="NSNextResponder" ref="302360068"/> <int key="NSvFlags">18</int> <object class="NSMutableSet" key="NSDragTypes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="set.sortedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <string>Apple PDF pasteboard type</string> <string>Apple PICT pasteboard type</string> <string>Apple PNG pasteboard type</string> <string>Apple URL pasteboard type</string> <string>NSFilenamesPboardType</string> <string>NSTypedFilenamesPboardType:'.SGI'</string> <string>NSTypedFilenamesPboardType:'8BPS'</string> <string>NSTypedFilenamesPboardType:'BMP '</string> <string>NSTypedFilenamesPboardType:'BMPf'</string> <string>NSTypedFilenamesPboardType:'EPSF'</string> <string>NSTypedFilenamesPboardType:'FPix'</string> <string>NSTypedFilenamesPboardType:'GIFf'</string> <string>NSTypedFilenamesPboardType:'ICO '</string> <string>NSTypedFilenamesPboardType:'JPEG'</string> <string>NSTypedFilenamesPboardType:'PDF '</string> <string>NSTypedFilenamesPboardType:'PICT'</string> <string>NSTypedFilenamesPboardType:'PNGf'</string> <string>NSTypedFilenamesPboardType:'PNTG'</string> <string>NSTypedFilenamesPboardType:'TIFF'</string> <string>NSTypedFilenamesPboardType:'TPIC'</string> <string>NSTypedFilenamesPboardType:'icns'</string> <string>NSTypedFilenamesPboardType:'jp2 '</string> <string>NSTypedFilenamesPboardType:'qtif'</string> <string>NSTypedFilenamesPboardType:3FR</string> <string>NSTypedFilenamesPboardType:3fr</string> <string>NSTypedFilenamesPboardType:ARW</string> <string>NSTypedFilenamesPboardType:BMP</string> <string>NSTypedFilenamesPboardType:CR2</string> <string>NSTypedFilenamesPboardType:CRW</string> <string>NSTypedFilenamesPboardType:CUR</string> <string>NSTypedFilenamesPboardType:DCR</string> <string>NSTypedFilenamesPboardType:DNG</string> <string>NSTypedFilenamesPboardType:EFX</string> <string>NSTypedFilenamesPboardType:EPI</string> <string>NSTypedFilenamesPboardType:EPS</string> <string>NSTypedFilenamesPboardType:EPSF</string> <string>NSTypedFilenamesPboardType:EPSI</string> <string>NSTypedFilenamesPboardType:ERF</string> <string>NSTypedFilenamesPboardType:EXR</string> <string>NSTypedFilenamesPboardType:FAX</string> <string>NSTypedFilenamesPboardType:FFF</string> <string>NSTypedFilenamesPboardType:FPIX</string> <string>NSTypedFilenamesPboardType:FPX</string> <string>NSTypedFilenamesPboardType:G3</string> <string>NSTypedFilenamesPboardType:GIF</string> <string>NSTypedFilenamesPboardType:HDR</string> <string>NSTypedFilenamesPboardType:ICNS</string> <string>NSTypedFilenamesPboardType:ICO</string> <string>NSTypedFilenamesPboardType:JFAX</string> <string>NSTypedFilenamesPboardType:JFX</string> <string>NSTypedFilenamesPboardType:JP2</string> <string>NSTypedFilenamesPboardType:JPE</string> <string>NSTypedFilenamesPboardType:JPEG</string> <string>NSTypedFilenamesPboardType:JPF</string> <string>NSTypedFilenamesPboardType:JPG</string> <string>NSTypedFilenamesPboardType:MAC</string> <string>NSTypedFilenamesPboardType:MOS</string> <string>NSTypedFilenamesPboardType:MRW</string> <string>NSTypedFilenamesPboardType:NEF</string> <string>NSTypedFilenamesPboardType:NRW</string> <string>NSTypedFilenamesPboardType:ORF</string> <string>NSTypedFilenamesPboardType:PCT</string> <string>NSTypedFilenamesPboardType:PDF</string> <string>NSTypedFilenamesPboardType:PEF</string> <string>NSTypedFilenamesPboardType:PIC</string> <string>NSTypedFilenamesPboardType:PICT</string> <string>NSTypedFilenamesPboardType:PNG</string> <string>NSTypedFilenamesPboardType:PNT</string> <string>NSTypedFilenamesPboardType:PNTG</string> <string>NSTypedFilenamesPboardType:PS</string> <string>NSTypedFilenamesPboardType:PSD</string> <string>NSTypedFilenamesPboardType:QTI</string> <string>NSTypedFilenamesPboardType:QTIF</string> <string>NSTypedFilenamesPboardType:RAF</string> <string>NSTypedFilenamesPboardType:RAW</string> <string>NSTypedFilenamesPboardType:RGB</string> <string>NSTypedFilenamesPboardType:RW2</string> <string>NSTypedFilenamesPboardType:RWL</string> <string>NSTypedFilenamesPboardType:SGI</string> <string>NSTypedFilenamesPboardType:SR2</string> <string>NSTypedFilenamesPboardType:SRF</string> <string>NSTypedFilenamesPboardType:TARGA</string> <string>NSTypedFilenamesPboardType:TGA</string> <string>NSTypedFilenamesPboardType:TIF</string> <string>NSTypedFilenamesPboardType:TIFF</string> <string>NSTypedFilenamesPboardType:XBM</string> <string>NSTypedFilenamesPboardType:arw</string> <string>NSTypedFilenamesPboardType:bmp</string> <string>NSTypedFilenamesPboardType:cr2</string> <string>NSTypedFilenamesPboardType:crw</string> <string>NSTypedFilenamesPboardType:cur</string> <string>NSTypedFilenamesPboardType:dcr</string> <string>NSTypedFilenamesPboardType:dng</string> <string>NSTypedFilenamesPboardType:efx</string> <string>NSTypedFilenamesPboardType:epi</string> <string>NSTypedFilenamesPboardType:eps</string> <string>NSTypedFilenamesPboardType:epsf</string> <string>NSTypedFilenamesPboardType:epsi</string> <string>NSTypedFilenamesPboardType:erf</string> <string>NSTypedFilenamesPboardType:exr</string> <string>NSTypedFilenamesPboardType:fax</string> <string>NSTypedFilenamesPboardType:fff</string> <string>NSTypedFilenamesPboardType:fpix</string> <string>NSTypedFilenamesPboardType:fpx</string> <string>NSTypedFilenamesPboardType:g3</string> <string>NSTypedFilenamesPboardType:gif</string> <string>NSTypedFilenamesPboardType:hdr</string> <string>NSTypedFilenamesPboardType:icns</string> <string>NSTypedFilenamesPboardType:ico</string> <string>NSTypedFilenamesPboardType:jfax</string> <string>NSTypedFilenamesPboardType:jfx</string> <string>NSTypedFilenamesPboardType:jp2</string> <string>NSTypedFilenamesPboardType:jpe</string> <string>NSTypedFilenamesPboardType:jpeg</string> <string>NSTypedFilenamesPboardType:jpf</string> <string>NSTypedFilenamesPboardType:jpg</string> <string>NSTypedFilenamesPboardType:mac</string> <string>NSTypedFilenamesPboardType:mos</string> <string>NSTypedFilenamesPboardType:mrw</string> <string>NSTypedFilenamesPboardType:nef</string> <string>NSTypedFilenamesPboardType:nrw</string> <string>NSTypedFilenamesPboardType:orf</string> <string>NSTypedFilenamesPboardType:pct</string> <string>NSTypedFilenamesPboardType:pdf</string> <string>NSTypedFilenamesPboardType:pef</string> <string>NSTypedFilenamesPboardType:pic</string> <string>NSTypedFilenamesPboardType:pict</string> <string>NSTypedFilenamesPboardType:png</string> <string>NSTypedFilenamesPboardType:pnt</string> <string>NSTypedFilenamesPboardType:pntg</string> <string>NSTypedFilenamesPboardType:ps</string> <string>NSTypedFilenamesPboardType:psd</string> <string>NSTypedFilenamesPboardType:qti</string> <string>NSTypedFilenamesPboardType:qtif</string> <string>NSTypedFilenamesPboardType:raf</string> <string>NSTypedFilenamesPboardType:raw</string> <string>NSTypedFilenamesPboardType:rgb</string> <string>NSTypedFilenamesPboardType:rw2</string> <string>NSTypedFilenamesPboardType:rwl</string> <string>NSTypedFilenamesPboardType:sgi</string> <string>NSTypedFilenamesPboardType:sr2</string> <string>NSTypedFilenamesPboardType:srf</string> <string>NSTypedFilenamesPboardType:targa</string> <string>NSTypedFilenamesPboardType:tga</string> <string>NSTypedFilenamesPboardType:tif</string> <string>NSTypedFilenamesPboardType:tiff</string> <string>NSTypedFilenamesPboardType:xbm</string> <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> <string>NeXT TIFF v4.0 pasteboard type</string> </object> </object> <string key="NSFrameSize">{664, 603}</string> <reference key="NSSuperview" ref="302360068"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="constrainsToOriginalSize">NO</bool> <bool key="cellsHaveSubtitle">NO</bool> <bool key="cellsHaveTitle">NO</bool> <bool key="outlinesCells">NO</bool> <bool key="shadowsCells">YES</bool> <bool key="animates">NO</bool> <bool key="allowsReordering">YES</bool> <bool key="allowsMultipleSelection">NO</bool> <float key="cellWidth">100</float> <float key="cellHeight">100</float> <reference key="dataSource"/> <reference key="delegate"/> </object> </object> <string key="NSFrame">{{1, 1}, {664, 603}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSNextKeyView" ref="887580421"/> <reference key="NSDocView" ref="887580421"/> <reference key="NSBGColor" ref="760086907"/> <int key="NScvFlags">6</int> </object> <object class="NSScroller" id="1064542466"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{575, 1}, {15, 588}}</string> <reference key="NSSuperview" ref="352236955"/> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSCurValue">0.81260364842454402</double> <double key="NSPercent">0.96363627910614014</double> </object> <object class="NSScroller" id="242271987"> <reference key="NSNextResponder" ref="352236955"/> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{1, 589}, {574, 15}}</string> <reference key="NSSuperview" ref="352236955"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="352236955"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.50602412223815918</double> </object> </object> <string key="NSFrame">{{325, 44}, {666, 605}}</string> <reference key="NSSuperview" ref="439893737"/> <reference key="NSNextKeyView" ref="302360068"/> <int key="NSsFlags">562</int> <reference key="NSVScroller" ref="1064542466"/> <reference key="NSHScroller" ref="242271987"/> <reference key="NSContentView" ref="302360068"/> <bytes key="NSScrollAmts">QSAAAEEgAABDAszNQvAAAA</bytes> </object> </object> <string key="NSFrameSize">{1011, 669}</string> </object> @@ -2483,1039 +2483,1042 @@ LiA</string> <reference key="source" ref="1014"/> <reference key="destination" ref="875092757"/> </object> <int key="connectionID">524</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionNatural:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="551969625"/> </object> <int key="connectionID">525</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionLeftToRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="249532473"/> </object> <int key="connectionID">526</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeBaseWritingDirectionRightToLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="607364498"/> </object> <int key="connectionID">527</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionNatural:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="380031999"/> </object> <int key="connectionID">528</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionLeftToRight:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="825984362"/> </object> <int key="connectionID">529</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">makeTextWritingDirectionRightToLeft:</string> <reference key="source" ref="1014"/> <reference key="destination" ref="560145579"/> </object> <int key="connectionID">530</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">window</string> <reference key="source" ref="976324537"/> <reference key="destination" ref="972006081"/> </object> <int key="connectionID">532</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">logTextField</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="981802596"/> </object> <int key="connectionID">549</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">appController</string> <reference key="source" ref="976324537"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">550</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">sendImage:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="468638438"/> </object> <int key="connectionID">589</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">imageBrowser</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="887580421"/> </object> <int key="connectionID">594</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">dataSource</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">603</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">604</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">dragDestinationDelegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">605</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_dataSource</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">606</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_delegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">607</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">_dragDestinationDelegate</string> <reference key="source" ref="887580421"/> <reference key="destination" ref="295914207"/> </object> <int key="connectionID">608</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">zoomChanged:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="562298877"/> </object> <int key="connectionID">613</int> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">zoomSlider</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="562298877"/> </object> <int key="connectionID">614</int> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">addImages:</string> <reference key="source" ref="295914207"/> <reference key="destination" ref="934936218"/> </object> <int key="connectionID">615</int> </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> <reference key="object" ref="0"/> <reference key="children" ref="1048"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="1021"/> <reference key="parent" ref="0"/> <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1014"/> <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1050"/> <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> <int key="objectID">29</int> <reference key="object" ref="649796088"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="713487014"/> <reference ref="694149608"/> <reference ref="952259628"/> <reference ref="379814623"/> <reference ref="586577488"/> <reference ref="302598603"/> <reference ref="448692316"/> </object> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">19</int> <reference key="object" ref="713487014"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="835318025"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">56</int> <reference key="object" ref="694149608"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="110575045"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">217</int> <reference key="object" ref="952259628"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="789758025"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">83</int> <reference key="object" ref="379814623"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="720053764"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">81</int> <reference key="object" ref="720053764"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1023925487"/> <reference ref="117038363"/> <reference ref="49223823"/> <reference ref="722745758"/> <reference ref="705341025"/> <reference ref="1025936716"/> <reference ref="294629803"/> <reference ref="776162233"/> <reference ref="425164168"/> <reference ref="579971712"/> <reference ref="1010469920"/> </object> <reference key="parent" ref="379814623"/> </object> <object class="IBObjectRecord"> <int key="objectID">75</int> <reference key="object" ref="1023925487"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">80</int> <reference key="object" ref="117038363"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">78</int> <reference key="object" ref="49223823"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">72</int> <reference key="object" ref="722745758"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">82</int> <reference key="object" ref="705341025"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">124</int> <reference key="object" ref="1025936716"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1065607017"/> </object> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">77</int> <reference key="object" ref="294629803"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">73</int> <reference key="object" ref="776162233"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">79</int> <reference key="object" ref="425164168"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">112</int> <reference key="object" ref="579971712"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">74</int> <reference key="object" ref="1010469920"/> <reference key="parent" ref="720053764"/> </object> <object class="IBObjectRecord"> <int key="objectID">125</int> <reference key="object" ref="1065607017"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="759406840"/> </object> <reference key="parent" ref="1025936716"/> </object> <object class="IBObjectRecord"> <int key="objectID">126</int> <reference key="object" ref="759406840"/> <reference key="parent" ref="1065607017"/> </object> <object class="IBObjectRecord"> <int key="objectID">205</int> <reference key="object" ref="789758025"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="437104165"/> <reference ref="583158037"/> <reference ref="1058277027"/> <reference ref="212016141"/> <reference ref="296257095"/> <reference ref="29853731"/> <reference ref="860595796"/> <reference ref="1040322652"/> <reference ref="790794224"/> <reference ref="892235320"/> <reference ref="972420730"/> <reference ref="676164635"/> <reference ref="507821607"/> <reference ref="288088188"/> <reference ref="82994268"/> </object> <reference key="parent" ref="952259628"/> </object> <object class="IBObjectRecord"> <int key="objectID">202</int> <reference key="object" ref="437104165"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">198</int> <reference key="object" ref="583158037"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">207</int> <reference key="object" ref="1058277027"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">214</int> <reference key="object" ref="212016141"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">199</int> <reference key="object" ref="296257095"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">203</int> <reference key="object" ref="29853731"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">197</int> <reference key="object" ref="860595796"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">206</int> <reference key="object" ref="1040322652"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">215</int> <reference key="object" ref="790794224"/> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">218</int> <reference key="object" ref="892235320"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="963351320"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">216</int> <reference key="object" ref="972420730"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="769623530"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">200</int> <reference key="object" ref="769623530"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="948374510"/> <reference ref="96193923"/> <reference ref="679648819"/> <reference ref="967646866"/> <reference ref="859480356"/> <reference ref="795346622"/> </object> <reference key="parent" ref="972420730"/> </object> <object class="IBObjectRecord"> <int key="objectID">219</int> <reference key="object" ref="948374510"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">201</int> <reference key="object" ref="96193923"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">204</int> <reference key="object" ref="679648819"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">220</int> <reference key="object" ref="963351320"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="270902937"/> <reference ref="88285865"/> <reference ref="159080638"/> <reference ref="326711663"/> <reference ref="447796847"/> </object> <reference key="parent" ref="892235320"/> </object> <object class="IBObjectRecord"> <int key="objectID">213</int> <reference key="object" ref="270902937"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">210</int> <reference key="object" ref="88285865"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">221</int> <reference key="object" ref="159080638"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">208</int> <reference key="object" ref="326711663"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">209</int> <reference key="object" ref="447796847"/> <reference key="parent" ref="963351320"/> </object> <object class="IBObjectRecord"> <int key="objectID">57</int> <reference key="object" ref="110575045"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="238522557"/> <reference ref="755159360"/> <reference ref="908899353"/> <reference ref="632727374"/> <reference ref="646227648"/> <reference ref="609285721"/> <reference ref="481834944"/> <reference ref="304266470"/> <reference ref="1046388886"/> <reference ref="1056857174"/> <reference ref="342932134"/> </object> <reference key="parent" ref="694149608"/> </object> <object class="IBObjectRecord"> <int key="objectID">58</int> <reference key="object" ref="238522557"/> <reference key="parent" ref="110575045"/> + <string key="objectName">Menu Item (About GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">134</int> <reference key="object" ref="755159360"/> <reference key="parent" ref="110575045"/> + <string key="objectName">Menu Item (Hide GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">150</int> <reference key="object" ref="908899353"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">136</int> <reference key="object" ref="632727374"/> <reference key="parent" ref="110575045"/> + <string key="objectName">Menu Item (Quit GalleryDesktopService)</string> </object> <object class="IBObjectRecord"> <int key="objectID">144</int> <reference key="object" ref="646227648"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">129</int> <reference key="object" ref="609285721"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">143</int> <reference key="object" ref="481834944"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">236</int> <reference key="object" ref="304266470"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">131</int> <reference key="object" ref="1046388886"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="752062318"/> </object> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">149</int> <reference key="object" ref="1056857174"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">145</int> <reference key="object" ref="342932134"/> <reference key="parent" ref="110575045"/> </object> <object class="IBObjectRecord"> <int key="objectID">130</int> <reference key="object" ref="752062318"/> <reference key="parent" ref="1046388886"/> </object> <object class="IBObjectRecord"> <int key="objectID">24</int> <reference key="object" ref="835318025"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="299356726"/> <reference ref="625202149"/> <reference ref="575023229"/> <reference ref="1011231497"/> </object> <reference key="parent" ref="713487014"/> </object> <object class="IBObjectRecord"> <int key="objectID">92</int> <reference key="object" ref="299356726"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">5</int> <reference key="object" ref="625202149"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">239</int> <reference key="object" ref="575023229"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">23</int> <reference key="object" ref="1011231497"/> <reference key="parent" ref="835318025"/> </object> <object class="IBObjectRecord"> <int key="objectID">295</int> <reference key="object" ref="586577488"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="466310130"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">296</int> <reference key="object" ref="466310130"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="102151532"/> <reference ref="237841660"/> </object> <reference key="parent" ref="586577488"/> </object> <object class="IBObjectRecord"> <int key="objectID">297</int> <reference key="object" ref="102151532"/> <reference key="parent" ref="466310130"/> </object> <object class="IBObjectRecord"> <int key="objectID">298</int> <reference key="object" ref="237841660"/> <reference key="parent" ref="466310130"/> </object> <object class="IBObjectRecord"> <int key="objectID">211</int> <reference key="object" ref="676164635"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="785027613"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">212</int> <reference key="object" ref="785027613"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="680220178"/> <reference ref="731782645"/> </object> <reference key="parent" ref="676164635"/> </object> <object class="IBObjectRecord"> <int key="objectID">195</int> <reference key="object" ref="680220178"/> <reference key="parent" ref="785027613"/> </object> <object class="IBObjectRecord"> <int key="objectID">196</int> <reference key="object" ref="731782645"/> <reference key="parent" ref="785027613"/> </object> <object class="IBObjectRecord"> <int key="objectID">346</int> <reference key="object" ref="967646866"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">348</int> <reference key="object" ref="507821607"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="698887838"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">349</int> <reference key="object" ref="698887838"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="605118523"/> <reference ref="197661976"/> <reference ref="708854459"/> <reference ref="65139061"/> <reference ref="19036812"/> <reference ref="672708820"/> <reference ref="537092702"/> </object> <reference key="parent" ref="507821607"/> </object> <object class="IBObjectRecord"> <int key="objectID">350</int> <reference key="object" ref="605118523"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">351</int> <reference key="object" ref="197661976"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">354</int> <reference key="object" ref="708854459"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">371</int> <reference key="object" ref="972006081"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="439893737"/> </object> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">372</int> <reference key="object" ref="439893737"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="988469753"/> <reference ref="542196890"/> <reference ref="18745654"/> <reference ref="305991980"/> <reference ref="468638438"/> <reference ref="934936218"/> <reference ref="562298877"/> <reference ref="352236955"/> </object> <reference key="parent" ref="972006081"/> </object> <object class="IBObjectRecord"> <int key="objectID">375</int> <reference key="object" ref="302598603"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="941447902"/> </object> <reference key="parent" ref="649796088"/> </object> <object class="IBObjectRecord"> <int key="objectID">376</int> <reference key="object" ref="941447902"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="792887677"/> <reference ref="215659978"/> </object> <reference key="parent" ref="302598603"/> </object> <object class="IBObjectRecord"> <int key="objectID">377</int> <reference key="object" ref="792887677"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="786677654"/> </object> <reference key="parent" ref="941447902"/> </object> <object class="IBObjectRecord"> <int key="objectID">388</int> <reference key="object" ref="786677654"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="159677712"/> <reference ref="305399458"/> <reference ref="814362025"/> <reference ref="330926929"/> <reference ref="533507878"/> <reference ref="158063935"/> <reference ref="885547335"/> <reference ref="901062459"/> <reference ref="767671776"/> <reference ref="691570813"/> <reference ref="769124883"/> <reference ref="739652853"/> <reference ref="1012600125"/> <reference ref="214559597"/> <reference ref="596732606"/> <reference ref="393423671"/> </object> <reference key="parent" ref="792887677"/> </object> <object class="IBObjectRecord"> <int key="objectID">389</int> <reference key="object" ref="159677712"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">390</int> <reference key="object" ref="305399458"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">391</int> <reference key="object" ref="814362025"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">392</int> <reference key="object" ref="330926929"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">393</int> <reference key="object" ref="533507878"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">394</int> <reference key="object" ref="158063935"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">395</int> <reference key="object" ref="885547335"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">396</int> <reference key="object" ref="901062459"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">397</int> <reference key="object" ref="767671776"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="175441468"/> </object> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">398</int> <reference key="object" ref="691570813"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1058217995"/> </object> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">399</int> <reference key="object" ref="769124883"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="18263474"/> </object> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">400</int> <reference key="object" ref="739652853"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">401</int> <reference key="object" ref="1012600125"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">402</int> <reference key="object" ref="214559597"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">403</int> <reference key="object" ref="596732606"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">404</int> <reference key="object" ref="393423671"/> <reference key="parent" ref="786677654"/> </object> <object class="IBObjectRecord"> <int key="objectID">405</int> <reference key="object" ref="18263474"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="257962622"/> <reference ref="644725453"/> <reference ref="1037576581"/> <reference ref="941806246"/> <reference ref="1045724900"/> </object> <reference key="parent" ref="769124883"/> </object> <object class="IBObjectRecord"> <int key="objectID">406</int> <reference key="object" ref="257962622"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">407</int> <reference key="object" ref="644725453"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">408</int> <reference key="object" ref="1037576581"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">409</int> <reference key="object" ref="941806246"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">410</int> <reference key="object" ref="1045724900"/> <reference key="parent" ref="18263474"/> </object> <object class="IBObjectRecord"> <int key="objectID">411</int> <reference key="object" ref="1058217995"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="706297211"/> <reference ref="568384683"/> <reference ref="663508465"/> </object> <reference key="parent" ref="691570813"/> </object> <object class="IBObjectRecord"> <int key="objectID">412</int> <reference key="object" ref="706297211"/> <reference key="parent" ref="1058217995"/> </object> <object class="IBObjectRecord"> <int key="objectID">413</int> <reference key="object" ref="568384683"/> <reference key="parent" ref="1058217995"/> </object> <object class="IBObjectRecord"> <int key="objectID">414</int> <reference key="object" ref="663508465"/> <reference key="parent" ref="1058217995"/> </object> <object class="IBObjectRecord"> <int key="objectID">415</int> <reference key="object" ref="175441468"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="252969304"/> <reference ref="766922938"/> <reference ref="677519740"/> <reference ref="238351151"/> </object> <reference key="parent" ref="767671776"/> </object> <object class="IBObjectRecord"> <int key="objectID">416</int> <reference key="object" ref="252969304"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">417</int> <reference key="object" ref="766922938"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">418</int> <reference key="object" ref="677519740"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">419</int> <reference key="object" ref="238351151"/> <reference key="parent" ref="175441468"/> </object> <object class="IBObjectRecord"> <int key="objectID">420</int> <reference key="object" ref="755631768"/> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">450</int> <reference key="object" ref="288088188"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="579392910"/> </object> <reference key="parent" ref="789758025"/> </object> <object class="IBObjectRecord"> <int key="objectID">451</int> <reference key="object" ref="579392910"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1060694897"/> <reference ref="879586729"/> <reference ref="56570060"/> </object> <reference key="parent" ref="288088188"/> </object> <object class="IBObjectRecord"> <int key="objectID">452</int> <reference key="object" ref="1060694897"/> <reference key="parent" ref="579392910"/> </object> <object class="IBObjectRecord"> <int key="objectID">453</int> <reference key="object" ref="859480356"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">454</int> <reference key="object" ref="795346622"/> <reference key="parent" ref="769623530"/> </object> <object class="IBObjectRecord"> <int key="objectID">457</int> <reference key="object" ref="65139061"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">459</int> <reference key="object" ref="19036812"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">460</int> <reference key="object" ref="672708820"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">462</int> <reference key="object" ref="537092702"/> <reference key="parent" ref="698887838"/> </object> <object class="IBObjectRecord"> <int key="objectID">465</int> <reference key="object" ref="879586729"/> <reference key="parent" ref="579392910"/> </object> <object class="IBObjectRecord"> <int key="objectID">466</int> <reference key="object" ref="56570060"/> @@ -3997,1271 +4000,1271 @@ LiA</string> <string>389.IBPluginDependency</string> <string>390.IBPluginDependency</string> <string>391.IBPluginDependency</string> <string>392.IBPluginDependency</string> <string>393.IBPluginDependency</string> <string>394.IBPluginDependency</string> <string>395.IBPluginDependency</string> <string>396.IBPluginDependency</string> <string>397.IBPluginDependency</string> <string>398.IBPluginDependency</string> <string>399.IBPluginDependency</string> <string>400.IBPluginDependency</string> <string>401.IBPluginDependency</string> <string>402.IBPluginDependency</string> <string>403.IBPluginDependency</string> <string>404.IBPluginDependency</string> <string>405.IBPluginDependency</string> <string>406.IBPluginDependency</string> <string>407.IBPluginDependency</string> <string>408.IBPluginDependency</string> <string>409.IBPluginDependency</string> <string>410.IBPluginDependency</string> <string>411.IBPluginDependency</string> <string>412.IBPluginDependency</string> <string>413.IBPluginDependency</string> <string>414.IBPluginDependency</string> <string>415.IBPluginDependency</string> <string>416.IBPluginDependency</string> <string>417.IBPluginDependency</string> <string>418.IBPluginDependency</string> <string>419.IBPluginDependency</string> <string>450.IBPluginDependency</string> <string>451.IBEditorWindowLastContentRect</string> <string>451.IBPluginDependency</string> <string>452.IBPluginDependency</string> <string>453.IBPluginDependency</string> <string>454.IBPluginDependency</string> <string>457.IBPluginDependency</string> <string>459.IBPluginDependency</string> <string>460.IBPluginDependency</string> <string>462.IBPluginDependency</string> <string>465.IBPluginDependency</string> <string>466.IBPluginDependency</string> <string>485.IBPluginDependency</string> <string>490.IBPluginDependency</string> <string>491.IBEditorWindowLastContentRect</string> <string>491.IBPluginDependency</string> <string>492.IBPluginDependency</string> <string>496.IBPluginDependency</string> <string>497.IBEditorWindowLastContentRect</string> <string>497.IBPluginDependency</string> <string>498.IBPluginDependency</string> <string>499.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>5.ImportedFromIB2</string> <string>500.IBPluginDependency</string> <string>501.IBPluginDependency</string> <string>502.IBPluginDependency</string> <string>503.IBPluginDependency</string> <string>504.IBPluginDependency</string> <string>505.IBPluginDependency</string> <string>506.IBPluginDependency</string> <string>507.IBPluginDependency</string> <string>508.IBEditorWindowLastContentRect</string> <string>508.IBPluginDependency</string> <string>509.IBPluginDependency</string> <string>510.IBPluginDependency</string> <string>511.IBPluginDependency</string> <string>512.IBPluginDependency</string> <string>513.IBPluginDependency</string> <string>514.IBPluginDependency</string> <string>515.IBPluginDependency</string> <string>516.IBPluginDependency</string> <string>517.IBPluginDependency</string> <string>535.IBPluginDependency</string> <string>536.IBPluginDependency</string> <string>541.IBPluginDependency</string> <string>542.IBPluginDependency</string> <string>543.IBPluginDependency</string> <string>544.IBPluginDependency</string> <string>545.IBPluginDependency</string> <string>546.IBPluginDependency</string> <string>547.IBPluginDependency</string> <string>548.IBPluginDependency</string> <string>558.IBPluginDependency</string> <string>559.IBPluginDependency</string> <string>56.IBPluginDependency</string> <string>56.ImportedFromIB2</string> <string>57.IBEditorWindowLastContentRect</string> <string>57.IBPluginDependency</string> <string>57.ImportedFromIB2</string> <string>57.editorWindowContentRectSynchronizationRect</string> <string>577.IBPluginDependency</string> <string>58.IBPluginDependency</string> <string>58.ImportedFromIB2</string> <string>590.IBPluginDependency</string> <string>591.IBPluginDependency</string> <string>592.IBPluginDependency</string> <string>597.IBPluginDependency</string> <string>598.IBPluginDependency</string> <string>609.IBPluginDependency</string> <string>610.IBPluginDependency</string> <string>611.IBPluginDependency</string> <string>72.IBPluginDependency</string> <string>72.ImportedFromIB2</string> <string>73.IBPluginDependency</string> <string>73.ImportedFromIB2</string> <string>74.IBPluginDependency</string> <string>74.ImportedFromIB2</string> <string>75.IBPluginDependency</string> <string>75.ImportedFromIB2</string> <string>77.IBPluginDependency</string> <string>77.ImportedFromIB2</string> <string>78.IBPluginDependency</string> <string>78.ImportedFromIB2</string> <string>79.IBPluginDependency</string> <string>79.ImportedFromIB2</string> <string>80.IBPluginDependency</string> <string>80.ImportedFromIB2</string> <string>81.IBEditorWindowLastContentRect</string> <string>81.IBPluginDependency</string> <string>81.ImportedFromIB2</string> <string>81.editorWindowContentRectSynchronizationRect</string> <string>82.IBPluginDependency</string> <string>82.ImportedFromIB2</string> <string>83.IBPluginDependency</string> <string>83.ImportedFromIB2</string> <string>92.IBPluginDependency</string> <string>92.ImportedFromIB2</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{522, 812}, {146, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{436, 809}, {64, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 187}, {275, 113}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {275, 83}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{547, 180}, {254, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{187, 434}, {243, 243}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {167, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{753, 217}, {238, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {241, 103}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{654, 239}, {194, 73}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{525, 802}, {197, 73}}</string> <string>{{299, 836}, {476, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{74, 862}</string> <string>{{6, 978}, {478, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{604, 269}, {231, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{475, 832}, {234, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{746, 287}, {220, 133}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{608, 612}, {215, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{-1630, 40}, {1011, 669}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{-1630, 40}, {1011, 669}}</string> <integer value="1"/> <string>{{33, 99}, {480, 360}}</string> <boolean value="YES"/> <string>{3.40282e+38, 3.40282e+38}</string> <string>{720, 480}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{591, 420}, {83, 43}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{523, 2}, {178, 283}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{753, 197}, {170, 63}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{725, 289}, {246, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{674, 260}, {204, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{878, 180}, {164, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{286, 129}, {275, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{23, 794}, {245, 183}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.imagekit.ibplugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{452, 109}, {196, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{145, 474}, {199, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> <int key="maxID">615</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">ApplicationController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addImages:</string> <string>sendImage:</string> <string>zoomChanged:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>imageBrowser</string> <string>logTextField</string> <string>zoomSlider</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>IKImageBrowserView</string> <string>NSTextView</string> <string>NSSlider</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">ApplicationController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">GalleryDesktopServiceAppDelegate</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>appController</string> <string>window</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>ApplicationController</string> <string>NSWindow</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">GalleryDesktopServiceAppDelegate.h</string> </object> </object> </object> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">IKImageBrowserView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>_dataSource</string> <string>_delegate</string> <string>_dragDestinationDelegate</string> <string>_horizontalScroller</string> <string>_verticalScroller</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>NSScroller</string> <string>NSScroller</string> </object> </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="914074605"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="278480848"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSActionCell</string> <string key="superclassName">NSCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <string key="superclassName">NSResponder</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="822405504"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="170563987"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="850738725"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="641296341"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="624831158"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1059350257"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSApplication</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSBrowser</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSBrowser.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButton</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSButtonCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSCell</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSControl</string> <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="310914472"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="381234011"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSController</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>printDocument:</string> <string>revertDocumentToSaved:</string> <string>runPageLayout:</string> <string>saveDocument:</string> <string>saveDocumentAs:</string> <string>saveDocumentTo:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocument</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSDocumentController</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>clearRecentDocuments:</string> <string>newDocument:</string> <string>openDocument:</string> <string>saveAllDocuments:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFontManager</string> <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="946436764"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1017856300"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMatrix</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMatrix.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenu</string> <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1056362899"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="1071376953"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMenuItem</string> <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="472958451"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="738316654"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSMovieView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSMovieView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="822405504"/> + <reference key="sourceIdentifier" ref="170563987"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="850738725"/> + <reference key="sourceIdentifier" ref="641296341"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="624831158"/> + <reference key="sourceIdentifier" ref="1059350257"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="310914472"/> + <reference key="sourceIdentifier" ref="381234011"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="946436764"/> + <reference key="sourceIdentifier" ref="1017856300"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="1056362899"/> + <reference key="sourceIdentifier" ref="1071376953"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="809545482"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="982259079"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="260078765"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="665570567"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSError.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <reference key="sourceIdentifier" ref="914074605"/> + <reference key="sourceIdentifier" ref="278480848"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/IKSaveOptions.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">ImageKit.framework/Headers/ImageKitDeprecated.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">PDFKit.framework/Headers/PDFDocument.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier" id="247579314"> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="135889388"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">PDFKit.framework/Headers/PDFView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzComposer.framework/Headers/QCCompositionParameterView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzComposer.framework/Headers/QCCompositionPickerView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuickLookUI.framework/Headers/QLPreviewPanel.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSResponder</string> <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSScrollView</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSScroller</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSScroller.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSSlider</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSlider.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSSliderCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSSliderCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTableView</string> <string key="superclassName">NSControl</string> - <reference key="sourceIdentifier" ref="809545482"/> + <reference key="sourceIdentifier" ref="982259079"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSText</string> <string key="superclassName">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSText.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextField</string> <string key="superclassName">NSControl</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextField.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextFieldCell</string> <string key="superclassName">NSActionCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSTextView</string> <string key="superclassName">NSText</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSTextView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSUserDefaultsController</string> <string key="superclassName">NSController</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSUserDefaultsController.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> - <reference key="sourceIdentifier" ref="472958451"/> + <reference key="sourceIdentifier" ref="738316654"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSView</string> <string key="superclassName">NSResponder</string> - <reference key="sourceIdentifier" ref="260078765"/> + <reference key="sourceIdentifier" ref="665570567"/> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <string key="superclassName">NSResponder</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">NSWindow</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> </object> </object> <object class="IBPartialClassDescription"> <string key="className">PDFView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>goBack:</string> <string>goForward:</string> <string>goToFirstPage:</string> <string>goToLastPage:</string> <string>goToNextPage:</string> <string>goToPreviousPage:</string> <string>selectAll:</string> <string>takeBackgroundColorFrom:</string> <string>zoomIn:</string> <string>zoomOut:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> <string>id</string> </object> </object> - <reference key="sourceIdentifier" ref="247579314"/> + <reference key="sourceIdentifier" ref="135889388"/> </object> <object class="IBPartialClassDescription"> <string key="className">QCView</string> <string key="superclassName">NSView</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>play:</string> <string>start:</string> <string>stop:</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>id</string> <string>id</string> <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> <string key="minorKey">QuartzComposer.framework/Headers/QCView.h</string> </object> </object> </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> <integer value="1060" key="NS.object.0"/> </object> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> <integer value="3000" key="NS.object.0"/> </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../GalleryDesktopService.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSMenuCheckmark</string> <string>NSMenuMixedState</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>{9, 8}</string> <string>{7, 2}</string> </object> </object> </data> </archive> diff --git a/GalleryDesktopService.xcodeproj/project.pbxproj b/GalleryDesktopService.xcodeproj/project.pbxproj index 6ba6eb2..e6edbd5 100644 --- a/GalleryDesktopService.xcodeproj/project.pbxproj +++ b/GalleryDesktopService.xcodeproj/project.pbxproj @@ -1,316 +1,318 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXBuildFile section */ 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */; }; 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCAC1196603D00069E79 /* QuartzCore.framework */; }; 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0170BCB21196604C00069E79 /* Quartz.framework */; }; 01837DC71191CEB800650F7F /* Lava.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 01837DC61191CEB800650F7F /* Lava.jpg */; }; 018C928C1155977C003349E5 /* ImageShareService.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C928B1155977C003349E5 /* ImageShareService.m */; }; 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 018C92B211559ABF003349E5 /* ApplicationController.m */; }; 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; DE0E5073119BCA2500D4E903 /* README in Resources */ = {isa = PBXBuildFile; fileRef = DE0E5072119BCA2500D4E903 /* README */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePathImageObject.h; sourceTree = "<group>"; }; 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilePathImageObject.m; sourceTree = "<group>"; }; 0170BCAC1196603D00069E79 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0170BCB21196604C00069E79 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; 01837DC61191CEB800650F7F /* Lava.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Lava.jpg; sourceTree = "<group>"; }; 018C928A1155977C003349E5 /* ImageShareService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageShareService.h; sourceTree = "<group>"; }; 018C928B1155977C003349E5 /* ImageShareService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageShareService.m; sourceTree = "<group>"; }; 018C92B111559ABF003349E5 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = "<group>"; }; 018C92B211559ABF003349E5 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = "<group>"; }; 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopServiceAppDelegate.h; sourceTree = "<group>"; }; 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GalleryDesktopServiceAppDelegate.m; sourceTree = "<group>"; }; 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GalleryDesktopService_Prefix.pch; sourceTree = "<group>"; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GalleryDesktopService-Info.plist"; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* GalleryDesktopService.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GalleryDesktopService.app; sourceTree = BUILT_PRODUCTS_DIR; }; DE0E5072119BCA2500D4E903 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D11072E0486CEB800E47090 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 0170BCAD1196603D00069E79 /* QuartzCore.framework in Frameworks */, 0170BCB31196604C00069E79 /* Quartz.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( 018C92B111559ABF003349E5 /* ApplicationController.h */, 018C92B211559ABF003349E5 /* ApplicationController.m */, 256AC3D80F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.h */, 256AC3D90F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m */, 018C928A1155977C003349E5 /* ImageShareService.h */, 018C928B1155977C003349E5 /* ImageShareService.m */, 0170BC9A11965F4B00069E79 /* FilePathImageObject.h */, 0170BC9B11965F4B00069E79 /* FilePathImageObject.m */, ); name = Classes; sourceTree = "<group>"; }; 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; sourceTree = "<group>"; }; 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 0170BCAC1196603D00069E79 /* QuartzCore.framework */, 0170BCB21196604C00069E79 /* Quartz.framework */, ); name = "Other Frameworks"; sourceTree = "<group>"; }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* GalleryDesktopService.app */, ); name = Products; sourceTree = "<group>"; }; 29B97314FDCFA39411CA2CEA /* DesktopService */ = { isa = PBXGroup; children = ( 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = DesktopService; sourceTree = "<group>"; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( 256AC3F00F4B6AF500CF3369 /* GalleryDesktopService_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, ); name = "Other Sources"; sourceTree = "<group>"; }; 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( DE0E5072119BCA2500D4E903 /* README */, 01837DC61191CEB800650F7F /* Lava.jpg */, 8D1107310486CEB800E47090 /* GalleryDesktopService-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, ); name = Resources; sourceTree = "<group>"; }; 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8D1107260486CEB800E47090 /* GalleryDesktopService */ = { isa = PBXNativeTarget; buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */; buildPhases = ( 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, 8D11072E0486CEB800E47090 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = GalleryDesktopService; productInstallPath = "$(HOME)/Applications"; productName = DesktopService; productReference = 8D1107320486CEB800E47090 /* GalleryDesktopService.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */; compatibilityVersion = "Xcode 3.1"; hasScannedForEncodings = 1; mainGroup = 29B97314FDCFA39411CA2CEA /* DesktopService */; projectDirPath = ""; projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* GalleryDesktopService */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D1107290486CEB800E47090 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, 01837DC71191CEB800650F7F /* Lava.jpg in Resources */, DE0E5073119BCA2500D4E903 /* README in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D11072C0486CEB800E47090 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D11072D0486CEB800E47090 /* main.m in Sources */, 256AC3DA0F4B6AC300CF3369 /* GalleryDesktopServiceAppDelegate.m in Sources */, 018C928C1155977C003349E5 /* ImageShareService.m in Sources */, 018C92B311559ABF003349E5 /* ApplicationController.m in Sources */, 0170BC9C11965F4B00069E79 /* FilePathImageObject.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C165DFE840E0CC02AAC07 /* English */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( 1DDD58150DA1D0A300B32029 /* English */, ); name = MainMenu.xib; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Debug; }; C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GalleryDesktopService_Prefix.pch; INFOPLIST_FILE = "GalleryDesktopService-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; PRODUCT_NAME = GalleryDesktopService; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; + PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; + PRODUCT_NAME = GalleryDesktopService; SDKROOT = macosx10.6; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4B08A954540054247B /* Debug */, C01FCF4C08A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GalleryDesktopService" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, C01FCF5008A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; }
beepscore/GalleryDesktopService
9321d4386c49ecfe0f3e50a1dcecdff4c2cd7d11
In comments, update file names.
diff --git a/GalleryDesktopServiceAppDelegate.h b/GalleryDesktopServiceAppDelegate.h index 8e896fb..c507aa9 100644 --- a/GalleryDesktopServiceAppDelegate.h +++ b/GalleryDesktopServiceAppDelegate.h @@ -1,26 +1,26 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // -// DesktopServiceAppDelegate.h +// GalleryDesktopServiceAppDelegate.h // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Desktop application that will // advertise a network service available via bonjour #import <Cocoa/Cocoa.h> @class ApplicationController; @interface GalleryDesktopServiceAppDelegate : NSObject <NSApplicationDelegate> { NSWindow* window; ApplicationController* appController_; } @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet ApplicationController* appController; @end diff --git a/GalleryDesktopServiceAppDelegate.m b/GalleryDesktopServiceAppDelegate.m index b5f2605..034ff27 100644 --- a/GalleryDesktopServiceAppDelegate.m +++ b/GalleryDesktopServiceAppDelegate.m @@ -1,26 +1,26 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // -// DesktopServiceAppDelegate.m +// GalleryDesktopServiceAppDelegate.m // HW7 // // portions Copyright 2010 Chris Parrish // portions Copyright Beepscore LLC 2010. All rights reserved. // // Desktop application that will // advertise a network service available via bonjour #import "GalleryDesktopServiceAppDelegate.h" #import "ImageShareService.h" @implementation GalleryDesktopServiceAppDelegate @synthesize window; @synthesize appController = appController_; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [appController_ startService]; } @end
beepscore/GalleryDesktopService
99124f8c00d9282cc8960f618600268c6d662021
Add // portions Copyright Beepscore LLC 2010. All rights reserved.
diff --git a/ApplicationController.h b/ApplicationController.h index 23e2700..f60b05d 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -1,41 +1,42 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // App controller is a singleton object #import <Cocoa/Cocoa.h> @class ImageShareService; @class IKImageBrowserView; @interface ApplicationController : NSObject { NSTextView* logTextField_; ImageShareService* imageShareService_; IKImageBrowserView* imageBrowser_; NSSlider* zoomSlider_; NSMutableArray* images_; } @property (nonatomic, assign) IBOutlet NSTextView* logTextField; @property (nonatomic, assign) IBOutlet IKImageBrowserView* imageBrowser; @property (nonatomic, assign) IBOutlet NSSlider* zoomSlider; + (ApplicationController*)sharedApplicationController; - (void) startService; - (void) appendStringToLog:(NSString*)logString; - (IBAction) sendImage:(id)sender; - (IBAction) addImages:(id)sender; - (IBAction) zoomChanged:(id)sender; @end diff --git a/ApplicationController.m b/ApplicationController.m index 7d13c02..c1c0d16 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -1,393 +1,394 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ApplicationController.m // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // #import "ApplicationController.h" #import "ImageShareService.h" #import "FilePathImageObject.h" #import <Quartz/Quartz.h> #pragma mark Static static ApplicationController* sharedApplicationController = nil; @interface ApplicationController () - (void) addImagesFromDirectory:(NSString*) path; - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index; - (void) addImageWithPath:(NSString *)path; @end @implementation ApplicationController @synthesize logTextField = logTextField_; @synthesize imageBrowser = imageBrowser_; @synthesize zoomSlider = zoomSlider_; #pragma mark Singleton // Note : This is how Apple recommends implementing a singleton class : + (ApplicationController*)sharedApplicationController { if (sharedApplicationController == nil) { sharedApplicationController = [[super allocWithZone:NULL] init]; } return sharedApplicationController; } + (id)allocWithZone:(NSZone *)zone { return [[self sharedApplicationController] retain]; } - (id) init { self = [super init]; if (self != nil) { } return self; } - (void) dealloc { [images_ release]; [super dealloc]; } -(void) awakeFromNib { // Setup the browser with some default images that should be installed on the system images_ = [[NSMutableArray alloc] init]; // HW_TODO : // ADD SOME IMAGES TO THE MODEL TO START OFF // HERE IS A GOOD PLACE TO TRY : @"/Library/Desktop Pictures/"] // YOU CAN ALSO INCLUDES IMAGES IN YOUR APPLICATION BUNDLE // JUST MAKE SURE WE HAVE THE SAME IMAGES AVAILABLE WHEN // WE GRADE THIS // HW_TODO: // MAKE SURE THE ZOOM SLIDER AND BROWSER ZOOM ARE IN SYNC // Make sure the image browser allows reordering [imageBrowser_ setAllowsReordering:YES]; [imageBrowser_ setAnimates:YES]; //HW_TODO: //SETUP THE STYLE OF THE BROWSER CELLS HERE //ANYTHING YOU LIKE, SHADOWS, TITLES, ETC } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (NSUInteger)retainCount { return NSUIntegerMax; //denotes an object that cannot be released } - (void)release { //do nothing } - (id)autorelease { return self; } #pragma mark - #pragma mark Service - (void) appendStringToLog:(NSString*)logString { NSString* newString = [NSString stringWithFormat:@"%@\n", logString]; [[[logTextField_ textStorage] mutableString] appendString: newString]; } - (void) startService { imageShareService_ = [[ImageShareService alloc] init]; [imageShareService_ startService]; [imageShareService_ publishService]; } #pragma mark - #pragma mark Adding Images - (void) addImageWithPath:(NSString *)path { [self addImageWithPath:path atIndex:[images_ count]]; } - (void) addImageWithPath:(NSString *)path atIndex:(NSUInteger)index { // HW_TODO : // THIS IS WHERE WE CREATE NEW MODEL OBJECTS // FIRST, MAKE SURE TO SKIP HIDDEN DIRECTORIES AND FILES // USE THIS CODE OR YOUR OWN : //NSString* filename = [path lastPathComponent]; //if([filename length] > 0) //{ // if ( [filename characterAtIndex:0] == L'.') // return; //} // CHECK IF THIS PATH IS A DIRECTORY // IF IT IS, ADD EACH FILE IN IT RECURSIVELY // YOU CAN USE THIS CODE OR YOUR OWN : //BOOL isDirectory = NO; //[[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; //if (isDirectory) //{ // [self addImagesFromDirectory:path atIndex:index]; // return; //} // OTHERWISE JUST ADD THIS FILE // CREATE A NEW MODEL OBJECT AND ADD IT TO images_ } - (void) addImagesFromDirectory:(NSString *) path { [self addImagesFromDirectory:path atIndex:[images_ count]]; } - (void) addImagesFromDirectory:(NSString *)path atIndex:(NSUInteger)index { // YOU CAN USE THIS CODE AS IS OR REPLACE IF YOU WANT TO DO IT DIFFERENTLY int i, n; BOOL dir; [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dir]; if(dir) { NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; n = [content count]; for(i=0; i<n; i++) [self addImageWithPath:[path stringByAppendingPathComponent:[content objectAtIndex:i]] atIndex:index]; } else [self addImageWithPath:path]; [imageBrowser_ reloadData]; // Make sure to have the image browser reload because we have changed the model } #pragma mark - #pragma mark Actions - (IBAction) sendImage:(id)sender { // HW_TODO : // GET THE SELECTED IMAGE FROM THE BROWSER // THIS WILL BE YOUR MODEL OBJECT (FilePathImageObject) // TO SEND YOU NEED AN NSIMAGE // SO CREATE ONE FROM THE FILE THE MODEL OBJECT IS POINTING TO // FINALLY SEND IT USING THE LINE BELOW //[imageShareService_ sendImageToClients:image]; } - (IBAction) addImages:(id)sender { // This is how to create a standard open file panel // and add the results NSOpenPanel* panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; NSInteger buttonPressed = [panel runModal]; if( buttonPressed == NSOKButton ) { NSArray* filePaths = [panel filenames]; for (NSString* filePath in filePaths) { [self addImagesFromDirectory:filePath]; } } } - (IBAction) zoomChanged:(id)sender { // HW_TODO : // UPDATE THE ZOOM ON THE BROWSER VIEW } #pragma mark - #pragma mark IKImageBrowserDataSource /* implement image-browser's datasource protocol Our datasource representation is a simple mutable array */ - (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) view { // HW_TODO : // RETURN THE # OF IMAGES IN THE MODEL } - (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index; { // HW_TODO : // RETURN THE IMAGE MODEL OBJECT AT THE GIVEN INDEX } - (void) imageBrowser:(IKImageBrowserView *)view removeItemsAtIndexes:(NSIndexSet *)indexes { // HW_TODO : // REMOVE THE IMAGE OBJECTS AT THE GIVEN INDICES } - (BOOL) imageBrowser:(IKImageBrowserView *)view moveItemsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSUInteger index; NSMutableArray* temporaryArray; temporaryArray = [[[NSMutableArray alloc] init] autorelease]; // remove items from the end working our way back to the first item // this keeps the indexs we haven't moved yet from shifting to a new position // before we get to them for( index = [indexes lastIndex]; index != NSNotFound; index = [indexes indexLessThanIndex:index] ) { if (index < destinationIndex) destinationIndex--; FilePathImageObject* image = [images_ objectAtIndex:index]; [temporaryArray addObject:image]; [images_ removeObjectAtIndex:index]; } // Insert at the new destination int n = [temporaryArray count]; for( index = 0; index < n; index++) { [images_ insertObject:[temporaryArray objectAtIndex:index] atIndex:destinationIndex]; } return YES; } #pragma mark - #pragma mark IKImageBrowserDelegate - (void) imageBrowser:(IKImageBrowserView *) aBrowser cellWasDoubleClickedAtIndex:(NSUInteger) index { // HW_TODO : // TREAT A DOUBLE CLICK AS A SEND OF THE IMAGE // INSTEAD OF THE DEFAULT TO OPEN } #pragma mark - #pragma mark Drag and Drop - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { return [self draggingUpdated:sender]; } - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender { if ([sender draggingSource] == imageBrowser_) return NSDragOperationMove; return NSDragOperationCopy; } - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender { NSData* data = nil; NSString* errorDescription = nil; // if we are dragging from the browser itself, ignore it if ([sender draggingSource] == imageBrowser_) return NO; NSPasteboard* pasteboard = [sender draggingPasteboard]; if ([[pasteboard types] containsObject:NSFilenamesPboardType]) { data = [pasteboard dataForType:NSFilenamesPboardType]; NSArray* filePaths = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:kCFPropertyListImmutable format:nil errorDescription:&errorDescription]; for (NSString* filePath in filePaths) { [self addImageWithPath:filePath atIndex:[imageBrowser_ indexAtLocationOfDroppedItem]]; } [imageBrowser_ reloadData]; } return YES; } @end diff --git a/FilePathImageObject.h b/FilePathImageObject.h index 7f09310..48873a4 100644 --- a/FilePathImageObject.h +++ b/FilePathImageObject.h @@ -1,23 +1,24 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.h // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // A simple data object that holds an image path // used by Image Kit Browser data source #import <Foundation/Foundation.h> @interface FilePathImageObject : NSObject { } // DECLARE ANY PROPERTY OR IVARS YOU NEED // TO MANAGE YOUR IMAGE MODEL // I SUGGEST A SIMPLE NSSTRING FOR THE FILE PATH @end diff --git a/FilePathImageObject.m b/FilePathImageObject.m index 13bd8a7..f43d22e 100644 --- a/FilePathImageObject.m +++ b/FilePathImageObject.m @@ -1,53 +1,54 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // FilePathImageObject.m // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // A simple data object that holds an image path // used by Image Kit Browser data source #import "FilePathImageObject.h" #import <Quartz/Quartz.h> @implementation FilePathImageObject - (void) dealloc { // BE SURE TO CLEAN UP HERE! [super dealloc]; } #pragma mark - #pragma mark IKImageBrowserItem // These methods implement the informal protocol // required for objects returned by a IKImageBrowswerDataSource // You need to implement each of these /* - (NSString*) imageRepresentationType { } - (id) imageRepresentation { } - (id) imageTitle { } - (NSString *) imageUID { } */ @end diff --git a/GalleryDesktopServiceAppDelegate.h b/GalleryDesktopServiceAppDelegate.h index 77bac87..8e896fb 100644 --- a/GalleryDesktopServiceAppDelegate.h +++ b/GalleryDesktopServiceAppDelegate.h @@ -1,25 +1,26 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // DesktopServiceAppDelegate.h // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // Desktop application that will // advertise a network service available via bonjour #import <Cocoa/Cocoa.h> @class ApplicationController; @interface GalleryDesktopServiceAppDelegate : NSObject <NSApplicationDelegate> { NSWindow* window; ApplicationController* appController_; } @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet ApplicationController* appController; @end diff --git a/GalleryDesktopServiceAppDelegate.m b/GalleryDesktopServiceAppDelegate.m index 7812c56..b5f2605 100644 --- a/GalleryDesktopServiceAppDelegate.m +++ b/GalleryDesktopServiceAppDelegate.m @@ -1,25 +1,26 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // DesktopServiceAppDelegate.m // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // Desktop application that will // advertise a network service available via bonjour #import "GalleryDesktopServiceAppDelegate.h" #import "ImageShareService.h" @implementation GalleryDesktopServiceAppDelegate @synthesize window; @synthesize appController = appController_; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [appController_ startService]; } @end diff --git a/ImageShareService.h b/ImageShareService.h index fdac88c..4b1e4a0 100644 --- a/ImageShareService.h +++ b/ImageShareService.h @@ -1,39 +1,40 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.h // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and then sending an image to the connected client #import <Foundation/Foundation.h> @class ApplicationController; @interface ImageShareService : NSObject <NSNetServiceDelegate> { ApplicationController* appController_; CFSocketRef socket_; NSFileHandle* connectionFileHandle_; NSMutableDictionary* dataForFileHandles_; NSMutableArray* connectedFileHandles_; } - (BOOL) startService; - (void) publishService; - (void) handleIncomingConnection:(NSNotification*)notification; - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close; - (void) readIncomingData:(NSNotification*) notification; - (void) sendImageToClients:(NSImage*)image; @end diff --git a/ImageShareService.m b/ImageShareService.m index e61172d..29513f9 100644 --- a/ImageShareService.m +++ b/ImageShareService.m @@ -1,380 +1,381 @@ // // IPHONE AND COCOA DEVELOPMENT AUSP10 // // ImageShareService.h // HW7 // -// Copyright 2010 Chris Parrish +// portions Copyright 2010 Chris Parrish +// portions Copyright Beepscore LLC 2010. All rights reserved. // // Class that handles listening for incoming connections // and advertises its service via Bonjour // Sends an image to the connected clients #import "ImageShareService.h" #import "ApplicationController.h" #import <sys/socket.h> #import <netinet/in.h> NSString* const kServiceTypeString = @"_uwcelistener._tcp."; NSString* const kServiceNameString = @"Images"; const int kListenPort = 8082; @interface ImageShareService () - (void) parseDataRecieved:(NSMutableData*)dataSoFar; - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle; - (void) handleMessage:(NSString*)messageString; @end @implementation ImageShareService - (id) init { self = [super init]; if (self != nil) { appController_ = [ApplicationController sharedApplicationController]; socket_ = nil; connectionFileHandle_ = nil; dataForFileHandles_ = [[NSMutableDictionary dictionary] retain]; connectedFileHandles_ = [[NSMutableArray array] retain]; } return self; } - (void) dealloc { [dataForFileHandles_ release]; dataForFileHandles_ = nil; for (NSFileHandle* connection in connectedFileHandles_) { [connection closeFile]; } [connectedFileHandles_ release]; connectedFileHandles_ = nil; [super dealloc]; } - (BOOL) startService { socket_ = CFSocketCreate ( kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL ); // Create a network socket for streaming TCP if (!socket_) { [appController_ appendStringToLog:@"Cound not create socket"]; return NO; } int reuse = true; int fileDescriptor = CFSocketGetNative(socket_); // Make sure socket is set for reuse of the address // without this, you may find that the socket is already in use // when restartnig and debugging int result = setsockopt( fileDescriptor, SOL_SOCKET, SO_REUSEADDR, (void *)&reuse, sizeof(int) ); if ( result != 0) { [appController_ appendStringToLog:@"Unable to set socket options"]; return NO; } // Create the address for the scoket. // In this case we don't care what address is incoming // but we listen on a specific port - kLisenPort struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(kListenPort); CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); [(id)addressData autorelease]; // bind socket to the address if (CFSocketSetAddress(socket_, addressData) != kCFSocketSuccess) { [appController_ appendStringToLog:@"Unable to bind socket to address"]; return NO; } // setup listening to incoming connections // we will use notifications to respond // as we are not looking for high performance and want // to use the simpiler Cocoa NSFileHandle APIs connectionFileHandle_ = [[NSFileHandle alloc] initWithFileDescriptor:fileDescriptor closeOnDealloc:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIncomingConnection:) name:NSFileHandleConnectionAcceptedNotification object:nil]; [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; NSString* logString = [NSString stringWithFormat:@"listening to socket on port %d", kListenPort]; [appController_ appendStringToLog:logString]; return YES; } - (void) publishService { // Create a name for the service that include's this computer's name CFStringRef computerName = CSCopyMachineName(); NSString* serviceNameString = [NSString stringWithFormat:@"%@'s %@", (NSString*)computerName, kServiceNameString]; CFRelease(computerName); NSNetService* netService = [[NSNetService alloc] initWithDomain:@"" type:kServiceTypeString name:serviceNameString port:kListenPort]; // publish on the default domains [netService setDelegate:self]; [netService publish]; // NOTE : We are not handling any failure to publish cases // which is not a good idea. We should at least // Be checking for name collisions NSString* logString = [NSString stringWithFormat:@"published service type:%@ with name %@ on port %d", kServiceTypeString, kServiceNameString, kListenPort]; [appController_ appendStringToLog:logString]; } #pragma mark - #pragma mark Receiving -(void) handleIncomingConnection:(NSNotification*)notification { NSDictionary* userInfo = [notification userInfo]; NSFileHandle* connectedFileHandle = [userInfo objectForKey:NSFileHandleNotificationFileHandleItem]; if(connectedFileHandle) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readIncomingData:) name:NSFileHandleDataAvailableNotification object:connectedFileHandle]; [connectedFileHandles_ addObject:connectedFileHandle]; [appController_ appendStringToLog:@"Opened an incoming connection"]; [connectedFileHandle waitForDataInBackgroundAndNotify]; } [connectionFileHandle_ acceptConnectionInBackgroundAndNotify]; } - (void) readIncomingData:(NSNotification*) notification { NSFileHandle* readFileHandle = [notification object]; NSData* newData = [readFileHandle availableData]; NSMutableData* dataSoFar = [self dataForFileHandle:readFileHandle]; if ([newData length] == 0) { [appController_ appendStringToLog:@"No more data in file handle, closing"]; [self stopReceivingForFileHandle:readFileHandle closeFileHandle:YES]; return; } [appController_ appendStringToLog:@"Got a new message :"]; [appController_ appendStringToLog:[NSString stringWithUTF8String:[newData bytes]]]; // append the data to the data we have so far [dataSoFar appendData:newData]; [self parseDataRecieved:dataSoFar]; // wait for a read again [readFileHandle waitForDataInBackgroundAndNotify]; } - (void) parseDataRecieved:(NSMutableData*)dataSoFar { // Look for a token that indicates a complete message // and act on the message. Remove the message from the data so far // Currently our token is the null terminator 0x00 char token = 0x00; NSRange result = [dataSoFar rangeOfData:[NSData dataWithBytes:&token length:1] options:0 range:NSMakeRange(0, [dataSoFar length])]; if ( result.location != NSNotFound ) { NSData* messageData = [dataSoFar subdataWithRange:NSMakeRange(0, result.location+1)]; NSString* messageString = [NSString stringWithUTF8String:[messageData bytes]]; // act on the message NSLog(@"parsed message : %@", messageString); [self handleMessage:messageString]; // trim the message we have handled off the data received NSUInteger location = result.location + 1; NSUInteger length = [dataSoFar length] - [messageData length]; [dataSoFar setData:[dataSoFar subdataWithRange:NSMakeRange(location, length)]]; } } - (void) handleMessage:(NSString*)messageString { // Not reacting to any sent messages for now } - (NSMutableData*) dataForFileHandle:(NSFileHandle*) fileHandle { NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data == nil ) { data = [NSMutableData data]; [dataForFileHandles_ setObject:data forKey:fileHandle]; } return data; } - (void) stopReceivingForFileHandle:(NSFileHandle*)fileHandle closeFileHandle:(BOOL)close { if (close) { [fileHandle closeFile]; [connectedFileHandles_ removeObject:fileHandle]; } NSMutableData* data = [dataForFileHandles_ objectForKey:fileHandle]; if ( data != nil ) { [dataForFileHandles_ removeObjectForKey:fileHandle]; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleDataAvailableNotification object:fileHandle]; } #pragma mark - #pragma mark Sending - (void) sendImageToClients:(NSImage*)image { NSUInteger clientCount = [connectedFileHandles_ count]; if( clientCount <= 0 ) { [appController_ appendStringToLog:@"No clients connected, not sending"]; return; } NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; NSData* representationToSend = [imageRep representationUsingType:NSPNGFileType properties:nil]; // NOTE : this will only work when the image has a bitmap representation of some type // an EPS or PDF for instance do not and in that case imageRep will not be a NSBitmapImageRep // and then representationUsingType will fail // To do this better we could draw the image into an offscreen context // then save that context in a format like PNG // There are some downsides to this though, because for instance a jpeg will recompress // so you would want to use a rep when you have it and if not, create one. // NOTE 2: We could try to just send the file as data rather than // an NSImage. The problem is the iPhone doesn't support as many // image formats as the desktop. The translation to PNG insures // something the iPhone can display // The first thing we send is 4 bytes that represent the length of // of the image so that the client will know when a full image has // transfered NSUInteger imageDataSize = [representationToSend length]; if ( imageDataSize > UINT32_MAX ) { [appController_ appendStringToLog:[NSString stringWithFormat:@"Image is too large to send (%ld bytes", imageDataSize]]; return; } uint32 dataLength = htonl( (uint32)imageDataSize ); NSData* imageSize = [NSData dataWithBytes:&dataLength length:sizeof(unsigned int)]; // the length method returns an NSUInteger, which happens to be 64 bits // or 8 bytes in length on the desktop. On the phone NSUInteger is 32 bits // we are simply going to not send anything that is so big that it // length is > 2^32, which should be fine considering the iPhone client // could not handle images that large anyway // We also have to be careful and make sure that the bytes are in the proper order // when sent over the network using htonl() //HW_TODO : // // HERE IS THE BONUS OPPORTUNITY! // THIS SYNCHRONOUS SENDING IS TERRIBLE. THE UI LOCKS UP // UNTIL THE IMAGE IS SENT // 100 PTS FOR A SOLUTION THAT MAKES THIS AN ASYNCHRONOUS SEND // THAT FREES UP THE UI IMMEDIATELY AFTER PRESSING SEND // 23 BONUS PTS FOR A PROGRESS INDICATOR DURING THE SENDING for ( NSFileHandle* connection in connectedFileHandles_) { // First write out the size of the image data we are sending // Then send the image [connection writeData:imageSize]; [connection writeData:representationToSend]; } [appController_ appendStringToLog:[NSString stringWithFormat:@"Sent image to %d clients", clientCount]]; } @end
disbeliever/disbeliever-overlay
6e9504321242fe0e7285e30ff19580f8f62b286f
Added lounge theme ebuild
diff --git a/x11-themes/lounge/Manifest b/x11-themes/lounge/Manifest new file mode 100644 index 0000000..0a75ed9 --- /dev/null +++ b/x11-themes/lounge/Manifest @@ -0,0 +1,2 @@ +DIST lounge-1.24.tar.gz 765203 BLAKE2B 66bf48c9db4938f441024b6cf06def8d6a09e092949ba7457b663df962582a18d116fce0c907f92c9a5215eaaea03fab517956046ab89df8446a67643fcd3d80 SHA512 bad9ccbfd0007c98a8a222a7fb3f7fec3d23e922bf894429d47367ee9036130bfede62f8bf08635b8efca5c834151635a585428975aefac16e5fdcd0f4fa0658 +EBUILD lounge-1.24.ebuild 492 BLAKE2B a491fa6ffd031d84b567e9ca6aeaf584b22bd05500d50541ada54560a9189e967b877026c228815427f5349e036d0ed99cdbcb13bf0efe1dbc883d9d9d545dc5 SHA512 be044e6102e143275bd4bfd04a8016745681fbd71ce00ec310a32bb9e692246e2f0876c0341d3b04fca168ea1898524d515a6470830c13df70c733550a06f4a9 diff --git a/x11-themes/lounge/lounge-1.24.ebuild b/x11-themes/lounge/lounge-1.24.ebuild new file mode 100644 index 0000000..0f7f299 --- /dev/null +++ b/x11-themes/lounge/lounge-1.24.ebuild @@ -0,0 +1,22 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit meson + +DESCRIPTION="Vintage looking gtk theme." +HOMEPAGE="https://github.com/monday15/lounge" +SRC_URI="https://github.com/monday15/lounge/archive/${PV}.tar.gz -> ${P}.tar.gz" + +S="${WORKDIR}/lounge-gtk-theme-${PV}" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~x86 ~amd64" + +RDEPEND="" +DEPEND="${RDEPEND} + dev-lang/sassc + >=x11-libs/gtk+-3.22.0 + x11-themes/gtk-engines-murrine"
disbeliever/disbeliever-overlay
02cfe6f86cee9d1e5b94fd31af9ae1a868ba504e
added sys-fs/vmfs-tools.
diff --git a/sys-fs/vmfs-tools/Manifest b/sys-fs/vmfs-tools/Manifest new file mode 100644 index 0000000..2908ce1 --- /dev/null +++ b/sys-fs/vmfs-tools/Manifest @@ -0,0 +1,4 @@ +AUX vmfs-tools-0.2.5-buildsystem.patch 1166 BLAKE2B d56fd5117474a45920009172a1045a886083d6df387f293a725f22ba1ffa29542bfc562c8578132878c083f5cb248b88ff4c1b24c9ca84c105bb06471ac432ec SHA512 c0ed3437ea1b3be360047a7f2c40e015ec6ba357ffcacd9f84dcd7a0d34056d91f1c2bf52cab0f93fbed16b3cd85bc0ea77f517a2e36e52720fa799aba8363eb +DIST vmfs-tools-0.2.5.tar.gz 77095 BLAKE2B f5f594bbf6f5d338b6aa6d58da3504284a7823c9fee86bebb89a17aa3e5c07bdda7edae6786707b49210971023fe71421e30e272738ca8f8b3d4ea54fbad7ec5 SHA512 9231509d6e370ddc2a270d80e6cdc16caa9e36bcf5ae3680d83dc28a39ca1c4663680a7107e791c5a037c8e3e145e8d518da9863afb52fa4e09b0792acd7a74c +EBUILD vmfs-tools-0.2.5.ebuild 651 BLAKE2B 5477cac254d8d9ec9927200224d1658312717b5f61bd93af73432e618ded2c16a7311d4e39f1711652a0fa1b86699fed754b26a7e9fbf718b064cf354952e1da SHA512 255419fcdec3065dbd52a88e4290c9544ffdb014bda49b1cd8608e6b25e15217f6a3f3b02a3bc3815e2cbe1900f98c62f2d8e43a796951a9375d4779e0e02d5e +MISC metadata.xml 272 BLAKE2B 342b46c38e23bb84e577420f4eee47fce9ba69c581a9f0ba1c54896a1743f9285d303ddc61a4458752322f3dd05b16be2e5a15447731f03fd125e8f52c8487ca SHA512 027cdb39ed8816eab6d9f4988fe848220252538284e8a1f8a5966d74e171fae1862e4795707cafe1544e8bea037871e4222287fb909019829f816f1c6826b1ab diff --git a/sys-fs/vmfs-tools/files/vmfs-tools-0.2.5-buildsystem.patch b/sys-fs/vmfs-tools/files/vmfs-tools-0.2.5-buildsystem.patch new file mode 100644 index 0000000..986979c --- /dev/null +++ b/sys-fs/vmfs-tools/files/vmfs-tools-0.2.5-buildsystem.patch @@ -0,0 +1,43 @@ +--- vmfs-tools-0.2.5/GNUmakefile ++++ vmfs-tools-0.2.5/GNUmakefile +@@ -55,7 +55,7 @@ + endef + $(foreach subdir,$(strip $(call order_by_requires,$(SUBDIRS))),$(eval $(call subdir_rules,$(subdir)))) + +-CC := gcc ++CC ?= gcc + OPTIMFLAGS := $(if $(filter -O%,$(ENV_CFLAGS)),,-O2) + CFLAGS := $(ENV_CFLAGS) $(filter-out $(ENV_CFLAGS),-Wall $(OPTIMFLAGS) -g -D_FILE_OFFSET_BITS=64 $(EXTRA_CFLAGS)) + CFLAGS += $(if $(HAS_STRNDUP),,-DNO_STRNDUP=1) +@@ -71,7 +71,7 @@ + + EXTRA_DIST := LICENSE README TODO AUTHORS test.img configure + +-all: $(BUILD_PROGRAMS) $(wildcard .gitignore) test.img ++all: $(BUILD_PROGRAMS) $(wildcard .gitignore) test.img doc + + ALL_MAKEFILES = $(filter-out config.cache,$(MAKEFILE_LIST)) configure.mk + +@@ -84,8 +84,8 @@ + echo "#endif" >> $@ + + $(BUILD_LIBS): +- ar -r $@ $^ +- ranlib $@ ++ $(AR) -r $@ $^ ++ $(RANLIB) $@ + + $(OBJS): %.o: %.c $(HEADERS) + +--- vmfs-tools-0.2.5/configure.mk ++++ vmfs-tools-0.2.5/configure.mk +@@ -10,7 +10,9 @@ + + # configure rules really start here + $(call PKG_CONFIG_CHK,uuid,-I/usr/include/uuid,-luuid) ++ifneq (,$(WANT_FUSE)) + $(call PKG_CONFIG_CHK,fuse) ++endif + $(call PATH_LOOKUP,asciidoc) + $(call PATH_LOOKUP,xsltproc) + diff --git a/sys-fs/vmfs-tools/metadata.xml b/sys-fs/vmfs-tools/metadata.xml new file mode 100644 index 0000000..5aef247 --- /dev/null +++ b/sys-fs/vmfs-tools/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer> + <email>[email protected]</email> +</maintainer> +<use> + <flag name="fuse">Enable image mount support via fuse</flag> +</use> +</pkgmetadata> diff --git a/sys-fs/vmfs-tools/vmfs-tools-0.2.5.ebuild b/sys-fs/vmfs-tools/vmfs-tools-0.2.5.ebuild new file mode 100644 index 0000000..235b941 --- /dev/null +++ b/sys-fs/vmfs-tools/vmfs-tools-0.2.5.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 + +inherit eutils toolchain-funcs + +DESCRIPTION="Tools for vmfs" +HOMEPAGE="http://glandium.org/projects/vmfs-tools/" +SRC_URI="http://glandium.org/projects/${PN}/${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="+fuse" + +RDEPEND="sys-apps/util-linux + fuse? ( sys-fs/fuse )" + +DEPEND="${RDEPEND} + app-text/asciidoc + app-text/docbook-xsl-stylesheets + dev-libs/libxslt" + +src_prepare() { + epatch "${FILESDIR}"/${P}-buildsystem.patch + tc-export CC AR RANLIB + export NO_STRIP=1 + export WANT_FUSE=$(usex fuse 1 "") +}
disbeliever/disbeliever-overlay
bba0be3e5d386f16913cf1357e14ab3b24b949ca
added sys-fs/tmsu/tmsu-0.7.4
diff --git a/sys-fs/tmsu/Manifest b/sys-fs/tmsu/Manifest new file mode 100644 index 0000000..053b6c6 --- /dev/null +++ b/sys-fs/tmsu/Manifest @@ -0,0 +1,2 @@ +DIST tmsu-0.7.4.tar.gz 98631 BLAKE2B 4af013de08f43b6ee337259b394aafce0862d3f0811174b196785d6e05d520a188ef6a1ce6f320dddcff6b2ab47cae8c248201a27d79bdd09d80b91e12161abd SHA512 28af79a03c774d8c08651cfac794d14a3363d3b5f6b037de1a74968b22053da45e6290ec9c5159950539e1e6577d01c06c62a05eb2b4f01ad5635d98e52b4e20 +EBUILD tmsu-0.7.4.ebuild 802 BLAKE2B 2b61c94d2818e2bb3290549bb452c15f946d40d9e785971119a818f99d3bd7ed80cb814c576c1e9d93a847ab1a452cb8ffca07cfde46a4ef8e7d9c8ed361c1a5 SHA512 04ce11db2184fb4bba4f4e37358e77f5a352010bb05c81270edd22a6e880a5bbb8a022a28b8c167e846146f88706fdc98fca836c9c663ff5170bb0b5de748cd8 diff --git a/sys-fs/tmsu/tmsu-0.7.4.ebuild b/sys-fs/tmsu/tmsu-0.7.4.ebuild new file mode 100644 index 0000000..d37b337 --- /dev/null +++ b/sys-fs/tmsu/tmsu-0.7.4.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit golang-build + +EGO_PN="github.com/oniony/TMSU/" +DESCRIPTION="Files tagger and virtual tag-based filesystem" +HOMEPAGE="https://github.com/oniony/TMSU/wiki" +SRC_URI="https://github.com/oniony/TMSU/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64" +IUSE="test zsh-completion" + +RDEPEND=" + zsh-completion? ( app-shells/zsh ) +" +DEPEND=" + dev-go/go-sqlite3 + dev-lang/go + dev-libs/go-fuse +" + +src_unpack() { + default + mv TMSU-${PV} ${P} || die "Failed to move sorce directory." +} + +src_install() { + dobin misc/bin/* + doman misc/man/tmsu.* + newbin TMSU tmsu + + if use zsh-completion ; then + insinto /usr/share/zsh/site-functions + doins misc/zsh/_tmsu + fi +}
disbeliever/disbeliever-overlay
3933036f2a3e39b4e8249fdada68b4402d825c1f
Set auto-sync=false.
diff --git a/metadata/layout.conf b/metadata/layout.conf index d43e61c..c673a95 100644 --- a/metadata/layout.conf +++ b/metadata/layout.conf @@ -1 +1,2 @@ masters = gentoo +auto-sync = false
disbeliever/disbeliever-overlay
d27d3cbf57dd5ea0d34f4d7f7f023febeba62436
Added deadbeef-0.6.2.ebuild from funtoo-overlay
diff --git a/media-sound/deadbeef/Manifest b/media-sound/deadbeef/Manifest index 261853a..6b2f0f6 100644 --- a/media-sound/deadbeef/Manifest +++ b/media-sound/deadbeef/Manifest @@ -1,6 +1,6 @@ DIST deadbeef-0.5.6.tar.bz2 3279899 SHA256 17c123eb50e33c89403d8d3035b9132463a227a6905fd42bcbb2a3a5616cea5b SHA512 20d8d58e2df90078af2dd6583c7ae9d7b3b6f7d73cef1d823910614278779614c1544e839a886ab7ab972ad235220829d8e07dc1c959e98c94fc1e47299e5b4a WHIRLPOOL 9b7349c4664be4e98a935fb97393195cc4911d28e011a83c8f3d621b004ccb70f3e5e06129138eb3edf64b17c533b0b214a29e2fb71b96e7b6638b92d2a69947 DIST deadbeef-0.6.1.tar.bz2 3429924 SHA256 362b7d496eca487a09fa919e1b03ffb3c01034f1e2b05f09ea5a47aaa2f0af45 SHA512 0812f2d6b2ebc2ef1e65af9912546fa769e0e6d090f15cf3f2c4170bfa5aab03545cd63f26dcdcde905416801c0b56bd190cd1792f29eabaa318db212db99f90 WHIRLPOOL 2ac6f4abd70625c4f0898cb07e7b5ef645755136aee4b424af5e9d11c00b290dc75a467288e45bf35f2d25fc51fd76c12c58a58c966ea6fdf9ae4e1cea512339 DIST deadbeef-0.6.2.tar.bz2 3495920 SHA256 3433b966683286c03ffbcc79b2201cd517f8dbf6b41da8600778dfa93cd64e1a SHA512 7caee245d7fa68e98ce5edc6aa6acc829d62c963f523c81e0406182a1aa36759219a8c0a2bdf010ac810f22b15acc81d06e8cab4ab820956c96cbc0a94423b7b WHIRLPOOL a8fc10c0f44f9f4d4eafb99a52f26efef34c2a1164d19b1f60693347a4b7a5564c6f7fafd394914149240a2a2f30926ce853bf42bbf3a07699bd8ba422a59f63 EBUILD deadbeef-0.5.6.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 EBUILD deadbeef-0.6.1.ebuild 2844 SHA256 991c9988e4f005bdd5646b180eba2acf2f1ca184eb36175f7dd62ce4abcb31f2 SHA512 b32387c722060a3eb471c71ad7a2b34c6eace9369941eda44a611978f1f135da5c9632ea45c318b8d48e1627a307d0a6ae564124ba4505f91daeff1e3e266ba3 WHIRLPOOL 4f2538ca067b14728f07ea862019141679ce73a53d5ac0aad445093a99135a0b6bcd22b23e8595a6153d9fdc85cf657a20371932905f9cea2885809fdfbdcd75 -EBUILD deadbeef-0.6.2.ebuild 2844 SHA256 991c9988e4f005bdd5646b180eba2acf2f1ca184eb36175f7dd62ce4abcb31f2 SHA512 b32387c722060a3eb471c71ad7a2b34c6eace9369941eda44a611978f1f135da5c9632ea45c318b8d48e1627a307d0a6ae564124ba4505f91daeff1e3e266ba3 WHIRLPOOL 4f2538ca067b14728f07ea862019141679ce73a53d5ac0aad445093a99135a0b6bcd22b23e8595a6153d9fdc85cf657a20371932905f9cea2885809fdfbdcd75 +EBUILD deadbeef-0.6.2.ebuild 5946 SHA256 5452899b7459fd0bdfdc9b57a5068c8df72269bb6e0bcb69678deab34e36d2a9 SHA512 66bc8c76ce96e291dcdc7c5bf8e8228537c96ee0b6f4dce0eb0419eefc36a19fe99d08c10cb5c00b7c8448922d9ebc5ff22298492f89e3e24e5117726a0fbfc3 WHIRLPOOL ae8c19050541feae20c44166f1748e2d02149038c18e2c513c5ef9c7661ff5e46b49d0d69419ac67bd2606caa029b1b6e3544572ff36622a331f084865eda29e diff --git a/media-sound/deadbeef/deadbeef-0.6.2.ebuild b/media-sound/deadbeef/deadbeef-0.6.2.ebuild index f5475c2..1aa0218 100644 --- a/media-sound/deadbeef/deadbeef-0.6.2.ebuild +++ b/media-sound/deadbeef/deadbeef-0.6.2.ebuild @@ -1,111 +1,237 @@ -# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: $ -EAPI="4" +EAPI="5" -inherit fdo-mime gnome2 +PLOCALES="be bg bn ca cs da de el en_GB es et eu fa fi fr gl he hr hu id it ja kk km lg + lt nl pl pt pt_BR ro ru si_LK sk sl sr sr@latin sv te tr ug uk vi zh_CN zh_TW" + +PLOCALE_BACKUP="en_GB" + +inherit autotools eutils fdo-mime gnome2-utils l10n -DESCRIPTION="foobar2000-like music player." -HOMEPAGE="http://deadbeef.sourceforge.net/" SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" -LICENSE="GPL-2 ZLIB" + +KEYWORDS="*" + +DESCRIPTION="foobar2k-like music player" +HOMEPAGE="http://deadbeef.sourceforge.net" + +RESTRICT="mirror" + +LICENSE="BSD + UNICODE + ZLIB + aac? ( GPL GPL-2 ) + adplug? ( LGPL-2.1 ZLIB ) + alac? ( MIT GPL-2 ) + alsa? ( GPL-2 ) + cdda? ( GPL-2 LGPL-2 GPL-3 ) + cover? ( ZLIB ) + converter? ( GPL-2 ) + curl? ( curl ZLIB ) + dts? ( GPL-2 ) + dumb? ( DUMB-0.9.3 ZLIB ) + equalizer? ( GPL-2 ) + ffmpeg? ( GPL-2 ) + flac? ( BSD ) + gme? ( LGPL-2.1 ) + gtk2? ( GPL-2 ) + gtk3? ( GPL-2 ) + hotkeys? ( ZLIB ) + lastfm? ( GPL-2 ) + libnotify? ( GPL-2 ) + libsamplerate? ( GPL-2 ) + m3u? ( ZLIB ) + mac? ( GPL-2 ) + midi? ( LGPL-2.1 ZLIB ) + mms? ( GPL-2 ZLIB ) + mono2stereo? ( ZLIB ) + mp3? ( GPL-2 ZLIB ) + musepack? ( BSD ZLIB ) + nullout? ( ZLIB ) + oss? ( GPL-2 ) + playlist-browser? ( ZLIB ) + psf? ( BSD GPL MAME ZLIB ) + pulseaudio? ( GPL-2 ) + shell-exec? ( GPL-2 ) + shn? ( shorten ZLIB ) + sid? ( GPL-2 ) + sndfile? ( GPL-2 LGPL-2 ) + tta? ( BSD ZLIB ) + vorbis? ( BSD ZLIB ) + vtx? ( GPL-2 ZLIB ) + wavpack? ( BSD ) + wma? ( GPL-2 LGPL-2 ZLIB ) + zip? ( ZLIB )" SLOT="0" -KEYWORDS="~x86 ~amd64" -IUSE="aac adplug alsa cdda cover curl dts encode ffmpeg flac gme +gtk2 gtk3 - hotkeys imlib lastfm libnotify libsamplerate m3u mac midi mms mp3 - musepack nls null oss pulseaudio shellexec sid sndfile supereq threads - tta vorbis vtx wavpack zip" -REQUIRED_USE="encode? ( gtk2 ) - cover? ( curl ) - lastfm? ( curl )" +IUSE="+alsa +flac +gtk2 +hotkeys +m3u +mp3 +sndfile +vorbis + aac adplug alac cdda converter cover cover-imlib2 cover-network curl dts dumb equalizer + ffmpeg gme gtk3 lastfm libnotify libsamplerate mac midi mms mono2stereo musepack nls nullout + oss playlist-browser psf pulseaudio shell-exec shn sid tta unity vtx wavpack wma zip" + +REQUIRED_USE="converter? ( || ( gtk2 gtk3 ) ) + cover-imlib2? ( cover ) + cover-network? ( cover curl ) + cover? ( || ( gtk2 gtk3 ) ) + lastfm? ( curl ) + playlist-browser? ( || ( gtk2 gtk3 ) ) + || ( alsa oss pulseaudio nullout )" -RDEPEND=" +PDEPEND="media-plugins/deadbeef-plugins-meta" + +RDEPEND="dev-libs/glib aac? ( media-libs/faad2 ) + adplug? ( media-libs/adplug ) alsa? ( media-libs/alsa-lib ) + alac? ( media-libs/faad2 ) cdda? ( dev-libs/libcdio media-libs/libcddb ) - cover? ( - imlib? ( media-libs/imlib2 ) - !imlib? ( virtual/jpeg media-libs/libpng ) - ) + cover? ( cover-imlib2? ( media-libs/imlib2 ) + media-libs/libpng + virtual/jpeg + x11-libs/gdk-pixbuf[jpeg] ) curl? ( net-misc/curl ) - ffmpeg? ( media-video/ffmpeg ) - flac? ( media-libs/flac ) - gtk2? ( x11-libs/gtk+:2 ) + ffmpeg? ( virtual/ffmpeg ) + flac? ( media-libs/libogg + media-libs/flac ) + gme? ( sys-libs/zlib ) + gtk2? ( dev-libs/atk + x11-libs/cairo + x11-libs/gtk+:2 + x11-libs/pango ) gtk3? ( x11-libs/gtk+:3 ) hotkeys? ( x11-libs/libX11 ) libnotify? ( sys-apps/dbus ) libsamplerate? ( media-libs/libsamplerate ) + mac? ( dev-lang/yasm ) midi? ( media-sound/timidity-freepats ) mp3? ( media-libs/libmad ) + psf? ( sys-libs/zlib ) pulseaudio? ( media-sound/pulseaudio ) sndfile? ( media-libs/libsndfile ) - vorbis? ( media-libs/libvorbis ) + vorbis? ( media-libs/libogg + media-libs/libvorbis ) wavpack? ( media-sound/wavpack ) - zip? ( sys-libs/zlib ) - " + zip? ( dev-libs/libzip )" + DEPEND="${RDEPEND} - dev-util/pkgconfig - nls? ( virtual/libintl dev-util/intltool ) - " + virtual/pkgconfig + nls? ( virtual/libintl + dev-util/intltool )" src_prepare() { - if use midi; then + if ! use_if_iuse linguas_pt_BR && use_if_iuse linguas_ru ; then + epatch "${FILESDIR}/${PN}-remove-pt_br-help-translation.patch" + rm "${S}/translation/help.pt_BR.txt" || die + fi + + if ! use_if_iuse linguas_ru && use_if_iuse linguas_pt_BR ; then + epatch "${FILESDIR}/${PN}-remove-ru-help-translation.patch" + rm "${S}/translation/help.ru.txt" || die + fi + + if ! use_if_iuse linguas_pt_BR && ! use_if_iuse linguas_ru ; then + epatch "${FILESDIR}/${PN}-remove-pt_br-and-ru-help-translation.patch" + rm "${S}/translation/help.pt_BR.txt" "${S}/translation/help.ru.txt" || die + fi + + if use midi ; then # set default gentoo path sed -e 's;/etc/timidity++/timidity-freepats.cfg;/usr/share/timidity/freepats/timidity.cfg;g' \ - -i "${S}/plugins/wildmidi/wildmidiplug.c" + -i "${S}/plugins/wildmidi/wildmidiplug.c" || die + fi + + if ! use unity ; then + # remove unity trash + epatch "${FILESDIR}/${PN}-0.6.2-or-higher-remove-unity-trash.patch" fi + + config_rpath_update "${S}/config.rpath" || die + eautoreconf } src_configure() { - my_config="$(use_enable nls) - $(use_enable threads) - $(use_enable null nullout) - $(use_enable alsa) - $(use_enable oss) - $(use_enable gtk2) - $(use_enable gtk3) - $(use_enable aac) - $(use_enable adplug) - $(use_enable cdda) - $(use_enable cover artwork) - $(use_enable curl vfs-curl) - $(use_enable dts dca) - $(use_enable encode converter) - $(use_enable ffmpeg) - $(use_enable flac) - $(use_enable gme) - $(use_enable hotkeys) - $(use_enable imlib artwork-imlib2) - $(use_enable lastfm lfm) - $(use_enable libnotify notify) - $(use_enable libsamplerate src) - $(use_enable m3u) - $(use_enable mac ffap) - $(use_enable midi wildmidi) - $(use_enable mms) - $(use_enable mp3 mad) - $(use_enable musepack) - $(use_enable pulseaudio pulse) - $(use_enable shellexec) - $(use_enable sid) - $(use_enable sndfile) - $(use_enable supereq) - $(use_enable tta) - $(use_enable vorbis) - $(use_enable vtx) - $(use_enable wavpack) + if use shell-exec ; then + if use gtk2 || use gtk3 ; then + shell-exec-ui="--enable-shellexec-ui" + else + shell-exec-ui="--disable-shellexec-ui" + fi + fi + + econf --disable-coreaudio \ + --disable-portable \ + --disable-static \ + --docdir=/usr/share/${PN} \ + ${shell-exec-ui} \ + $(use_enable aac) \ + $(use_enable adplug) \ + $(use_enable alac) \ + $(use_enable alsa) \ + $(use_enable cdda) \ + $(use_enable converter) \ + $(use_enable cover artwork) \ + $(use_enable cover-imlib2 artwork-imlib2) \ + $(use_enable cover-network artwork-network) \ + $(use_enable curl vfs-curl) \ + $(use_enable dts dca) \ + $(use_enable dumb) \ + $(use_enable equalizer supereq) \ + $(use_enable ffmpeg) \ + $(use_enable flac) \ + $(use_enable gme) \ + $(use_enable gtk2) \ + $(use_enable gtk3) \ + $(use_enable hotkeys) \ + $(use_enable lastfm lfm) \ + $(use_enable libnotify notify) \ + $(use_enable libsamplerate src) \ + $(use_enable m3u) \ + $(use_enable mac ffap) \ + $(use_enable midi wildmidi) \ + $(use_enable mms) \ + $(use_enable mono2stereo) \ + $(use_enable mp3 mad) \ + $(use_enable musepack) \ + $(use_enable nls) \ + $(use_enable nullout) \ + $(use_enable oss) \ + $(use_enable playlist-browser pltbrowser) \ + $(use_enable psf) \ + $(use_enable pulseaudio pulse) \ + $(use_enable shell-exec shellexec) \ + $(use_enable shn) \ + $(use_enable sid) \ + $(use_enable sndfile) \ + $(use_enable tta) \ + $(use_enable vorbis) \ + $(use_enable vtx) \ + $(use_enable wavpack) \ + $(use_enable wma) \ $(use_enable zip vfs-zip) - --docdir=/usr/share/doc/${PF}" +} - econf ${my_config} +pkg_preinst() { + if use gtk2 || use gtk3 ; then + gnome2_icon_savelist + fi +} + +pkg_postinst() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + + if use gtk2 || use gtk3 ; then + gnome2_icon_cache_update + fi } -src_install() { - # Do not compress docs as we need it for deadbeef's help function. - PORTAGE_DOCOMPRESS_SKIP+=( "/usr/share/doc/${PF}" ) +pkg_postrm() { + fdo-mime_desktop_database_update + fdo-mime_mime_database_update - emake DESTDIR="${D}" install + if use gtk2 || use gtk3 ; then + gnome2_icon_cache_update + fi }
disbeliever/disbeliever-overlay
c88ea4fe46db3f682338c0d55565895d147e1a11
added media-sound/deadbeef-0.6.2
diff --git a/media-sound/deadbeef/Manifest b/media-sound/deadbeef/Manifest index b591069..261853a 100644 --- a/media-sound/deadbeef/Manifest +++ b/media-sound/deadbeef/Manifest @@ -1,6 +1,6 @@ -DIST deadbeef-0.5.5.tar.bz2 3219511 SHA256 d9d01276f07e90155da37fb257c744af4accb4da17da048ce5604cb1174750b7 SHA512 18ff9d10f3e31bfde5ae193c8d738d973299b5f96ac4137cd805b6aca843fc60ee81c7371faaad0e5dde6a1a8683231afa85dbd1fa9cd4798d261ba5ae7fcc76 WHIRLPOOL 0f1b98b08bbe6c7b9d3086c711760d585dde0330ae8b8bf83c924a24b879c638771c2b75ac5ea86ead561f6dec9aa97913e972835d653773a52ff0f0033cc001 DIST deadbeef-0.5.6.tar.bz2 3279899 SHA256 17c123eb50e33c89403d8d3035b9132463a227a6905fd42bcbb2a3a5616cea5b SHA512 20d8d58e2df90078af2dd6583c7ae9d7b3b6f7d73cef1d823910614278779614c1544e839a886ab7ab972ad235220829d8e07dc1c959e98c94fc1e47299e5b4a WHIRLPOOL 9b7349c4664be4e98a935fb97393195cc4911d28e011a83c8f3d621b004ccb70f3e5e06129138eb3edf64b17c533b0b214a29e2fb71b96e7b6638b92d2a69947 DIST deadbeef-0.6.1.tar.bz2 3429924 SHA256 362b7d496eca487a09fa919e1b03ffb3c01034f1e2b05f09ea5a47aaa2f0af45 SHA512 0812f2d6b2ebc2ef1e65af9912546fa769e0e6d090f15cf3f2c4170bfa5aab03545cd63f26dcdcde905416801c0b56bd190cd1792f29eabaa318db212db99f90 WHIRLPOOL 2ac6f4abd70625c4f0898cb07e7b5ef645755136aee4b424af5e9d11c00b290dc75a467288e45bf35f2d25fc51fd76c12c58a58c966ea6fdf9ae4e1cea512339 -EBUILD deadbeef-0.5.5.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 +DIST deadbeef-0.6.2.tar.bz2 3495920 SHA256 3433b966683286c03ffbcc79b2201cd517f8dbf6b41da8600778dfa93cd64e1a SHA512 7caee245d7fa68e98ce5edc6aa6acc829d62c963f523c81e0406182a1aa36759219a8c0a2bdf010ac810f22b15acc81d06e8cab4ab820956c96cbc0a94423b7b WHIRLPOOL a8fc10c0f44f9f4d4eafb99a52f26efef34c2a1164d19b1f60693347a4b7a5564c6f7fafd394914149240a2a2f30926ce853bf42bbf3a07699bd8ba422a59f63 EBUILD deadbeef-0.5.6.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 EBUILD deadbeef-0.6.1.ebuild 2844 SHA256 991c9988e4f005bdd5646b180eba2acf2f1ca184eb36175f7dd62ce4abcb31f2 SHA512 b32387c722060a3eb471c71ad7a2b34c6eace9369941eda44a611978f1f135da5c9632ea45c318b8d48e1627a307d0a6ae564124ba4505f91daeff1e3e266ba3 WHIRLPOOL 4f2538ca067b14728f07ea862019141679ce73a53d5ac0aad445093a99135a0b6bcd22b23e8595a6153d9fdc85cf657a20371932905f9cea2885809fdfbdcd75 +EBUILD deadbeef-0.6.2.ebuild 2844 SHA256 991c9988e4f005bdd5646b180eba2acf2f1ca184eb36175f7dd62ce4abcb31f2 SHA512 b32387c722060a3eb471c71ad7a2b34c6eace9369941eda44a611978f1f135da5c9632ea45c318b8d48e1627a307d0a6ae564124ba4505f91daeff1e3e266ba3 WHIRLPOOL 4f2538ca067b14728f07ea862019141679ce73a53d5ac0aad445093a99135a0b6bcd22b23e8595a6153d9fdc85cf657a20371932905f9cea2885809fdfbdcd75 diff --git a/media-sound/deadbeef/deadbeef-0.6.2.ebuild b/media-sound/deadbeef/deadbeef-0.6.2.ebuild new file mode 100644 index 0000000..f5475c2 --- /dev/null +++ b/media-sound/deadbeef/deadbeef-0.6.2.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="4" + +inherit fdo-mime gnome2 + +DESCRIPTION="foobar2000-like music player." +HOMEPAGE="http://deadbeef.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" +LICENSE="GPL-2 ZLIB" + +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="aac adplug alsa cdda cover curl dts encode ffmpeg flac gme +gtk2 gtk3 + hotkeys imlib lastfm libnotify libsamplerate m3u mac midi mms mp3 + musepack nls null oss pulseaudio shellexec sid sndfile supereq threads + tta vorbis vtx wavpack zip" + +REQUIRED_USE="encode? ( gtk2 ) + cover? ( curl ) + lastfm? ( curl )" + +RDEPEND=" + aac? ( media-libs/faad2 ) + alsa? ( media-libs/alsa-lib ) + cdda? ( dev-libs/libcdio media-libs/libcddb ) + cover? ( + imlib? ( media-libs/imlib2 ) + !imlib? ( virtual/jpeg media-libs/libpng ) + ) + curl? ( net-misc/curl ) + ffmpeg? ( media-video/ffmpeg ) + flac? ( media-libs/flac ) + gtk2? ( x11-libs/gtk+:2 ) + gtk3? ( x11-libs/gtk+:3 ) + hotkeys? ( x11-libs/libX11 ) + libnotify? ( sys-apps/dbus ) + libsamplerate? ( media-libs/libsamplerate ) + midi? ( media-sound/timidity-freepats ) + mp3? ( media-libs/libmad ) + pulseaudio? ( media-sound/pulseaudio ) + sndfile? ( media-libs/libsndfile ) + vorbis? ( media-libs/libvorbis ) + wavpack? ( media-sound/wavpack ) + zip? ( sys-libs/zlib ) + " +DEPEND="${RDEPEND} + dev-util/pkgconfig + nls? ( virtual/libintl dev-util/intltool ) + " + +src_prepare() { + if use midi; then + # set default gentoo path + sed -e 's;/etc/timidity++/timidity-freepats.cfg;/usr/share/timidity/freepats/timidity.cfg;g' \ + -i "${S}/plugins/wildmidi/wildmidiplug.c" + fi +} + +src_configure() { + my_config="$(use_enable nls) + $(use_enable threads) + $(use_enable null nullout) + $(use_enable alsa) + $(use_enable oss) + $(use_enable gtk2) + $(use_enable gtk3) + $(use_enable aac) + $(use_enable adplug) + $(use_enable cdda) + $(use_enable cover artwork) + $(use_enable curl vfs-curl) + $(use_enable dts dca) + $(use_enable encode converter) + $(use_enable ffmpeg) + $(use_enable flac) + $(use_enable gme) + $(use_enable hotkeys) + $(use_enable imlib artwork-imlib2) + $(use_enable lastfm lfm) + $(use_enable libnotify notify) + $(use_enable libsamplerate src) + $(use_enable m3u) + $(use_enable mac ffap) + $(use_enable midi wildmidi) + $(use_enable mms) + $(use_enable mp3 mad) + $(use_enable musepack) + $(use_enable pulseaudio pulse) + $(use_enable shellexec) + $(use_enable sid) + $(use_enable sndfile) + $(use_enable supereq) + $(use_enable tta) + $(use_enable vorbis) + $(use_enable vtx) + $(use_enable wavpack) + $(use_enable zip vfs-zip) + --docdir=/usr/share/doc/${PF}" + + econf ${my_config} +} + +src_install() { + # Do not compress docs as we need it for deadbeef's help function. + PORTAGE_DOCOMPRESS_SKIP+=( "/usr/share/doc/${PF}" ) + + emake DESTDIR="${D}" install +}
disbeliever/disbeliever-overlay
323c6af0fe2bb398e6a9473cb2bf4fe24be8ce40
added metadata/layout.conf
diff --git a/metadata/layout.conf b/metadata/layout.conf new file mode 100644 index 0000000..d43e61c --- /dev/null +++ b/metadata/layout.conf @@ -0,0 +1 @@ +masters = gentoo
disbeliever/disbeliever-overlay
90f23356a9931029d99ee5b24003e9c3be575360
add games-engines/instead-1.9.0
diff --git a/games-engines/instead/Manifest b/games-engines/instead/Manifest new file mode 100644 index 0000000..ce7b826 --- /dev/null +++ b/games-engines/instead/Manifest @@ -0,0 +1,5 @@ +AUX zlib.patch 277 SHA256 abfa40d4031ab46bb5e63cbfdc4372d26e74a6228a3fffd1c02decb48976179d SHA512 b131b64687c37a552137b1afc6c8a723dcd8391e9492de4eed368b458efa333461796ea1c2d019eca17779d6ff8b03be7334b14a0d9816cf839153c0bbffebd6 WHIRLPOOL a6f6d053de68cb09f9665601f6bcca2e0449b1b4c7fcd03d20e5f07d4d5de71bc30fae79c81cea078376dc6ca77d5e152549d4a20d37045a2daa5ddf80dab971 +DIST instead_1.8.1.tar.gz 3958311 SHA256 44ab4e38e0c2c5925f3d0726bd5587a58551dd37877cfa4ee03135ffc99b897e SHA512 9bb9c32b9e140382a658da8ef07def2f90d9146f097ad3fa70795139e6012d9a5219112b64af18ec95cb6b512e711fd489ca86e70e00afb39c6108acb5fb62a8 WHIRLPOOL 4547fc4160b0421e317702fb65caa7f8ca44d15a25f1920efcbef644581bd660e408b260fdf1bf00d459298446d55baa4a985636de21efdb3a646f4d5502585a +DIST instead_1.9.0.tar.gz 5546134 SHA256 1f472b5a5e710c780960b7711ab0c77bc80e6e4133327f7527a25f93fb18d340 SHA512 01c0c0fc4f8302d3d66c07674dc0dbd7b582a4f3965ffac7fbc13fb62f25af45150302c8749ffd57935a8ffbd748417039770c35214b5e4ac932b42bd31e6329 WHIRLPOOL a70912ed94a9196e4c60729215d8f60bea98d2feb5ba8cc4ace23288c67792575c3dab5f6452fa6ad439f7486a28a0f1decfb9caa253f4194b2b0b9e218ff63d +EBUILD instead-1.8.1.ebuild 1237 SHA256 83f8e7365ca68d2a11e023126b070f8c19d67fdb89d85183a067c32d97163f1a SHA512 6944df1c1ab8e796fc0d62775714eb70e6d19551a225159d87197d9d821473ef2fa83395516cb01f4a3f0fb7a2f78bd393119b4bf54ac61339e6e0d975f66799 WHIRLPOOL 0ecc4e156860c24a352e866ddca89b587253d5240a09332bdb5e98ea6e1b127bb8b0d1acba2f4b3ca6fffaea3bcbdf85c074b52a8277b54787fad684255f70e9 +EBUILD instead-1.9.0.ebuild 1305 SHA256 f7d87c69ee187bbbd8983662e8e4619007e282777fe446e50797d2f0ee3fca9f SHA512 65836f0b971b3767993774aa1e0a66e130bb10e82e03d5df19145809304b0add1f3882ca2ad7854559b8029c317fa0164757e472d1bdb986522c510db2242985 WHIRLPOOL d19b99952585e7d989a0e026ab2ff6429645192823d768e990fe630c194089c572040029c1499eddbb996447e5fc959d08487a4ed7f5ac42a8a397358e7bb032 diff --git a/games-engines/instead/files/zlib.patch b/games-engines/instead/files/zlib.patch new file mode 100644 index 0000000..71e17cd --- /dev/null +++ b/games-engines/instead/files/zlib.patch @@ -0,0 +1,14 @@ +--- src/sdl-instead/ioapi.h (revision 1858) ++++ src/sdl-instead/ioapi.h (revision 1859) +@@ -48,6 +48,11 @@ + #include <stdlib.h> + #include "zlib.h" + ++#ifdef _Z_OF ++#undef OF ++#define OF _Z_OF ++#endif ++ + #if defined(USE_FILE32API) + #define fopen64 fopen + #define ftello64 ftell diff --git a/games-engines/instead/instead-1.9.0.ebuild b/games-engines/instead/instead-1.9.0.ebuild new file mode 100644 index 0000000..6545956 --- /dev/null +++ b/games-engines/instead/instead-1.9.0.ebuild @@ -0,0 +1,40 @@ +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="2" + +inherit games + +DESCRIPTION="INSTEAD quest engine" +HOMEPAGE="http://instead.syscall.ru/" +SRC_URI="mirror://sourceforge/instead/instead_${PV}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="=dev-lang/lua-5.1* + media-libs/libsdl + media-libs/sdl-mixer + media-libs/sdl-image + media-libs/sdl-ttf" +RDEPEND="${DEPEND}" + +src_prepare() { + epatch "${FILESDIR}"/zlib.patch + + cd "${S}" || die "Directory ${S} doesn't exist" + cp Rules.make.system Rules.make || die "Cannot copy Rules.make.system" + sed 's/lua5.1/lua/;' -i Rules.make || die "Cannot patch Rules.make" + sed 's:PREFIX=.*:PREFIX=/usr:' -i Rules.make || die "Cannot patch Rules.make" + sed 's:BIN=.*:BIN=$(DESTDIR)'"${GAMES_BINDIR}:" -i Rules.make || die "Cannot patch Rules.make" + sed 's:STEADPATH=$(DESTDIR)$(PREFIX)/share:STEADPATH=$(DESTDIR)'"${GAMES_DATADIR}:" -i Rules.make || die "Cannot patch Rules.make" + sed 's:DOCPATH=$(DESTDIR)$(PREFIX)/share:DOCPATH=$(DESTDIR)'"${GAMES_DATADIR}:" -i Rules.make || die "Cannot patch Rules.make" + sed 's/ \*\.pdf//;' -i doc/Makefile || die "Cannot patch doc/Makefile" +} + +src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + prepgamesdirs +}
disbeliever/disbeliever-overlay
b6eb37b687855460253bd18fee84c745cbb1e5d2
added media-sound/deadbeef-0.6.1
diff --git a/media-sound/deadbeef/Manifest b/media-sound/deadbeef/Manifest index 09c9535..b591069 100644 --- a/media-sound/deadbeef/Manifest +++ b/media-sound/deadbeef/Manifest @@ -1,4 +1,6 @@ DIST deadbeef-0.5.5.tar.bz2 3219511 SHA256 d9d01276f07e90155da37fb257c744af4accb4da17da048ce5604cb1174750b7 SHA512 18ff9d10f3e31bfde5ae193c8d738d973299b5f96ac4137cd805b6aca843fc60ee81c7371faaad0e5dde6a1a8683231afa85dbd1fa9cd4798d261ba5ae7fcc76 WHIRLPOOL 0f1b98b08bbe6c7b9d3086c711760d585dde0330ae8b8bf83c924a24b879c638771c2b75ac5ea86ead561f6dec9aa97913e972835d653773a52ff0f0033cc001 DIST deadbeef-0.5.6.tar.bz2 3279899 SHA256 17c123eb50e33c89403d8d3035b9132463a227a6905fd42bcbb2a3a5616cea5b SHA512 20d8d58e2df90078af2dd6583c7ae9d7b3b6f7d73cef1d823910614278779614c1544e839a886ab7ab972ad235220829d8e07dc1c959e98c94fc1e47299e5b4a WHIRLPOOL 9b7349c4664be4e98a935fb97393195cc4911d28e011a83c8f3d621b004ccb70f3e5e06129138eb3edf64b17c533b0b214a29e2fb71b96e7b6638b92d2a69947 +DIST deadbeef-0.6.1.tar.bz2 3429924 SHA256 362b7d496eca487a09fa919e1b03ffb3c01034f1e2b05f09ea5a47aaa2f0af45 SHA512 0812f2d6b2ebc2ef1e65af9912546fa769e0e6d090f15cf3f2c4170bfa5aab03545cd63f26dcdcde905416801c0b56bd190cd1792f29eabaa318db212db99f90 WHIRLPOOL 2ac6f4abd70625c4f0898cb07e7b5ef645755136aee4b424af5e9d11c00b290dc75a467288e45bf35f2d25fc51fd76c12c58a58c966ea6fdf9ae4e1cea512339 EBUILD deadbeef-0.5.5.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 EBUILD deadbeef-0.5.6.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 +EBUILD deadbeef-0.6.1.ebuild 2844 SHA256 991c9988e4f005bdd5646b180eba2acf2f1ca184eb36175f7dd62ce4abcb31f2 SHA512 b32387c722060a3eb471c71ad7a2b34c6eace9369941eda44a611978f1f135da5c9632ea45c318b8d48e1627a307d0a6ae564124ba4505f91daeff1e3e266ba3 WHIRLPOOL 4f2538ca067b14728f07ea862019141679ce73a53d5ac0aad445093a99135a0b6bcd22b23e8595a6153d9fdc85cf657a20371932905f9cea2885809fdfbdcd75 diff --git a/media-sound/deadbeef/deadbeef-0.6.1.ebuild b/media-sound/deadbeef/deadbeef-0.6.1.ebuild new file mode 100644 index 0000000..f5475c2 --- /dev/null +++ b/media-sound/deadbeef/deadbeef-0.6.1.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="4" + +inherit fdo-mime gnome2 + +DESCRIPTION="foobar2000-like music player." +HOMEPAGE="http://deadbeef.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" +LICENSE="GPL-2 ZLIB" + +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="aac adplug alsa cdda cover curl dts encode ffmpeg flac gme +gtk2 gtk3 + hotkeys imlib lastfm libnotify libsamplerate m3u mac midi mms mp3 + musepack nls null oss pulseaudio shellexec sid sndfile supereq threads + tta vorbis vtx wavpack zip" + +REQUIRED_USE="encode? ( gtk2 ) + cover? ( curl ) + lastfm? ( curl )" + +RDEPEND=" + aac? ( media-libs/faad2 ) + alsa? ( media-libs/alsa-lib ) + cdda? ( dev-libs/libcdio media-libs/libcddb ) + cover? ( + imlib? ( media-libs/imlib2 ) + !imlib? ( virtual/jpeg media-libs/libpng ) + ) + curl? ( net-misc/curl ) + ffmpeg? ( media-video/ffmpeg ) + flac? ( media-libs/flac ) + gtk2? ( x11-libs/gtk+:2 ) + gtk3? ( x11-libs/gtk+:3 ) + hotkeys? ( x11-libs/libX11 ) + libnotify? ( sys-apps/dbus ) + libsamplerate? ( media-libs/libsamplerate ) + midi? ( media-sound/timidity-freepats ) + mp3? ( media-libs/libmad ) + pulseaudio? ( media-sound/pulseaudio ) + sndfile? ( media-libs/libsndfile ) + vorbis? ( media-libs/libvorbis ) + wavpack? ( media-sound/wavpack ) + zip? ( sys-libs/zlib ) + " +DEPEND="${RDEPEND} + dev-util/pkgconfig + nls? ( virtual/libintl dev-util/intltool ) + " + +src_prepare() { + if use midi; then + # set default gentoo path + sed -e 's;/etc/timidity++/timidity-freepats.cfg;/usr/share/timidity/freepats/timidity.cfg;g' \ + -i "${S}/plugins/wildmidi/wildmidiplug.c" + fi +} + +src_configure() { + my_config="$(use_enable nls) + $(use_enable threads) + $(use_enable null nullout) + $(use_enable alsa) + $(use_enable oss) + $(use_enable gtk2) + $(use_enable gtk3) + $(use_enable aac) + $(use_enable adplug) + $(use_enable cdda) + $(use_enable cover artwork) + $(use_enable curl vfs-curl) + $(use_enable dts dca) + $(use_enable encode converter) + $(use_enable ffmpeg) + $(use_enable flac) + $(use_enable gme) + $(use_enable hotkeys) + $(use_enable imlib artwork-imlib2) + $(use_enable lastfm lfm) + $(use_enable libnotify notify) + $(use_enable libsamplerate src) + $(use_enable m3u) + $(use_enable mac ffap) + $(use_enable midi wildmidi) + $(use_enable mms) + $(use_enable mp3 mad) + $(use_enable musepack) + $(use_enable pulseaudio pulse) + $(use_enable shellexec) + $(use_enable sid) + $(use_enable sndfile) + $(use_enable supereq) + $(use_enable tta) + $(use_enable vorbis) + $(use_enable vtx) + $(use_enable wavpack) + $(use_enable zip vfs-zip) + --docdir=/usr/share/doc/${PF}" + + econf ${my_config} +} + +src_install() { + # Do not compress docs as we need it for deadbeef's help function. + PORTAGE_DOCOMPRESS_SKIP+=( "/usr/share/doc/${PF}" ) + + emake DESTDIR="${D}" install +}
disbeliever/disbeliever-overlay
339ab91cae6caab0962d25a99a9612314885bb64
Added dev-util/radare2
diff --git a/dev-util/radare2/Manifest b/dev-util/radare2/Manifest new file mode 100644 index 0000000..20dbae8 --- /dev/null +++ b/dev-util/radare2/Manifest @@ -0,0 +1,2 @@ +DIST radare2-0.9.6.tar.xz 2072552 SHA256 91e8820ab7003de422cde777af681b0023d6b20253a81759df94578c514ae883 SHA512 bb65ae9ebfc30fcc41d9906f5951f394721a576cfc5bc0c758c12855e63f6fc09b19498ea1c96d1d41e65926cd7d0920cfd80013ceb8bedd09a84cc1858de7d8 WHIRLPOOL 081d8413149db503d4b76ac78f28d9905f28834167dbda0b0e605861426b30f4f25096492f6c883af7978ab9ed5e7325f8194ebec445399452a4aa4e4b266949 +EBUILD radare2-0.9.6.ebuild 333 SHA256 7d05b04588774d59529bd510da5193a70d5d20a1eaed4306288114ded9c07832 SHA512 d3fe369a820d2cef4a09a3ede236722f2012fd410e49f888daf0863e1255283bcc94954da7e0a735aae4bf0b84e1b0c007f9f5f053867ed55a07021fbefbb175 WHIRLPOOL 290cc3ea0c0d87023dd00bf43076b1b50b144383a11312020714d5e49b2758c80f401b9caaeafc7bdcbcf253a5afc67d938e512243af8126a4332657e4bae31c diff --git a/dev-util/radare2/radare2-0.9.6.ebuild b/dev-util/radare2/radare2-0.9.6.ebuild new file mode 100644 index 0000000..ba95f4a --- /dev/null +++ b/dev-util/radare2/radare2-0.9.6.ebuild @@ -0,0 +1,16 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 + +DESCRIPTION="HEX editor" +HOMEPAGE="http://radare.nopcode.org/" +SRC_URI="http://radare.nopcode.org/get/radare2-${PV}.tar.xz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~x86 ~amd64" + +DEPEND="" +RDEPEND="${DEPEND}"
disbeliever/disbeliever-overlay
7c2247ec4f2eee57056c8f2ebe6540bb95c8b9e5
add app-dicts/tagainijisho/tagainijisho-1.0.1.ebuild
diff --git a/app-dicts/tagainijisho/tagainijisho-1.0.1.ebuild b/app-dicts/tagainijisho/tagainijisho-1.0.1.ebuild new file mode 100644 index 0000000..9da0079 --- /dev/null +++ b/app-dicts/tagainijisho/tagainijisho-1.0.1.ebuild @@ -0,0 +1,16 @@ +EAPI=2 + +inherit cmake-utils + +DESCRIPTION="Tagaini Jisho is a free, open-source Japanese dictionary and kanji lookup tool" +HOMEPAGE="http://www.tagaini.net/" +SRC_URI="https://github.com/Gnurou/tagainijisho/releases/download/${PV}/${P}.tar.gz" +RESTRICT="mirror" +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" + +DEPEND=">=dev-util/cmake-2.8.1 +>=dev-qt/qtgui-4.5:4" +RDEPEND="${DEPEND}"
disbeliever/disbeliever-overlay
06497056583f2e4f53d44106979d1f7dc7c03653
remove media-sound/deadbeef-0.5.1
diff --git a/media-sound/deadbeef/Manifest b/media-sound/deadbeef/Manifest index 85beaf7..09c9535 100644 --- a/media-sound/deadbeef/Manifest +++ b/media-sound/deadbeef/Manifest @@ -1,6 +1,4 @@ -DIST deadbeef-0.5.1.tar.bz2 2317508 SHA256 449e2933634c8f06dfdac65cd1afbe87a7f97fcd8e541694d6e65fe1941ac18f SHA512 49c06b6a208d69ebc5e252289da998c64fdf441f2c52457884ede446b0e2346cd1b5163cf065f5fd85565c563b1b673462d8ded855b60deeb51d1d0b8b8d8327 WHIRLPOOL e215a587e422a22965913df44f023b2aa1717d103a8d935e2505b26de2dcd39757e3820ae3acfa2c5244b53bb9c5b606b5ed49915447ffe94158ef4b7f21b11a DIST deadbeef-0.5.5.tar.bz2 3219511 SHA256 d9d01276f07e90155da37fb257c744af4accb4da17da048ce5604cb1174750b7 SHA512 18ff9d10f3e31bfde5ae193c8d738d973299b5f96ac4137cd805b6aca843fc60ee81c7371faaad0e5dde6a1a8683231afa85dbd1fa9cd4798d261ba5ae7fcc76 WHIRLPOOL 0f1b98b08bbe6c7b9d3086c711760d585dde0330ae8b8bf83c924a24b879c638771c2b75ac5ea86ead561f6dec9aa97913e972835d653773a52ff0f0033cc001 DIST deadbeef-0.5.6.tar.bz2 3279899 SHA256 17c123eb50e33c89403d8d3035b9132463a227a6905fd42bcbb2a3a5616cea5b SHA512 20d8d58e2df90078af2dd6583c7ae9d7b3b6f7d73cef1d823910614278779614c1544e839a886ab7ab972ad235220829d8e07dc1c959e98c94fc1e47299e5b4a WHIRLPOOL 9b7349c4664be4e98a935fb97393195cc4911d28e011a83c8f3d621b004ccb70f3e5e06129138eb3edf64b17c533b0b214a29e2fb71b96e7b6638b92d2a69947 -EBUILD deadbeef-0.5.1-r3.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 EBUILD deadbeef-0.5.5.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429 EBUILD deadbeef-0.5.6.ebuild 2793 SHA256 fee2942ca7fe2210ca1fb2930f5d0d568f1be7eaceef061f645a6ee232bc6b1c SHA512 2a47f0746e4a0440ff1d876a2092dc2b7a83b0a36ea041df48955040cb2d027580d215411988a0385a118b9f6980a61787e59d11bb9881cbd1ad11054c69a5cd WHIRLPOOL ffd3d9d08907c5786d2f6830533c04d2a965a7c88c89f0eb997f682c3a681c049086a0589ad2e2e3005e749663bbc4a69af21ed0a002ef6e386a99d23a298429