code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Sparks
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author CodeIgniter Reactor Dev Team
* @author Kenny Katzgrau <katzgrau@gmail.com>
* @since CodeIgniter Version 1.0
* @filesource
*/
/**
* Loader Class
*
* Loads views and files
*
* @package CodeIgniter
* @subpackage Libraries
* @author CodeIgniter Reactor Dev Team
* @author Kenny Katzgrau <katzgrau@gmail.com>
* @category Loader
* @link http://codeigniter.com/user_guide/libraries/loader.html
*/
class MY_Loader extends CI_Loader
{
/**
* Keep track of which sparks are loaded. This will come in handy for being
* speedy about loading files later.
*
* @var array
*/
var $_ci_loaded_sparks = array();
/**
* Is this version less than CI 2.1.0? If so, accomodate
* @bubbafoley's world-destroying change at: http://bit.ly/sIqR7H
* @var bool
*/
var $_is_lt_210 = false;
/**
* Constructor. Define SPARKPATH if it doesn't exist, initialize parent
*/
function __construct()
{
if(!defined('SPARKPATH'))
{
define('SPARKPATH', 'sparks/');
}
$this->_is_lt_210 = (is_callable(array('CI_Loader', 'ci_autoloader'))
|| is_callable(array('CI_Loader', '_ci_autoloader')));
parent::__construct();
}
/**
* To accomodate CI 2.1.0, we override the initialize() method instead of
* the ci_autoloader() method. Once sparks is integrated into CI, we
* can avoid the awkward version-specific logic.
* @return Loader
*/
function initialize()
{
parent::initialize();
if(!$this->_is_lt_210)
{
$this->ci_autoloader();
}
return $this;
}
/**
* Load a spark by it's path within the sparks directory defined by
* SPARKPATH, such as 'markdown/1.0'
* @param string $spark The spark path withint he sparks directory
* @param <type> $autoload An optional array of items to autoload
* in the format of:
* array (
* 'helper' => array('somehelper')
* )
* @return <type>
*/
function spark($spark, $autoload = array())
{
if(is_array($spark))
{
foreach($spark as $s)
{
$this->spark($s);
}
}
$spark = ltrim($spark, '/');
$spark = rtrim($spark, '/');
$spark_path = SPARKPATH . $spark . '/';
$parts = explode('/', $spark);
$spark_slug = strtolower($parts[0]);
# If we've already loaded this spark, bail
if(array_key_exists($spark_slug, $this->_ci_loaded_sparks))
{
return true;
}
# Check that it exists. CI Doesn't check package existence by itself
if(!file_exists($spark_path))
{
show_error("Cannot find spark path at $spark_path");
}
if(count($parts) == 2)
{
$this->_ci_loaded_sparks[$spark_slug] = $spark;
}
$this->add_package_path($spark_path);
foreach($autoload as $type => $read)
{
if($type == 'library')
$this->library($read);
elseif($type == 'model')
$this->model($read);
elseif($type == 'config')
$this->config($read);
elseif($type == 'helper')
$this->helper($read);
elseif($type == 'view')
$this->view($read);
else
show_error ("Could not autoload object of type '$type' ($read) for spark $spark");
}
// Looks for a spark's specific autoloader
$this->ci_autoloader($spark_path);
return true;
}
/**
* Pre-CI 2.0.3 method for backward compatility.
*
* @param null $basepath
* @return void
*/
function _ci_autoloader($basepath = NULL)
{
$this->ci_autoloader($basepath);
}
/**
* Specific Autoloader (99% ripped from the parent)
*
* The config/autoload.php file contains an array that permits sub-systems,
* libraries, and helpers to be loaded automatically.
*
* @param array|null $basepath
* @return void
*/
function ci_autoloader($basepath = NULL)
{
if($basepath !== NULL)
{
$autoload_path = $basepath.'config/autoload'.EXT;
}
else
{
$autoload_path = APPPATH.'config/autoload'.EXT;
}
if(! file_exists($autoload_path))
{
return FALSE;
}
include($autoload_path);
if ( ! isset($autoload))
{
return FALSE;
}
if($this->_is_lt_210 || $basepath !== NULL)
{
// Autoload packages
if (isset($autoload['packages']))
{
foreach ($autoload['packages'] as $package_path)
{
$this->add_package_path($package_path);
}
}
}
// Autoload sparks
if (isset($autoload['sparks']))
{
foreach ($autoload['sparks'] as $spark)
{
$this->spark($spark);
}
}
if($this->_is_lt_210 || $basepath !== NULL)
{
if (isset($autoload['config']))
{
// Load any custom config file
if (count($autoload['config']) > 0)
{
$CI =& get_instance();
foreach ($autoload['config'] as $key => $val)
{
$CI->config->load($val);
}
}
}
// Autoload helpers and languages
foreach (array('helper', 'language') as $type)
{
if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
{
$this->$type($autoload[$type]);
}
}
// A little tweak to remain backward compatible
// The $autoload['core'] item was deprecated
if ( ! isset($autoload['libraries']) AND isset($autoload['core']))
{
$autoload['libraries'] = $autoload['core'];
}
// Load libraries
if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
{
// Load the database driver.
if (in_array('database', $autoload['libraries']))
{
$this->database();
$autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
}
// Load all other libraries
foreach ($autoload['libraries'] as $item)
{
$this->library($item);
}
}
// Autoload models
if (isset($autoload['model']))
{
$this->model($autoload['model']);
}
}
}
} | 101-code | application/core/MY_Loader.php | PHP | gpl3 | 7,105 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/core/index.html | HTML | gpl3 | 114 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Homepage extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->helper('asset');
$this->output->enable_profiler(TRUE);
$this->load->view('welcome_message');
}
}
/* End of file homepage.php */
/* Location: ./application/controllers/homepage.php */
| 101-code | application/controllers/site/homepage.php | PHP | gpl3 | 843 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/controllers/site/index.html | HTML | gpl3 | 114 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Install extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('admin/install_model', 'install');
$this->load->helper('form');
}
function index()
{
$this->load->view('admin/install/check');
}
function build()
{
$data['session_table'] = $this->install->create_ci_session_table() ? 'SUCCESS' : 'FAIL';
$data['session_check'] = $this->install->check_session() ? 'SUCCESS' : 'FAIL';
$this->load->view('admin/install/build', $data);
}
} | 101-code | application/controllers/admin/install.php | PHP | gpl3 | 575 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/controllers/admin/index.html | HTML | gpl3 | 114 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/controllers/errors/index.html | HTML | gpl3 | 114 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/controllers/index.html | HTML | gpl3 | 114 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Ð|Ď|Đ/' => 'D',
'/ð|ď|đ/' => 'd',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
'/ĝ|ğ|ġ|ģ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ/' => 'K',
'/ķ/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
'/Ñ|Ń|Ņ|Ň/' => 'N',
'/ñ|ń|ņ|ň|ʼn/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
'/Ŕ|Ŗ|Ř/' => 'R',
'/ŕ|ŗ|ř/' => 'r',
'/Ś|Ŝ|Ş|Š/' => 'S',
'/ś|ŝ|ş|š|ſ/' => 's',
'/Ţ|Ť|Ŧ/' => 'T',
'/ţ|ť|ŧ/' => 't',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
'/Ý|Ÿ|Ŷ/' => 'Y',
'/ý|ÿ|ŷ/' => 'y',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž/' => 'Z',
'/ź|ż|ž/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/'=> 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f'
);
/* End of file foreign_chars.php */
/* Location: ./application/config/foreign_chars.php */ | 101-code | application/config/foreign_chars.php | PHP | gpl3 | 1,781 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| http://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There area two reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router what URI segments to use if those provided
| in the URL cannot be matched to a valid route.
|
*/
$route['default_controller'] = "site/homepage";
$route['404_override'] = 'errors/404';
/* End of file routes.php */
/* Location: ./application/config/routes.php */
| 101-code | application/config/routes.php | PHP | gpl3 | 1,560 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
|
*/
$platforms = array (
'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000',
'windows nt 5.1' => 'Windows XP',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'Flock' => 'Flock',
'Chrome' => 'Chrome',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => "Motorola",
'nokia' => "Nokia",
'palm' => "Palm",
'iphone' => "Apple iPhone",
'ipad' => "iPad",
'ipod' => "Apple iPod Touch",
'sony' => "Sony Ericsson",
'ericsson' => "Sony Ericsson",
'blackberry' => "BlackBerry",
'cocoon' => "O2 Cocoon",
'blazer' => "Treo",
'lg' => "LG",
'amoi' => "Amoi",
'xda' => "XDA",
'mda' => "MDA",
'vario' => "Vario",
'htc' => "HTC",
'samsung' => "Samsung",
'sharp' => "Sharp",
'sie-' => "Siemens",
'alcatel' => "Alcatel",
'benq' => "BenQ",
'ipaq' => "HP iPaq",
'mot-' => "Motorola",
'playstation portable' => "PlayStation Portable",
'hiptop' => "Danger Hiptop",
'nec-' => "NEC",
'panasonic' => "Panasonic",
'philips' => "Philips",
'sagem' => "Sagem",
'sanyo' => "Sanyo",
'spv' => "SPV",
'zte' => "ZTE",
'sendo' => "Sendo",
// Operating Systems
'symbian' => "Symbian",
'SymbianOS' => "SymbianOS",
'elaine' => "Palm",
'palm' => "Palm",
'series60' => "Symbian S60",
'windows ce' => "Windows CE",
// Browsers
'obigo' => "Obigo",
'netfront' => "Netfront Browser",
'openwave' => "Openwave Browser",
'mobilexplorer' => "Mobile Explorer",
'operamini' => "Opera Mini",
'opera mini' => "Opera Mini",
// Other
'digital paths' => "Digital Paths",
'avantgo' => "AvantGo",
'xiino' => "Xiino",
'novarra' => "Novarra Transcoder",
'vodafone' => "Vodafone",
'docomo' => "NTT DoCoMo",
'o2' => "O2",
// Fallback
'mobile' => "Generic Mobile",
'wireless' => "Generic Mobile",
'j2me' => "Generic Mobile",
'midp' => "Generic Mobile",
'cldc' => "Generic Mobile",
'up.link' => "Generic Mobile",
'up.browser' => "Generic Mobile",
'smartphone' => "Generic Mobile",
'cellphone' => "Generic Mobile"
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'askjeeves' => 'AskJeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos'
);
/* End of file user_agents.php */
/* Location: ./application/config/user_agents.php */ | 101-code | application/config/user_agents.php | PHP | gpl3 | 5,589 |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->latest() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH . 'migrations/';
/* End of file migration.php */
/* Location: ./application/config/migration.php */ | 101-code | application/config/migration.php | PHP | gpl3 | 1,322 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/hooks.html
|
*/
/* $hook['pre_system'] = array(
'class' => 'Pre_system',
'function' => 'install_check',
'filename' => 'Pre_system.php',
'filepath' => 'hooks'
); */
$hook['post_controller'] = array(
'class' => 'assets/Single_query',
'function' => 'process',
'filename' => 'Single_query.php',
'filepath' => 'assets'
);
/* End of file hooks.php */
/* Location: ./application/config/hooks.php */ | 101-code | application/config/hooks.php | PHP | gpl3 | 808 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Asset Manager Active
|--------------------------------------------------------------------------
|
| Turns the asset manager on or off. If off, the existing asset code will
| simply return the original location.
|
| Caution, if you're using get_asset_by_id(), all those assets will not be called in
|
*/
$config['active'] = TRUE;
/*
|--------------------------------------------------------------------------
| Asset Database Check
|--------------------------------------------------------------------------
|
| Checks the database to see if the asset exists before it calls the
| database for the source. If the asset doesn't exist, Asset Manager will
| create the asset in the database for you.
|
| Turn this off if you are completely sure that all your assets are in your
| asset database from actions within your content management system.
| Alternatively, turn this variable on then navigate to all the pages on
| your site which to populate the asset database
*/
$config['check_db'] = FALSE;
/*
|--------------------------------------------------------------------------
| Asset CDN Check
|--------------------------------------------------------------------------
|
| Checks if the asset exists in the CDN. Only use this if you have some
| lost assets and you want to re-check the CDN library. Navigate to the
| pages where the lost assets are and they'll get redeployed to the CDN
|
*/
$config['check_cdn'] = FALSE;
/*
|--------------------------------------------------------------------------
| Queue assets
|--------------------------------------------------------------------------
|
| Makes the asset manager queue the asset queue, or just process the assets
| immediately. Useful if you've got a big site and have enabled asset
| purge and you might have a shed load of assets to process. Don't forget
| to set up a cron job to run this!
|
*/
$config['queue'] = FALSE;
/*
|--------------------------------------------------------------------------
| Asset tables
|--------------------------------------------------------------------------
|
|
*/
$config['asset_table'] = 'assets';
$config['queue_table'] = 'assets_queue';
/*
|--------------------------------------------------------------------------
| CDN details
|--------------------------------------------------------------------------
|
| Set to false to turn off CDN completely.
|
| If you change this, you'll need to initiate a complete rebuild of your
| asset database, which could take some time on a bigger site.
|
*/
$config['cdn'] = FALSE;
$config['cdn_host'] = 'amazon';
$config['cdn_access_key'] = 'AKIAI7DVXOHNCQLGXAAQ';
$config['cdn_secret_key'] = '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';
$config['cdn_url'] = 'http://s3.amazonaws.com/';
/*
|--------------------------------------------------------------------------
| Default bucket
|--------------------------------------------------------------------------
|
| Leave as FALSE to use the domain name of this site as the bucket, or
| choose a default bucket name for yourself
*/
$config['cdn_bucket'] = FALSE;
/*
|--------------------------------------------------------------------------
| Disable bucket check
|--------------------------------------------------------------------------
|
| Once you're up and running, you can disable the bucket check to reduce
| traffic. All this does is lists the buckets, if your bucket isn't there
| it creates one for you
*/
$config['cdn_check_bucket'] = FALSE;
/*
|--------------------------------------------------------------------------
| Query type
|--------------------------------------------------------------------------
|
| If you want to improve performance (why wouldn't you?), leave this as single
| it will execute the asset procedure with a single DB query rather than
| a query for each asset. Otherwise, use multiple to make infividual calls
|
|
*/
$config['query'] = 'single';
/*
|--------------------------------------------------------------------------
| Base64 Limit
|--------------------------------------------------------------------------
|
| This will enable base64 translation of images to embed into the page.
| Set to FALSE to disable, or specify a size in KB.
|
*/
$config['base64_limit'] = 28;
/*
|--------------------------------------------------------------------------
| Compress Images
|--------------------------------------------------------------------------
|
| Set to false to ignore this, or put between 1-100 for image compression.
| 90 is best, but be careful not to put it too low.
|
*/
$config['compress_images'] = 90;
$config['queue_compress_images'] = TRUE;
/*
|--------------------------------------------------------------------------
| Minify resources
|--------------------------------------------------------------------------
|
| Minify javascript and CSS files
|
*/
$config['minify_js'] = TRUE;
$config['queue_minify_js'] = FALSE;
$config['minify_css'] = TRUE;
$config['queue_minify_css'] = FALSE;
/*
|--------------------------------------------------------------------------
| Combine resources
|--------------------------------------------------------------------------
|
| Combine the javascript and/or CSS. Create one file containing all the JS
| or CSS content.
|
*/
$config['combine_js'] = TRUE;
$config['combine_css'] = TRUE;
/*
|--------------------------------------------------------------------------
| Compress HTML output
|--------------------------------------------------------------------------
|
| Compress the HTML output using 'minify' or 'asset_manager' minification
|
*/
$config['minify_output'] = FALSE; | 101-code | application/config/asset_manager.php | PHP | gpl3 | 5,738 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
);
/* End of file doctypes.php */
/* Location: ./application/config/doctypes.php */ | 101-code | application/config/doctypes.php | PHP | gpl3 | 1,138 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple simileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
);
/* End of file smileys.php */
/* Location: ./application/config/smileys.php */ | 101-code | application/config/smileys.php | PHP | gpl3 | 3,295 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => 'application/x-photoshop',
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/x-download'),
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'php' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => 'application/x-javascript',
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'shtml' => 'text/html',
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json')
);
/* End of file mimes.php */
/* Location: ./application/config/mimes.php */
| 101-code | application/config/mimes.php | PHP | gpl3 | 4,401 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/* End of file constants.php */
/* Location: ./application/config/constants.php */ | 101-code | application/config/constants.php | PHP | gpl3 | 1,558 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database type. ie: mysql. Currently supported:
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Active Record class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['autoinit'] Whether or not to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '101code';
$db['default']['password'] = 'password';
$db['default']['database'] = '101code';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
/* End of file database.php */
/* Location: ./application/config/database.php */
| 101-code | application/config/database.php | PHP | gpl3 | 3,234 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Helper files
| 4. Custom config files
| 5. Language files
| 6. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packges
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
$autoload['libraries'] = array('database');
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('model1', 'model2');
|
*/
$autoload['model'] = array('base/base_model');
/* End of file autoload.php */
/* Location: ./application/config/autoload.php */
| 101-code | application/config/autoload.php | PHP | gpl3 | 3,116 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| http://codeigniter.com/user_guide/general/profiling.html
|
*/
/* End of file profiler.php */
/* Location: ./application/config/profiler.php */ | 101-code | application/config/profiler.php | PHP | gpl3 | 564 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/config/index.html | HTML | gpl3 | 114 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://101code.com';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = TRUE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs. When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info.
|
*/
$config['encryption_key'] = 'interestingkey';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_cookie_name' = the name you want for the cookie
| 'sess_expiration' = the number of SECONDS you want the session to last.
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
| when the browser window is closed
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
| 'sess_use_database' = Whether to save the session data to a database
| 'sess_table_name' = The name of the session database table
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
*/
$config['sess_cookie_name'] = '101_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = TRUE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = TRUE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or 'gmt'. This pref tells the system whether to use
| your server's local time as the master 'now' reference, or convert it to
| GMT. See the 'date helper' page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
/* End of file config.php */
/* Location: ./application/config/config.php */
| 101-code | application/config/config.php | PHP | gpl3 | 12,827 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 101-code | application/index.html | HTML | gpl3 | 114 |
<?php
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*
*/
define('ENVIRONMENT', 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
/*
*---------------------------------------------------------------
* SYSTEM FOLDER NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" folder.
* Include the path if the folder is not in the same directory
* as this file.
*
*/
$system_path = 'system';
/*
*---------------------------------------------------------------
* APPLICATION FOLDER NAME
*---------------------------------------------------------------
*
* If you want this front controller to use a different "application"
* folder then the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path. For more info please see the user guide:
* http://codeigniter.com/user_guide/general/managing_apps.html
*
* NO TRAILING SLASH!
*
*/
$application_folder = 'application';
/*
* --------------------------------------------------------------------
* DEFAULT CONTROLLER
* --------------------------------------------------------------------
*
* Normally you will set your default controller in the routes.php file.
* You can, however, force a custom routing by hard-coding a
* specific controller class/function here. For most applications, you
* WILL NOT set your routing here, but it's an option for those
* special instances where you might want to override the standard
* routing in a specific front controller that shares a common CI installation.
*
* IMPORTANT: If you set the routing here, NO OTHER controller will be
* callable. In essence, this preference limits your application to ONE
* specific controller. Leave the function name blank if you need
* to call functions dynamically via the URI.
*
* Un-comment the $routing array below to use this feature
*
*/
// The directory name, relative to the "controllers" folder. Leave blank
// if your controller is not in a sub-folder within the "controllers" folder
// $routing['directory'] = '';
// The controller class file name. Example: Mycontroller
// $routing['controller'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
/*
* -------------------------------------------------------------------
* CUSTOM CONFIG VALUES
* -------------------------------------------------------------------
*
* The $assign_to_config array below will be passed dynamically to the
* config class when initialized. This allows you to set custom config
* items or override any default config values found in the config.php file.
* This can be handy as it permits you to share one application between
* multiple front controller files, with each file containing different
* config values.
*
* Un-comment the $assign_to_config array below to use this feature
*
*/
// $assign_to_config['name_of_config_item'] = 'value of config item';
// --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
/*
* ---------------------------------------------------------------
* Resolve the system path for increased reliability
* ---------------------------------------------------------------
*/
// Set the current directory correctly for CLI requests
if (defined('STDIN'))
{
chdir(dirname(__FILE__));
}
if (realpath($system_path) !== FALSE)
{
$system_path = realpath($system_path).'/';
}
// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';
// Is the system path correct?
if ( ! is_dir($system_path))
{
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// The PHP file extension
// this global constant is deprecated.
define('EXT', '.php');
// Path to the system folder
define('BASEPATH', str_replace("\\", "/", $system_path));
// Path to the front controller (this file)
define('FCPATH', str_replace(SELF, '', __FILE__));
// Name of the "system folder"
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
// The path to the "application" folder
if (is_dir($application_folder))
{
define('APPPATH', $application_folder.'/');
}
else
{
if ( ! is_dir(BASEPATH.$application_folder.'/'))
{
exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
}
define('APPPATH', BASEPATH.$application_folder.'/');
}
/*
* --------------------------------------------------------------------
* LOAD THE BOOTSTRAP FILE
* --------------------------------------------------------------------
*
* And away we go...
*
*/
require_once BASEPATH.'core/CodeIgniter.php';
/* End of file index.php */
/* Location: ./index.php */
| 101-code | index.php | PHP | gpl3 | 6,356 |
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
{\fonttbl\f0\fswiss\fcharset0 ArialMT;\f1\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{decimal\}.}{\leveltext\leveltemplateid1\'02\'00.;}{\levelnumbers\'01;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
\margl1440\margr1440\vieww13120\viewh13480\viewkind0
\deftab720
\pard\tx560\pardeftab720\ql\qnatural
\f0\b\fs24 \cf0 Drawing Order:\
\b0 \
\pard\tx220\tx720\pardeftab720\li720\fi-720\ql\qnatural
\ls1\ilvl0\cf0 {\listtext 1. }Background fill\
\pard\tx220\tx720\pardeftab720\li720\fi-720\ql\qnatural
\ls1\ilvl0\cf0 {\listtext 2. }Even/odd background fills\
{\listtext 3. }Arbitrary background fill ranges\
\pard\tx220\tx720\pardeftab720\li720\fi-720\ql\qnatural
\ls1\ilvl0\cf0 {\listtext 4. }Minor grid lines \
{\listtext 5. }Major grid lines\
{\listtext 6. }Background border\
{\listtext 7. }Minor tick marks\
{\listtext 8. }Major tick marks\
{\listtext 9. }Axis lines\
{\listtext 10. }Plots\
{\listtext 11. }Axis labels\
{\listtext 12. }Axis titles\
\pard\tx560\pardeftab720\ql\qnatural
\cf0 \
\b Layers:\
\b0 \
\pard\tx560\pardeftab720\ql\qnatural
\f1 \cf0 CPGraph (1)\
|--CPPlotAreaFrame (*)\
|--CPPlotArea (1) \{1, 2, 3\}\
|--CPGridLineGroup (1) [minor grid lines]\
| |-CPGridLines (*) \{4\}\
|--CPGridLineGroup (1) [major grid lines]\
| |-CPGridLines (*) \{5\}\
|--CPAxisSet (1) \{6\}\
| |-CPAxis (*) \{7, 8, 9\}\
|--CPPlotGroup (1)\
| |-CPPlot (*) \{10\}\
|--CPLayer (1) [axis labels]\
| |-CPAxisLabel (content layers) (*) \{11\}\
|--CPLayer (1) [axis titles]\
|-CPAxisTitle (content layers) (*) \{12\}\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\ql\qnatural\pardirnatural
\f0\b \cf0 Key:\
\b0 \
(1) Zero or one layer of this type\
(*) Zero or more layers of this type\
\{n\} n is the element drawn by the indicated layer\
} | 08iteng-ipad | documentation/Drawing order.rtf | Rich Text Format | bsd | 2,291 |
#!/usr/bin/env python
from os import mkdir, makedirs, environ, chdir, getcwd, system, listdir
from os.path import join
from shutil import copy, copytree, move, rmtree
# Usage
def Usage():
return 'Usage: createversion.py <version>'
# Run Xcode
def RunXcode(project, target):
system('/usr/bin/xcodebuild -project "%s" -target "%s" -configuration Release clean build' % (project, target))
# Get version from args
import sys
if len(sys.argv) <= 1:
print Usage()
exit(1)
version = sys.argv[1]
# Change to root dir of Core Plot
chdir('..')
projectRoot = getcwd()
# Remove old docset files
frameworkDir = join(projectRoot, 'framework')
rmtree(join(frameworkDir, 'CorePlotDocs.docset'), True)
rmtree(join(frameworkDir, 'CorePlotTouchDocs.docset'), True)
# Remove old build directories
rmtree(join(frameworkDir, 'build'), True)
examples = listdir('examples')
for ex in examples:
exampleDir = join('examples', ex)
rmtree(join(exampleDir, 'build'), True)
# Make directory bundle
desktopDir = join(environ['HOME'], 'Desktop')
releaseRootDir = join(desktopDir, 'CorePlot_' + version)
mkdir(releaseRootDir)
# Copy license and READMEs
copy('License.txt', releaseRootDir)
copytree('READMEs', join(releaseRootDir, 'READMEs'))
# Add source code
sourceDir = join(releaseRootDir, 'Source')
copytree('framework', join(sourceDir, 'framework'))
copytree('examples', join(sourceDir, 'examples'))
copy('License.txt', sourceDir)
# Binaries
binariesDir = join(releaseRootDir, 'Binaries')
macosDir = join(binariesDir, 'MacOS')
iosDir = join(binariesDir, 'iOS')
makedirs(macosDir)
mkdir(iosDir)
# Build Mac Framework
chdir('framework')
RunXcode('CorePlot.xcodeproj', 'CorePlot')
macProductsDir = join(projectRoot, 'build/Release')
macFramework = join(macProductsDir, 'CorePlot.framework')
copytree(macFramework, join(macosDir, 'CorePlot.framework'))
# Build iOS SDK
RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Build SDK')
sdkZipFile = join(desktopDir, 'CorePlot.zip')
move(sdkZipFile, iosDir)
# Build Docs
RunXcode('CorePlot.xcodeproj', 'Documentation')
RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Documentation')
# Copy Docs
docDir = join(releaseRootDir, 'Documentation')
copytree(join(projectRoot, 'documentation'), docDir)
homeDir = environ['HOME']
docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets')
copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset'))
copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset'))
| 08iteng-ipad | scripts/createrelease.py | Python | bsd | 2,564 |
//
// TMMergeControllerTests.h
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "GTMSenTestCase.h"
@interface TMMergeControllerTests : GTMTestCase {
}
@end
| 08iteng-ipad | TestMerge/TMMergeControllerTests.h | Objective-C | bsd | 243 |
//
// TMSelectableView.m
// TestMerge
//
// Created by Barry Wark on 6/5/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "TMSelectableView.h"
#import "GTMDefines.h"
static CGFloat SelectionLineWidth = 2.0;
@implementation TMSelectableView
@synthesize selected;
@synthesize drawsBackground;
+ (NSArray*)exposedBindings {
return [NSArray arrayWithObjects:@"selected",@"drawsBackground",nil];
}
- (Class)valueClassForBinding:(NSString*)binding {
if([binding isEqualToString:@"selected"] ||
[binding isEqualToString:@"drawsBackground"]) {
return [NSValue class];
}
return [super valueClassForBinding:binding];
}
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
selected = NO;
drawsBackground = YES;
}
return self;
}
- (void)awakeFromNib {
NSRect subFrame = NSInsetRect(self.bounds, SelectionLineWidth, SelectionLineWidth);
for(NSView *sub in [self subviews]) {
[sub setFrame:NSOffsetRect(subFrame, -subFrame.origin.x + SelectionLineWidth, -subFrame.origin.y+SelectionLineWidth)];
}
}
- (void)addSubview:(NSView*)subView {
NSRect bounds = NSInsetRect(self.bounds, SelectionLineWidth, SelectionLineWidth);
[subView setFrame:NSOffsetRect(bounds, -bounds.origin.x + SelectionLineWidth, -bounds.origin.y+SelectionLineWidth)];
[super addSubview:subView];
}
- (void)drawRect:(NSRect)rect {
if(self.drawsBackground) {
[[NSColor grayColor] set];
[NSBezierPath fillRect:self.bounds];
}
if(self.selected) {
NSRect strokeRect = NSInsetRect(self.bounds, SelectionLineWidth/2, SelectionLineWidth/2);
NSBezierPath *strokePath = [NSBezierPath bezierPathWithRect:strokeRect];
[strokePath setLineWidth:SelectionLineWidth];
[strokePath setLineJoinStyle:NSMiterLineJoinStyle];
[strokePath setLineCapStyle:NSRoundLineCapStyle];
[[NSColor selectedControlColor] set];
[strokePath stroke];
}
}
- (void)setSelected:(BOOL)newSelected {
if(newSelected != self.selected) {
_GTMDevLog(@"%@ selected = %@", self, self.selected?@"YES":@"NO");
selected = newSelected;
[self setNeedsDisplay:YES];
}
}
- (void)setDrawsBackground:(BOOL)draw {
if(draw != self.drawsBackground) {
drawsBackground = draw;
[self setNeedsDisplay:YES];
}
}
- (void)mouseDown:(NSEvent*)theEvent {
if(!self.selected) self.selected = YES;
[super mouseDown:theEvent];
}
@end
| 08iteng-ipad | TestMerge/TMSelectableView.m | Objective-C | bsd | 2,596 |
//
// TMImageViewTests.h
// TestMerge
//
// Created by Barry Wark on 5/28/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "GTMSenTestCase.h"
#import "TMImageView.h"
@interface TMImageViewTests : GTMTestCase <TMImageViewDelegate> {
TMImageView *imageView;
BOOL flag;
}
@property (retain,readwrite) TMImageView *imageView;
@property (assign,readwrite) BOOL flag;
- (void)mouseDownInImageView:(TMImageView*)view;
@end
| 08iteng-ipad | TestMerge/TMImageViewTests.h | Objective-C | bsd | 467 |
//
// TMOutputGroupCDFactoryTests.h
// TestMerge
//
// Created by Barry Wark on 6/3/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "GTMSenTestCase.h"
@interface TMOutputGroupCDFactoryTests : GTMTestCase {
NSManagedObjectContext *moc;
}
@property (retain,readwrite) NSManagedObjectContext *moc;
@end
| 08iteng-ipad | TestMerge/TMOutputGroupCDFactoryTests.h | Objective-C | bsd | 344 |
//
// TMCompareController.h
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
typedef enum {
ReferenceChoice = NO,
OutputChoice = YES,
NeitherChoice = -1,
} TMCompareControllerChoice;
@class TMSelectableView;
@interface TMCompareController : NSViewController {
IBOutlet TMSelectableView *referenceSelectionView;
IBOutlet TMSelectableView *outputSelectionView;
}
@property (retain,readwrite) IBOutlet TMSelectableView *referenceSelectionView;
@property (retain,readwrite) IBOutlet TMSelectableView *outputSelectionView;
- (void)setMergeChoice:(TMCompareControllerChoice)choice;
@end
| 08iteng-ipad | TestMerge/TMCompareController.h | Objective-C | bsd | 706 |
//
// TMMergeControllerTests.m
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "TMMergeControllerTests.h"
#import "TMMergeController.h"
#import "TMImageCompareController.h"
#import "TMUTStateCompareController.h"
#import "TMOutputGroup.h"
#import "OutputGroup.h"
#import "TMOutputSorter.h"
#import "GTMNSObject+UnitTesting.h"
#import "GTMNSObject+BindingUnitTesting.h"
@interface OutputGroup (UnitTesting)
- (NSDictionary*)tm_unitTestState;
@end
@implementation OutputGroup (UnitTesting)
- (NSDictionary*)tm_unitTestState {
return [self dictionaryWithValuesForKeys:[[[self entity] attributesByName] allKeys]];
}
@end
@interface TMMergeController (UnitTesting)
-(void)gtm_unitTestEncodeState:(NSCoder*)coder;
@end
@implementation TMMergeController (UnitTesting)
-(void)gtm_unitTestEncodeState:(NSCoder*)coder {
[super gtm_unitTestEncodeState:coder];
_GTMDevAssert([coder allowsKeyedCoding], @"");
_GTMDevLog(@"encoding TMMergeController");
[coder encodeObject:self.referencePath forKey:@"referencePath"];
[coder encodeObject:self.outputPath forKey:@"outputPath"];
[coder encodeObject:[[self outputGroups] valueForKeyPath:@"tm_unitTestState"] forKey:@"outputGroups"];
}
@end
@implementation TMMergeControllerTests
- (void)testWindowUIRendering {
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
controller.referencePath = @"/System/Library";
controller.outputPath = @"/Library";
(void)[controller window];
GTMAssertObjectImageEqualToImageNamed(controller.window, @"TMMergeControllerTests-testWindowUIRendering", @"");
}
- (void)testOutputGroupsSortsReferenceAndOutputFilesForOSX {
NSString *groupTestRoot = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"OutputGroupTest"];
BOOL dir;
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:groupTestRoot isDirectory:&dir] && dir, @"");
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
controller.referencePath = [groupTestRoot stringByAppendingPathComponent:@"Reference"];
controller.outputPath = [groupTestRoot stringByAppendingPathComponent:@"Output"];
(void)[controller window];
STAssertTrue(controller.outputGroups.count > 0, @"");
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testOutputGroupsSortsReferenceAndOutputFiles", @"");
}
- (void)testOutputGroupsSortsReferenceAndOutputFilesForIPhone {
NSString *groupTestRoot = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"IPhoneOutputGroupTest"];
BOOL dir;
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:groupTestRoot isDirectory:&dir] && dir, @"");
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
controller.referencePath = [groupTestRoot stringByAppendingPathComponent:@"Reference"];
controller.outputPath = [groupTestRoot stringByAppendingPathComponent:@"Output"];
(void)[controller window];
STAssertTrue(controller.outputGroups.count > 0, @"");
}
- (void)testSelectsAndRendersImageCompareController {
NSString *groupTestRoot = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"OutputGroupTest"];
BOOL dir;
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:groupTestRoot isDirectory:&dir] && dir, @"");
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
controller.referencePath = [groupTestRoot stringByAppendingPathComponent:@"Reference"];
controller.outputPath = [groupTestRoot stringByAppendingPathComponent:@"Output"];
controller.compareControllersByExtension = [NSDictionary dictionaryWithObjectsAndKeys:
[[TMImageCompareController alloc] initWithNibName:@"ImageCompareView" bundle:[NSBundle mainBundle]],
TMGTMUnitTestImageExtension,
[[TMUTStateCompareController alloc] initWithNibName:@"UTStateCompareView" bundle:[NSBundle mainBundle]],
TMGTMUnitTestStateExtension,
nil];
(void)[controller window];
STAssertTrue(controller.outputGroups.count > 0, @"");
id<TMOutputGroup> group = [[[controller outputGroups] filteredSetUsingPredicate:[NSPredicate predicateWithFormat:@"extension LIKE 'tiff'"]] anyObject];
STAssertNotNil(group, @"");
[controller.groupsController setSelectedObjects:[NSArray arrayWithObject:group]];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersImageCompareController", @"");
[group setReplaceReferenceValue:YES];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersImageCompareController+ReplaceReference", @"");
[group setReplaceReferenceValue:NO];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersImageCompareController+DoNotReplaceReference", @"");
[group setReplaceReference:nil];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersImageCompareController+NilReplaceReference", @"");
}
- (void)testSelectsAndRendersUTStateCompareController {
NSString *groupTestRoot = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"OutputGroupTest"];
BOOL dir;
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:groupTestRoot isDirectory:&dir] && dir, @"");
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
controller.referencePath = [groupTestRoot stringByAppendingPathComponent:@"Reference"];
controller.outputPath = [groupTestRoot stringByAppendingPathComponent:@"Output"];
controller.compareControllersByExtension = [NSDictionary dictionaryWithObjectsAndKeys:
[[TMImageCompareController alloc] initWithNibName:@"ImageCompareView" bundle:[NSBundle mainBundle]],
TMGTMUnitTestImageExtension,
[[TMUTStateCompareController alloc] initWithNibName:@"UTStateCompareView" bundle:[NSBundle mainBundle]],
TMGTMUnitTestStateExtension,
nil];
(void)[controller window];
STAssertTrue(controller.outputGroups.count > 0, @"");
_GTMDevLog(@"%@", [[controller outputGroups] filteredSetUsingPredicate:[NSPredicate predicateWithFormat:@"extension LIKE 'gtmUTState'"]]);
id<TMOutputGroup> group = [[[controller outputGroups] filteredSetUsingPredicate:[NSPredicate predicateWithFormat:@"extension LIKE 'gtmUTState'"]] anyObject];
STAssertNotNil(group, @"");
[controller.groupsController setSelectedObjects:[NSArray arrayWithObject:group]];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersUTStateCompareController", @"");
[group setReplaceReferenceValue:YES];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersUTStateCompareController+ReplaceReference", @"");
[group setReplaceReferenceValue:NO];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersUTStateCompareController+DoNotReplaceReference", @"");
[group setReplaceReference:nil];
GTMAssertObjectEqualToStateAndImageNamed(controller.window, @"TMMergeControllerTests-testSelectsAndRendersUTStateCompareController+NilReplaceReference", @"");
}
- (void)testUnitTestOutputPathsFromPath {
NSString *groupTestRoot = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"OutputGroupTest"];
BOOL dir;
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:groupTestRoot isDirectory:&dir] && dir, @"");
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
controller.referencePath = [groupTestRoot stringByAppendingPathComponent:@"Reference"];
controller.outputPath = [groupTestRoot stringByAppendingPathComponent:@"Output"];
NSArray *expectedPaths = [[NSArray arrayWithObjects:
[[controller referencePath] stringByAppendingPathComponent:@"TMMergeControllerTests-testWindowUIRendering.tiff"],
[[controller referencePath] stringByAppendingPathComponent:@"CPXYGraphTests-testRenderScatterWithSymbol.i386.tiff"],
nil]
sortedArrayUsingSelector:@selector(compare:)];
STAssertEqualObjects([controller gtmUnitTestOutputPathsFromPath:controller.referencePath], expectedPaths, @"");
NSArray *controllerPaths = [[controller gtmUnitTestOutputPathsFromPath:controller.outputPath] sortedArrayUsingSelector:@selector(compare:)];
expectedPaths = [[NSArray arrayWithObjects:
[[controller outputPath] stringByAppendingPathComponent:@"TMMergeControllerTests-testWindowUIRendering_Failed.i386.10.5.7.tiff"],
[[controller outputPath] stringByAppendingPathComponent:@"TMMergeControllerTests-testWindowUIRendering_Failed_Diff.i386.10.5.7.tiff"],
[[controller outputPath] stringByAppendingPathComponent:@"CPXYGraphTests-testRenderScatterWithSymbol_Failed.i386.10.5.7.tiff"],
[[controller outputPath] stringByAppendingPathComponent:@"CPXYGraphTests-testRenderScatterWithSymbol_Failed_Diff.i386.10.5.7.tiff"],
[[controller outputPath] stringByAppendingPathComponent:@"TMMergeControllerTests-testWindowUIRendering2.i386.10.5.7.tiff"],
nil] sortedArrayUsingSelector:@selector(compare:)];
STAssertEqualObjects(controllerPaths, expectedPaths, @"");
}
- (void)testGroupFilterPredicate {
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
STAssertEqualObjects(controller.groupFilterPredicate, [NSPredicate predicateWithFormat:@"outputPath != nil"], @"");
}
- (void)testPSCCreation {
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
(void)[controller window];
STAssertNotNil(controller.managedObjectContext, @"");
STAssertTrue(controller.managedObjectContext.persistentStoreCoordinator.persistentStores.count > 0, @"");
}
- (void)testBindings {
TMMergeController *controller = [[[TMMergeController alloc] initWithWindowNibName:@"MergeUI"] autorelease];
(void)[controller window];
GTMDoExposedBindingsFunctionCorrectly(controller, nil);
}
- (void)testCommitMerge {
NSString *outpuDirPath = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"OutputGroupTest"];
BOOL dir;
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:outpuDirPath isDirectory:&dir] && dir, @"");
NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"OutputGroupTest"];
NSError *err;
if([[NSFileManager defaultManager] fileExistsAtPath:targetPath]) {
STAssertTrue([[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL], @"");
}
STAssertTrue([[NSFileManager defaultManager] copyItemAtPath:outpuDirPath toPath:targetPath error:&err], @"%@", err);
@try {
TMMergeController *controller = [[TMMergeController alloc] initWithWindowNibName:@"MergeUI"];
(void)[controller window];
controller.referencePath = [targetPath stringByAppendingPathComponent:@"Reference"];
controller.outputPath = [targetPath stringByAppendingPathComponent:@"Output"];
NSSet *groups = [controller outputGroups];
for(OutputGroup *group in groups) {
if([group.name hasPrefix:@"TM"]) {
[group setReplaceReferenceValue:YES];
}
}
_GTMDevLog(@"groups: %@", groups);
[controller commitMerge:self];
//test that only CP* in Output
for(NSString *path in [[NSFileManager defaultManager] enumeratorAtPath:[targetPath stringByAppendingPathComponent:@"Output"]]) {
STAssertTrue([[[path pathComponents] lastObject] hasPrefix:@"CP"], @"Non-TM in reference");
}
STAssertEquals([[[NSFileManager defaultManager] directoryContentsAtPath:[targetPath stringByAppendingPathComponent:@"Reference"]] count], (NSUInteger)4, @"Including added new TM image: %@", [[NSFileManager defaultManager] directoryContentsAtPath:[targetPath stringByAppendingPathComponent:@"Reference"]]);
STAssertEquals([[[NSFileManager defaultManager] directoryContentsAtPath:[targetPath stringByAppendingPathComponent:@"Output"]] count], (NSUInteger)2, @"Removing _Diff, and new TM image: %@", [[NSFileManager defaultManager] directoryContentsAtPath:[targetPath stringByAppendingPathComponent:@"Output"]]);
}
@finally {
STAssertTrue([[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL], @"");
}
}
@end
| 08iteng-ipad | TestMerge/TMMergeControllerTests.m | Objective-C | bsd | 14,092 |
//
// TMOutputSorter.h
// TestMerge
//
// Created by Barry Wark on 5/18/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "TMOutputGroupFactory.h"
extern NSString * const TMGTMUnitTestStateExtension;
extern NSString * const TMGTMUnitTestImageExtension;
@interface TMOutputSorter : NSObject {
NSArray *referencePaths;
NSArray *outputPaths;
}
@property (copy,readwrite) NSArray *referencePaths;
@property (copy,readwrite) NSArray *outputPaths;
- (id)initWithReferencePaths:(NSArray*)ref
outputPaths:(NSArray*)output;
- (NSSet*)sortedOutputWithGroupFactory:(id<TMOutputGroupFactory>)factory error:(NSError**)error;
@end
| 08iteng-ipad | TestMerge/TMOutputSorter.h | Objective-C | bsd | 704 |
//
// TMImageCompareController.h
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
#import "TMCompareController.h"
#import "TMImageView.h"
@interface TMImageCompareController : TMCompareController <TMImageViewDelegate> {
IBOutlet TMImageView *refImageView;
IBOutlet TMImageView *outputImageView;
}
@property (retain,readwrite) IBOutlet TMImageView *refImageView;
@property (retain,readwrite) IBOutlet TMImageView *outputImageView;
@end
| 08iteng-ipad | TestMerge/TMImageCompareController.h | Objective-C | bsd | 573 |
//
// TestMerge_AppDelegate.h
// TestMerge
//
// Created by Barry Wark on 5/18/09.
// Copyright Barry Wark 2009 . All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class TMMergeController;
@interface AppDelegate : NSObject
{
NSPersistentStoreCoordinator *persistentStoreCoordinator;
NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;
TMMergeController *mergeController;
}
@property (retain,readonly) TMMergeController * mergeController;
@end
| 08iteng-ipad | TestMerge/AppDelegate.h | Objective-C | bsd | 509 |
//
// TMOutputGroup.h
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@protocol TMOutputGroup
@property (retain) NSDate * date;
@property (retain) NSString * extension;
@property (retain) NSString * failureDiffPath;
@property (retain) NSString * name;
@property (retain) NSString * outputPath;
@property (readonly) NSString * referencePath;
@property (retain) NSNumber *replaceReference;
@property (assign) BOOL replaceReferenceValue;
- (void)addReferencePathsObject:(NSString*)path;
@end
| 08iteng-ipad | TestMerge/TMOutputGroup.h | Objective-C | bsd | 593 |
//
// TMCompareController.m
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "TMCompareController.h"
#import "TMOutputGroup.h"
#import "GTMDefines.h"
@interface TMCompareController ()
- (void)setupBindings;
@end
@implementation TMCompareController
@synthesize referenceSelectionView;
@synthesize outputSelectionView;
- (void)setView:(NSView*)view {
[super setView:view];
[self performSelector:@selector(setupBindings) withObject:nil afterDelay:0.1];
}
- (void)setupBindings {
_GTMDevLog(@"TMCompareController binding selection views (%@ & %@).", self.referenceSelectionView, self.outputSelectionView);
[[self referenceSelectionView] bind:@"selected"
toObject:self
withKeyPath:@"representedObject.replaceReference"
options:[NSDictionary dictionaryWithObjectsAndKeys:
NSNegateBooleanTransformerName, NSValueTransformerNameBindingOption,
[NSNumber numberWithBool:NO], NSNullPlaceholderBindingOption,
nil
]];
[[self outputSelectionView] bind:@"selected"
toObject:self
withKeyPath:@"representedObject.replaceReference"
options:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], NSNullPlaceholderBindingOption,
nil
]];
}
- (void)setMergeChoice:(TMCompareControllerChoice)choice {
switch (choice) {
case OutputChoice:
case ReferenceChoice:
[(id<TMOutputGroup>)[self representedObject] setReplaceReferenceValue:choice];
break;
case NeitherChoice:
[(id<TMOutputGroup>)[self representedObject] setReplaceReference:nil];
break;
}
}
@end
| 08iteng-ipad | TestMerge/TMCompareController.m | Objective-C | bsd | 2,126 |
//
// main.m
// TestMerge
//
// Created by Barry Wark on 5/18/09.
// Copyright Barry Wark 2009. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "GTMUnitTestingUtilities.h"
int main(int argc, char *argv[])
{
[GTMUnitTestingUtilities setUpForUIUnitTestsIfBeingTested];
return NSApplicationMain(argc, (const char **) argv);
}
| 08iteng-ipad | TestMerge/main.m | Objective-C | bsd | 351 |
//
// TMSelectableViewTest.h
// TestMerge
//
// Created by Barry Wark on 6/5/09.
// Copyright 2009 Barry Wark. All rights reserved.
//
#import "GTMSenTestCase.h"
@interface TMSelectableViewTest : GTMTestCase {
}
@end
| 08iteng-ipad | TestMerge/TMSelectableViewTest.h | Objective-C | bsd | 226 |
//
// TMOutputFactory.h
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "TMOutputGroup.h"
@protocol TMOutputGroupFactory <NSObject>
/**
id<TMOutputGroup> with given name and extension. If such a group already exists,
it is returned. Otherwise a new group is created.
@return Autoreleased id<TMOutputGroup> with given name and extension.
*/
- (id<TMOutputGroup>)groupWithName:(NSString*)name extension:(NSString*)extension;
@end
| 08iteng-ipad | TestMerge/TMOutputGroupFactory.h | Objective-C | bsd | 522 |
//
// TMImageCompareControllerTests.h
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "GTMSenTestCase.h"
@class TMImageCompareController;
@interface TMImageCompareControllerTests : GTMTestCase {
TMImageCompareController *controller;
}
@property (retain,readwrite) TMImageCompareController *controller;
@end
| 08iteng-ipad | TestMerge/TMImageCompareControllerTests.h | Objective-C | bsd | 398 |
//
// TMImageCompareController.m
// TestMerge
//
// Created by Barry Wark on 5/27/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "TMImageCompareController.h"
#import "TMOutputGroup.h"
#import "GTMDefines.h"
@interface TMImageCompareController ()
- (void)updateImageViews;
@end
@implementation TMImageCompareController
@synthesize refImageView;
@synthesize outputImageView;
- (void)dealloc {
[refImageView release];
[outputImageView release];
[super dealloc];
}
- (void)setView:(NSView*)view {
[super setView:view];
[[IKImageEditPanel sharedImageEditPanel] setHidesOnDeactivate:YES];
[self updateImageViews];
}
- (void)updateImageViews {
if([[self representedObject] referencePath] != nil) {
[[self refImageView] setImageWithURL:[NSURL fileURLWithPath:[[self representedObject] referencePath]]];
} else {
[[self refImageView] setImageWithURL:nil];
}
if([[self representedObject] outputPath] != nil) {
[[self outputImageView] setImageWithURL:[NSURL fileURLWithPath:[[self representedObject] outputPath]]];
} else {
[[self outputImageView] setImageWithURL:nil];
}
if([[self representedObject] failureDiffPath] != nil) {
CALayer *diffLayer = [CALayer layer];
diffLayer.contents = (id)[[NSBitmapImageRep imageRepWithData:[NSData dataWithContentsOfFile:[[self representedObject] failureDiffPath]]] CGImage];
[[self outputImageView] setOverlay:diffLayer];
}
}
- (void)setRepresentedObject:(id)representedObject {
[super setRepresentedObject:representedObject];
[self updateImageViews];
}
- (void)mouseDownInImageView:(TMImageView*)view {
//_GTMDevLog(@"Mouse down in %@", view);
if(view == self.refImageView) {
[(id<TMOutputGroup>)[self representedObject] setReplaceReferenceValue:NO];
} else if(view == self.outputImageView) {
[(id<TMOutputGroup>)[self representedObject] setReplaceReferenceValue:YES];
}
//_GTMDevLog(@"OutputGroup: %@", [self representedObject]);
}
@end
| 08iteng-ipad | TestMerge/TMImageCompareController.m | Objective-C | bsd | 2,132 |
//
// TMSelectableView.h
// TestMerge
//
// Created by Barry Wark on 6/5/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface TMSelectableView : NSView {
BOOL selected;
BOOL drawsBackground;
}
@property (readwrite,assign,nonatomic) BOOL selected;
@property (readwrite,assign,nonatomic) BOOL drawsBackground;
@end
| 08iteng-ipad | TestMerge/TMSelectableView.h | Objective-C | bsd | 382 |
//
// TMOutputGroupCDFactory.h
// TestMerge
//
// Created by Barry Wark on 5/18/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "TMOutputGroupFactory.h"
extern NSString * const TMOutputGroupCDFactoryTooManyGroupsException;
/**
Implementation of the TMOutputGroupFactory protocol that builds output groups
as Core Data OutputGroup instances.
*/
@interface TMOutputGroupCDFactory : NSObject <TMOutputGroupFactory> {
NSManagedObjectContext *context;
}
@property (retain,readwrite) NSManagedObjectContext *context;
- (id)initWithManagedObjectContext:(NSManagedObjectContext*)moc;
@end
| 08iteng-ipad | TestMerge/TMOutputGroupCDFactory.h | Objective-C | bsd | 654 |
//
// TMMergeController.m
// TestMerge
//
// Created by Barry Wark on 5/18/09.
// Copyright 2009 Physion Consulting LLC. All rights reserved.
//
#import "TMMergeController.h"
#import "TMOutputGroupCDFactory.h"
#import "TMOutputSorter.h"
#import "TMErrors.h"
#import "TMCompareController.h"
#import "TMImageCompareController.h"
#import "TMOutputGroup.h"
#import "GTMDefines.h"
#import "GTMGarbageCollection.h"
#import "GTMNSObject+KeyValueObserving.h"
NSString * const TMMergeControllerDidCommitMerge = @"TMMergeControllerDidCommitMerge";
@interface TMMergeController ()
@property (retain,readwrite) TMCompareController *currentCompareController;
- (void)commitMergeForGroups:(NSSet*)groups;
- (void)updateMergeViewForGroup:(id<TMOutputGroup>)newGroup;
@end
@implementation TMMergeController
@synthesize referencePath;
@synthesize outputPath;
@dynamic outputGroups;
@dynamic groupFilterPredicate;
@dynamic groupSortDescriptors;
@synthesize managedObjectContext;
@synthesize groupsController;
@synthesize mergeViewContainer;
@synthesize compareControllersByExtension;
@synthesize currentCompareController;
@synthesize groupSelectionIndexes;
- (void)dealloc {
[referencePath release];
[outputPath release];
[managedObjectContext release];
[groupsController release];
[mergeViewContainer release];
[compareControllersByExtension release];
[currentCompareController release];
[super dealloc];
}
+ (void)initialize {
if(self == [TMMergeController class]) {
[self exposeBinding:@"outputGroups"];
[self exposeBinding:@"referencePath"];
[self exposeBinding:@"outputPath"];
}
}
+ (NSSet*)keyPathsForValuesAffectingOutputGroups {
return [NSSet setWithObjects:@"referencePath",
@"outputPath",
@"managedObjectContext",
nil
];
}
- (NSSet*)outputGroups {
TMOutputGroupCDFactory *factory = [[TMOutputGroupCDFactory alloc] initWithManagedObjectContext:self.managedObjectContext];
NSArray *referencePaths = [self gtmUnitTestOutputPathsFromPath:self.referencePath];
NSArray *outputPaths = [self gtmUnitTestOutputPathsFromPath:self.outputPath];
//quit if there's no new output
//if(outputPaths.count == 0) [NSApp terminate:self];
TMOutputSorter *sorter = [[[TMOutputSorter alloc] initWithReferencePaths:referencePaths
outputPaths:outputPaths]
autorelease];
NSError *err;
NSSet *result = [sorter sortedOutputWithGroupFactory:factory error:&err];
if(result == nil) {
[self presentError:err];
}
return result;
}
- (NSArray*)gtmUnitTestOutputPathsFromPath:(NSString*)path {
NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL];
NSMutableArray *result = [NSMutableArray arrayWithCapacity:contents.count];
// We can't get this information from GTMNSObject+UnitTesting b/c it is SenTestKit dependent, so we have to recreate gtm_imageUTI/gtm_imageExtension/gtm_stateExtension
CFStringRef imageUTI;
#if GTM_IPHONE_SDK
imageUTI = kUTTypePNG;
#else
// Currently can't use PNG on Leopard. (10.5.2)
// Radar:5844618 PNG importer/exporter in ImageIO is lossy
imageUTI = kUTTypeTIFF;
#endif
NSString *imageExtension;
#if GTM_IPHONE_SDK
if (CFEqual(imageU, kUTTypePNG)) {
imageExtension = @"png";
} else if (CFEqual(imageUTI, kUTTypeJPEG)) {
imageExtension = @"jpg";
} else {
_GTMDevAssert(NO, @"Illegal UTI for iPhone");
}
#else
imageExtension
= (NSString*)UTTypeCopyPreferredTagWithClass(imageUTI, kUTTagClassFilenameExtension);
_GTMDevAssert(imageExtension, @"No extension for uti: %@", imageUTI);
GTMCFAutorelease(imageExtension);
#endif
NSString *stateExtension = @"gtmUTState";
// Filter contents paths for image and state extensions
for(id filePath in contents) {
if([filePath hasSuffix:imageExtension] ||
[filePath hasSuffix:stateExtension]) {
[result addObject:[path stringByAppendingPathComponent:filePath]];
}
}
return result;
}
- (NSPredicate*)groupFilterPredicate {
return [NSPredicate predicateWithFormat:@"outputPath != nil"];
}
- (void)windowWillLoad {
NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObject:[NSBundle bundleForClass:[self class]]]]];
NSError *err;
if(![psc addPersistentStoreWithType:NSInMemoryStoreType
configuration:nil
URL:nil
options:nil
error:&err]) {
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
err, NSUnderlyingErrorKey,
NSLocalizedString(@"Unable to create an in-memory store for output groups", @"Unable to create an in-memory store for output groups"), NSLocalizedDescriptionKey,
nil
];
err = [NSError errorWithDomain:TMErrorDomain
code:TMCoreDataError
userInfo:userInfo];
[NSApp presentError:err];
}
self.managedObjectContext = [[NSManagedObjectContext alloc] init];
[self.managedObjectContext setPersistentStoreCoordinator:psc];
_GTMDevLog(@"TMMergeController created moc: %@", self.managedObjectContext);
}
- (void)windowDidLoad {
_GTMDevAssert([self groupsController] != nil, @"nil groups controller");
}
- (void)setGroupSelectionIndexes:(NSIndexSet*)newSelectionIndexes {
if(newSelectionIndexes != self.groupSelectionIndexes) {
[groupSelectionIndexes release];
groupSelectionIndexes = newSelectionIndexes;
_GTMDevAssert(self.groupSelectionIndexes.count <= 1, @"Multiple group selection");
if(self.groupSelectionIndexes.count > 0) {
[self updateMergeViewForGroup:[[[self groupsController] arrangedObjects] objectAtIndex:[[self groupSelectionIndexes] firstIndex]]];
} else {
[self updateMergeViewForGroup:nil];
}
}
}
- (void)updateMergeViewForGroup:(id<TMOutputGroup>)newGroup {
NSViewController *controller = [[self compareControllersByExtension] objectForKey:newGroup.extension];
self.currentCompareController = [[[controller class] alloc] initWithNibName:[controller nibName] bundle:[controller nibBundle]];
(void)[self.currentCompareController view];
[self.currentCompareController setRepresentedObject:newGroup];
[self.mergeViewContainer setContentView:self.currentCompareController.view];
}
- (NSArray*)groupSortDescriptors {
return [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]];
}
- (IBAction)commitMerge:(id)sender {
_GTMDevLog(@"TMMergeController commiting merge for output groups: %@", self.outputGroups);
[self commitMergeForGroups:self.outputGroups];
[[NSNotificationCenter defaultCenter] postNotificationName:TMMergeControllerDidCommitMerge object:self];
}
- (void)commitMergeForGroups:(NSSet*)groups {
NSError *err;
for(id<TMOutputGroup>group in groups) {
if(group.replaceReference == nil) continue; //skip groups with no user choice
if(group.replaceReferenceValue) { // move output -> reference
//delete reference if it exists
if(group.referencePath != nil) {
if(![[NSFileManager defaultManager] removeItemAtPath:group.referencePath
error:&err]) {
_GTMDevLog(@"Error removing old referencePath: %@", err);
[NSApp presentError:err]; // !!!:barry:20090603 TODO wrap error
}
}
//move outputs
NSString *newRefPath;
if(group.referencePath != nil) {
newRefPath = group.referencePath;
} else {
newRefPath = [[self.referencePath stringByAppendingPathComponent:group.name] stringByAppendingPathExtension:group.extension];
}
if(![[NSFileManager defaultManager] moveItemAtPath:group.outputPath
toPath:newRefPath
error:&err]) {
_GTMDevLog(@"Error moving outputPath to referencePath: %@", err);
[NSApp presentError:err]; // !!!:barry:20090603 TODO wrap error
}
} else { // keep reference, deleting output
//delete output
if(group.outputPath != nil) {
if(![[NSFileManager defaultManager] removeItemAtPath:group.outputPath error:&err]) {
_GTMDevLog(@"Erorr deleting outputPath: %@", err);
[NSApp presentError:err]; // !!!:barry:20090603 TODO wrap error
}
}
}
// in either case, we delete the _Failed_Diff, if present
if(group.failureDiffPath != nil) {
if(![[NSFileManager defaultManager] removeItemAtPath:group.failureDiffPath error:&err]) {
[NSApp presentError:err]; // !!!:barry:20090603 TODO wrap error
}
}
}
}
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem {
if([anItem action] == @selector(selectReference:)) {
return [[[self currentCompareController] representedObject] referencePath] != nil;
}
if([anItem action] == @selector(selectOutput:)) {
return [[[self currentCompareController] representedObject] outputPath] != nil;
}
if([anItem action] == @selector(selectMergeNone:)) return YES;
return NO;
}
- (IBAction)selectReference:(id)sender {
_GTMDevLog(@"User selected reference");
[self.currentCompareController setMergeChoice:ReferenceChoice];
}
- (IBAction)selectOutput:(id)sender {
_GTMDevLog(@"User selected output");
[self.currentCompareController setMergeChoice:OutputChoice];
}
- (IBAction)selectMergeNone:(id)sender {
_GTMDevLog(@"User selected merge none");
[self.currentCompareController setMergeChoice:NeitherChoice];
}
@end
| 08iteng-ipad | TestMerge/TMMergeController.m | Objective-C | bsd | 10,604 |
//
// BWRemoveBottomBar.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWRemoveBottomBar.h"
@implementation BWRemoveBottomBar
- (NSRect)bounds
{
return NSMakeRect(-10000,-10000,0,0);
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWRemoveBottomBar.m | Objective-C | bsd | 286 |
//
// NSView+BWAdditions.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "NSView+BWAdditions.h"
NSComparisonResult compareViews(id firstView, id secondView, id context);
NSComparisonResult compareViews(id firstView, id secondView, id context)
{
if (firstView != context && secondView != context) {return NSOrderedSame;}
else
{
if (firstView == context) {return NSOrderedDescending;}
else {return NSOrderedAscending;}
}
}
@implementation NSView (BWAdditions)
- (void)bringToFront
{
[[self superview] sortSubviewsUsingFunction:(NSComparisonResult (*)(id, id, void *))compareViews context:self];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/NSView+BWAdditions.m | Objective-C | bsd | 705 |
//
// BWTransparentPopUpButton.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "BWTransparentPopUpButtonCell.h"
@interface BWTransparentPopUpButton : NSPopUpButton
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentPopUpButton.h | Objective-C | bsd | 292 |
//
// BWAddSheetBottomBarIntegration.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
#import "BWAddSmallBottomBar.h"
#import "BWAddRegularBottomBar.h"
#import "BWAddMiniBottomBar.h"
#import "BWAddSheetBottomBar.h"
#import "NSWindow+BWAdditions.h"
@interface NSWindow (BWBBPrivate)
- (void)setBottomCornerRounded:(BOOL)flag;
@end
@implementation BWAddSheetBottomBar ( BWAddSheetBottomBarIntegration )
- (void)ibDidAddToDesignableDocument:(IBDocument *)document
{
[super ibDidAddToDesignableDocument:document];
[self performSelector:@selector(addBottomBar) withObject:nil afterDelay:0];
[self performSelector:@selector(removeOtherBottomBarViewsInDocument:) withObject:document afterDelay:0];
}
- (void)addBottomBar
{
if ([[self window] isTextured] == NO)
{
[[self window] setContentBorderThickness:40 forEdge:NSMinYEdge];
// Private method
if ([[self window] respondsToSelector:@selector(setBottomCornerRounded:)])
[[self window] setBottomCornerRounded:NO];
}
}
- (void)removeOtherBottomBarViewsInDocument:(IBDocument *)document
{
NSArray *subviews = [[[self window] contentView] subviews];
int i;
for (i = 0; i < [subviews count]; i++)
{
NSView *view = [subviews objectAtIndex:i];
if (view != self && ([view isKindOfClass:[BWAddRegularBottomBar class]] || [view isKindOfClass:[BWAddSmallBottomBar class]] || [view isKindOfClass:[BWAddMiniBottomBar class]] || [view isKindOfClass:[BWAddSheetBottomBar class]]))
{
[document removeObject:view];
[view removeFromSuperview];
}
}
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAddSheetBottomBarIntegration.m | Objective-C | bsd | 1,663 |
//
// NSView+BWAdditions.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface NSView (BWAdditions)
- (void)bringToFront;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/NSView+BWAdditions.h | Objective-C | bsd | 241 |
//
// BWTransparentCheckboxCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTransparentCheckboxCell.h"
#import "BWTransparentTableView.h"
static NSImage *checkboxOffN, *checkboxOffP, *checkboxOnN, *checkboxOnP;
@implementation BWTransparentCheckboxCell
+ (void)initialize;
{
NSBundle *bundle = [NSBundle bundleForClass:[BWTransparentCheckboxCell class]];
checkboxOffN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentCheckboxOffN.tiff"]];
checkboxOffP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentCheckboxOffP.tiff"]];
checkboxOnN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentCheckboxOnN.tiff"]];
checkboxOnP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentCheckboxOnP.tiff"]];
[checkboxOffN setFlipped:YES];
[checkboxOffP setFlipped:YES];
[checkboxOnN setFlipped:YES];
[checkboxOnP setFlipped:YES];
}
- (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
{
if ([[self controlView] isMemberOfClass:[BWTransparentTableView class]])
{
frame.origin.x += 4;
return [super drawTitle:title withFrame:frame inView:controlView];
}
return [super drawTitle:title withFrame:frame inView:controlView];
}
- (void)drawImage:(NSImage*)image withFrame:(NSRect)frame inView:(NSView*)controlView
{
if ([[self controlView] isMemberOfClass:[BWTransparentTableView class]])
frame.origin.x += 4;
CGFloat y = NSMaxY(frame) - (frame.size.height - checkboxOffN.size.height) / 2.0 - 15;
CGFloat x = frame.origin.x + 1;
NSPoint point = NSMakePoint(x, roundf(y));
CGFloat alpha = 1.0;
if (![self isEnabled])
alpha = 0.6;
if ([self isHighlighted] && [self intValue])
[checkboxOnP drawAtPoint:point fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:alpha];
else if (![self isHighlighted] && [self intValue])
[checkboxOnN drawAtPoint:point fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:alpha];
else if (![self isHighlighted] && ![self intValue])
[checkboxOffN drawAtPoint:point fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:alpha];
else if ([self isHighlighted] && ![self intValue])
[checkboxOffP drawAtPoint:point fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:alpha];
if (![[self title] isEqualToString:@""])
{
// Style the text differently if the cell is in a table view
if ([[self controlView] isMemberOfClass:[BWTransparentTableView class]])
{
NSColor *textColor;
// Make the text white if the row is selected
if ([self backgroundStyle] != 1)
textColor = [NSColor colorWithCalibratedWhite:(198.0f / 255.0f) alpha:1];
else
textColor = [NSColor whiteColor];
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] init] autorelease];
[attributes addEntriesFromDictionary:[[self attributedTitle] attributesAtIndex:0 effectiveRange:NULL]];
[attributes setObject:textColor forKey:NSForegroundColorAttributeName];
[attributes setObject:[NSFont systemFontOfSize:11] forKey:NSFontAttributeName];
NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] initWithString:[self title] attributes:attributes] autorelease];
[self setAttributedTitle:string];
}
else
{
NSColor *textColor;
if ([self isEnabled])
textColor = [NSColor whiteColor];
else
textColor = [NSColor colorWithCalibratedWhite:0.6 alpha:1];
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] init] autorelease];
[attributes addEntriesFromDictionary:[[self attributedTitle] attributesAtIndex:0 effectiveRange:NULL]];
[attributes setObject:textColor forKey:NSForegroundColorAttributeName];
[attributes setObject:[NSFont boldSystemFontOfSize:11] forKey:NSFontAttributeName];
NSShadow *shadow = [[[NSShadow alloc] init] autorelease];
[shadow setShadowOffset:NSMakeSize(0,-1)];
[attributes setObject:shadow forKey:NSShadowAttributeName];
NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] initWithString:[self title] attributes:attributes] autorelease];
[self setAttributedTitle:string];
}
}
}
- (NSControlSize)controlSize
{
return NSSmallControlSize;
}
- (void)setControlSize:(NSControlSize)size
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentCheckboxCell.m | Objective-C | bsd | 4,424 |
//
// BWGradientSplitViewSubview.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "NSCustomView.h"
@interface BWCustomView : NSCustomView
{
BOOL isOnItsOwn;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWCustomView.h | Objective-C | bsd | 281 |
//
// BWTexturedSlider.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWTexturedSlider : NSSlider
{
int trackHeight, indicatorIndex;
NSRect sliderCellRect;
NSButton *minButton, *maxButton;
}
@property int indicatorIndex;
@property (retain) NSButton *minButton;
@property (retain) NSButton *maxButton;
- (int)trackHeight;
- (void)setTrackHeight:(int)newTrackHeight;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTexturedSlider.h | Objective-C | bsd | 495 |
//
// BWTransparentScrollViewIntegration.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
#import "BWTransparentScrollView.h"
@implementation BWTransparentScrollView ( BWTransparentScrollViewIntegration )
- (IBInset)ibLayoutInset
{
IBInset inset;
inset.top = 0;
inset.bottom = 0;
inset.left = -1;
inset.right = -1;
return inset;
}
- (void)ibTester
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentScrollViewIntegration.m | Objective-C | bsd | 502 |
//
// BWUnanchoredButtonCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWUnanchoredButtonCell.h"
#import "BWUnanchoredButton.h"
#import "NSColor+BWAdditions.h"
static NSColor *fillStop1, *fillStop2, *fillStop3, *fillStop4;
static NSColor *borderColor, *topBorderColor, *bottomInsetColor, *topInsetColor, *pressedColor;
static NSGradient *fillGradient;
@interface BWAnchoredButtonCell (BWUBCPrivate)
- (void)drawTitleInFrame:(NSRect)cellFrame;
- (void)drawImageInFrame:(NSRect)cellFrame;
@end
@implementation BWUnanchoredButtonCell
+ (void)initialize;
{
fillStop1 = [[NSColor colorWithCalibratedWhite:(251.0f / 255.0f) alpha:1] retain];
fillStop2 = [[NSColor colorWithCalibratedWhite:(251.0f / 255.0f) alpha:1] retain];
fillStop3 = [[NSColor colorWithCalibratedWhite:(236.0f / 255.0f) alpha:1] retain];
fillStop4 = [[NSColor colorWithCalibratedWhite:(243.0f / 255.0f) alpha:1] retain];
fillGradient = [[NSGradient alloc] initWithColorsAndLocations:
fillStop1, (CGFloat)0.0,
fillStop2, (CGFloat)0.5,
fillStop3, (CGFloat)0.5,
fillStop4, (CGFloat)1.0,
nil];
topBorderColor = [[NSColor colorWithCalibratedWhite:(126.0f / 255.0f) alpha:1] retain];
borderColor = [[NSColor colorWithCalibratedWhite:(151.0f / 255.0f) alpha:1] retain];
topInsetColor = [[NSColor colorWithCalibratedWhite:(0.0f / 255.0f) alpha:0.08] retain];
bottomInsetColor = [[NSColor colorWithCalibratedWhite:(255.0f / 255.0f) alpha:0.54] retain];
pressedColor = [[NSColor colorWithCalibratedWhite:(0.0f / 255.0f) alpha:0.3] retain];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
[fillGradient drawInRect:NSInsetRect(cellFrame, 0, 2) angle:90];
[topInsetColor drawPixelThickLineAtPosition:0 withInset:0 inRect:cellFrame inView:[self controlView] horizontal:YES flip:NO];
[topBorderColor drawPixelThickLineAtPosition:1 withInset:0 inRect:cellFrame inView:[self controlView] horizontal:YES flip:NO];
[borderColor drawPixelThickLineAtPosition:1 withInset:0 inRect:cellFrame inView:[self controlView] horizontal:YES flip:YES];
[bottomInsetColor drawPixelThickLineAtPosition:0 withInset:0 inRect:cellFrame inView:[self controlView] horizontal:YES flip:YES];
[borderColor drawPixelThickLineAtPosition:0 withInset:2 inRect:cellFrame inView:[self controlView] horizontal:NO flip:YES];
[borderColor drawPixelThickLineAtPosition:0 withInset:2 inRect:cellFrame inView:[self controlView] horizontal:NO flip:NO];
if ([self image] == nil)
{
NSRect titleRect = cellFrame;
titleRect.size.height -= 4;
[super drawTitleInFrame:titleRect];
}
else
[super drawImageInFrame:cellFrame];
if ([self isHighlighted])
{
[pressedColor set];
NSRectFillUsingOperation(NSInsetRect(cellFrame,0,1), NSCompositeSourceOver);
}
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWUnanchoredButtonCell.m | Objective-C | bsd | 2,913 |
//
// BWTransparentSlider.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWTransparentSlider : NSSlider
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentSlider.h | Objective-C | bsd | 235 |
//
// BWTokenAttachmentCell.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "NSTokenAttachmentCell.h"
@interface BWTokenAttachmentCell : NSTokenAttachmentCell
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTokenAttachmentCell.h | Objective-C | bsd | 286 |
//
// BWAnchoredPopUpButton.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "BWAnchoredPopUpButtonCell.h"
@interface BWAnchoredPopUpButton : NSPopUpButton
{
BOOL isAtLeftEdgeOfBar;
BOOL isAtRightEdgeOfBar;
NSPoint topAndLeftInset;
}
@property BOOL isAtLeftEdgeOfBar;
@property BOOL isAtRightEdgeOfBar;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredPopUpButton.h | Objective-C | bsd | 428 |
//
// BWAnchoredButton.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "BWAnchoredButtonCell.h"
@interface BWAnchoredButton : NSButton
{
BOOL isAtLeftEdgeOfBar;
BOOL isAtRightEdgeOfBar;
NSPoint topAndLeftInset;
}
@property BOOL isAtLeftEdgeOfBar;
@property BOOL isAtRightEdgeOfBar;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButton.h | Objective-C | bsd | 408 |
//
// BWAnchoredButtonCell.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWAnchoredButtonCell : NSButtonCell
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButtonCell.h | Objective-C | bsd | 242 |
//
// BWControlsInspector.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
@interface BWTexturedSliderInspector : IBInspector
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTexturedSliderInspector.h | Objective-C | bsd | 270 |
//
// BWAnchoredButton.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWAnchoredButton.h"
#import "BWAnchoredButtonBar.h"
#import "NSView+BWAdditions.h"
@implementation BWAnchoredButton
@synthesize isAtLeftEdgeOfBar;
@synthesize isAtRightEdgeOfBar;
+ (Class)cellClass
{
return [BWAnchoredButtonCell class];
}
- (id)initWithCoder:(NSCoder *)decoder
{
// Fail gracefully on non-keyed coders
if (![decoder isKindOfClass:[NSKeyedUnarchiver class]])
return [super initWithCoder:decoder];
NSKeyedUnarchiver *coder = (NSKeyedUnarchiver *)decoder;
Class oldClass = [[self superclass] cellClass];
Class newClass = [[self class] cellClass];
[coder setClass:newClass forClassName:NSStringFromClass(oldClass)];
self = [super initWithCoder:coder];
if ([BWAnchoredButtonBar wasBorderedBar])
topAndLeftInset = NSMakePoint(0, 0);
else
topAndLeftInset = NSMakePoint(1, 1);
[coder setClass:oldClass forClassName:NSStringFromClass(oldClass)];
return self;
}
- (void)mouseDown:(NSEvent *)theEvent
{
[self bringToFront];
[super mouseDown:theEvent];
}
- (NSRect)frame
{
NSRect frame = [super frame];
frame.size.height = 24;
return frame;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButton.m | Objective-C | bsd | 1,255 |
//
// NSImage+BWAdditions.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "NSImage+BWAdditions.h"
@implementation NSImage (BWAdditions)
// Draw a solid color over an image - taking into account alpha. Useful for coloring template images.
- (NSImage *)tintedImageWithColor:(NSColor *)tint
{
NSSize size = [self size];
NSRect imageBounds = NSMakeRect(0, 0, size.width, size.height);
NSImage *copiedImage = [self copy];
[copiedImage lockFocus];
[tint set];
NSRectFillUsingOperation(imageBounds, NSCompositeSourceAtop);
[copiedImage unlockFocus];
return [copiedImage autorelease];
}
// Rotate an image 90 degrees clockwise or counterclockwise
// Code from http://swik.net/User:marc/Chipmunk+Ninja+Technical+Articles/Rotating+an+NSImage+object+in+Cocoa/zgha
- (NSImage *)rotateImage90DegreesClockwise:(BOOL)clockwise
{
NSImage *existingImage = self;
NSSize existingSize;
/**
* Get the size of the original image in its raw bitmap format.
* The bestRepresentationForDevice: nil tells the NSImage to just
* give us the raw image instead of it's wacky DPI-translated version.
*/
existingSize.width = [[existingImage bestRepresentationForDevice:nil] pixelsWide];
existingSize.height = [[existingImage bestRepresentationForDevice:nil] pixelsHigh];
NSSize newSize = NSMakeSize(existingSize.height, existingSize.width);
NSImage *rotatedImage = [[NSImage alloc] initWithSize:newSize];
[rotatedImage lockFocus];
/**
* Apply the following transformations:
*
* - bring the rotation point to the centre of the image instead of
* the default lower, left corner (0,0).
* - rotate it by 90 degrees, either clock or counter clockwise.
* - re-translate the rotated image back down to the lower left corner
* so that it appears in the right place.
*/
NSAffineTransform *rotateTF = [NSAffineTransform transform];
NSPoint centerPoint = NSMakePoint(newSize.width / 2, newSize.height / 2);
[rotateTF translateXBy: centerPoint.x yBy: centerPoint.y];
[rotateTF rotateByDegrees: (clockwise) ? - 90 : 90];
[rotateTF translateXBy: -centerPoint.y yBy: -centerPoint.x];
[rotateTF concat];
/**
* We have to get the image representation to do its drawing directly,
* because otherwise the stupid NSImage DPI thingie bites us in the butt
* again.
*/
NSRect r1 = NSMakeRect(0, 0, newSize.height, newSize.width);
[[existingImage bestRepresentationForDevice:nil] drawInRect:r1];
[rotatedImage unlockFocus];
return rotatedImage;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/NSImage+BWAdditions.m | Objective-C | bsd | 2,696 |
//
// BWAnchoredButtonBarViewInspector.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
@interface BWAnchoredButtonBarInspector : IBInspector
{
IBOutlet NSMatrix *matrix;
IBOutlet NSImageView *selectionView;
IBOutlet NSView *contentView;
}
- (IBAction)selectMode1:(id)sender;
- (IBAction)selectMode2:(id)sender;
- (IBAction)selectMode3:(id)sender;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButtonBarInspector.h | Objective-C | bsd | 493 |
//
// BWSelectableToolbarHelper.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWSelectableToolbarHelper : NSObject
{
NSMutableDictionary *contentViewsByIdentifier, *windowSizesByIdentifier;
NSString *selectedIdentifier, *oldWindowTitle;
NSSize initialIBWindowSize;
BOOL isPreferencesToolbar;
}
@property (copy) NSMutableDictionary *contentViewsByIdentifier;
@property (copy) NSMutableDictionary *windowSizesByIdentifier;
@property (copy) NSString *selectedIdentifier;
@property (copy) NSString *oldWindowTitle;
@property (assign) NSSize initialIBWindowSize;
@property (assign) BOOL isPreferencesToolbar;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWSelectableToolbarHelper.h | Objective-C | bsd | 736 |
//
// BWTransparentPopUpButtonCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTransparentPopUpButtonCell.h"
#import "NSImage+BWAdditions.h"
static NSImage *popUpFillN, *popUpFillP, *popUpRightN, *popUpRightP, *popUpLeftN, *popUpLeftP, *pullDownRightN, *pullDownRightP;
static NSColor *disabledColor, *enabledColor;
@interface BWTransparentPopUpButtonCell (BWTPUBCPrivate)
- (void)drawTitleWithFrame:(NSRect)cellFrame;
- (void)drawImageWithFrame:(NSRect)cellFrame;
@end
@implementation BWTransparentPopUpButtonCell
+ (void)initialize;
{
NSBundle *bundle = [NSBundle bundleForClass:[BWTransparentPopUpButtonCell class]];
popUpFillN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpFillN.tiff"]];
popUpFillP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpFillP.tiff"]];
popUpRightN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpRightN.tiff"]];
popUpRightP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpRightP.tiff"]];
popUpLeftN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpLeftN.tiff"]];
popUpLeftP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpLeftP.tiff"]];
pullDownRightN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpPullDownRightN.tif"]];
pullDownRightP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentPopUpPullDownRightP.tif"]];
enabledColor = [[NSColor whiteColor] retain];
disabledColor = [[NSColor colorWithCalibratedWhite:0.6 alpha:1] retain];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
cellFrame.size.height = popUpFillN.size.height;
if ([self isHighlighted])
{
if ([self pullsDown])
NSDrawThreePartImage(cellFrame, popUpLeftP, popUpFillP, pullDownRightP, NO, NSCompositeSourceOver, 1, YES);
else
NSDrawThreePartImage(cellFrame, popUpLeftP, popUpFillP, popUpRightP, NO, NSCompositeSourceOver, 1, YES);
}
else
{
if ([self pullsDown])
NSDrawThreePartImage(cellFrame, popUpLeftN, popUpFillN, pullDownRightN, NO, NSCompositeSourceOver, 1, YES);
else
NSDrawThreePartImage(cellFrame, popUpLeftN, popUpFillN, popUpRightN, NO, NSCompositeSourceOver, 1, YES);
}
if ([self isEnabled])
interiorColor = enabledColor;
else
interiorColor = disabledColor;
if ([self image] == nil)
[self drawTitleWithFrame:cellFrame];
else
[self drawImageWithFrame:cellFrame];
}
- (void)drawTitleWithFrame:(NSRect)cellFrame
{
if (![[self title] isEqualToString:@""])
{
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] init] autorelease];
[attributes addEntriesFromDictionary:[[self attributedTitle] attributesAtIndex:0 effectiveRange:NULL]];
[attributes setObject:interiorColor forKey:NSForegroundColorAttributeName];
NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] initWithString:[self title] attributes:attributes] autorelease];
[string drawAtPoint:NSMakePoint(8,2)];
}
}
- (void)drawImageWithFrame:(NSRect)cellFrame
{
NSImage *image = [self image];
if (image != nil)
{
[image setScalesWhenResized:NO];
NSRect sourceRect = NSZeroRect;
if ([[image name] isEqualToString:@"NSActionTemplate"])
[image setSize:NSMakeSize(10,10)];
sourceRect.size = [image size];
NSPoint backgroundCenter;
backgroundCenter.x = cellFrame.size.width / 2;
backgroundCenter.y = cellFrame.size.height / 2;
NSPoint drawPoint = backgroundCenter;
drawPoint.x -= sourceRect.size.width / 2;
drawPoint.y -= sourceRect.size.height / 2;
drawPoint.x = 8;
drawPoint.y = roundf(drawPoint.y) + 1;
NSImage *glyphImage = image;
if ([image isTemplate])
{
glyphImage = [image tintedImageWithColor:interiorColor];
NSAffineTransform* xform = [NSAffineTransform transform];
[xform translateXBy:0.0 yBy:cellFrame.size.height];
[xform scaleXBy:1.0 yBy:-1.0];
[xform concat];
}
[glyphImage drawAtPoint:drawPoint fromRect:sourceRect operation:NSCompositeSourceOver fraction:1];
}
}
- (NSControlSize)controlSize
{
return NSSmallControlSize;
}
- (void)setControlSize:(NSControlSize)size
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentPopUpButtonCell.m | Objective-C | bsd | 4,405 |
//
// BWAnchoredButtonBarViewInspector.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWAnchoredButtonBarInspector.h"
@implementation BWAnchoredButtonBarInspector
- (NSString *)viewNibName
{
return @"BWAnchoredButtonBarInspector";
}
- (void)refresh
{
[super refresh];
}
- (IBAction)selectMode1:(id)sender
{
float xOrigin = matrix.frame.origin.x-1;
float deltaX = fabsf(xOrigin - selectionView.frame.origin.x);
float doubleSpaceMultiplier = 1;
if (deltaX > 65)
doubleSpaceMultiplier = 1.5;
float duration = 0.1*doubleSpaceMultiplier;
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:(duration)];
[[selectionView animator] setFrameOrigin:NSMakePoint(xOrigin,selectionView.frame.origin.y)];
[NSAnimationContext endGrouping];
}
- (IBAction)selectMode2:(id)sender
{
float xOrigin = matrix.frame.origin.x + NSWidth(matrix.frame) / matrix.numberOfColumns;
float deltaX = fabsf(xOrigin - selectionView.frame.origin.x);
float doubleSpaceMultiplier = 1;
if (deltaX > 65)
doubleSpaceMultiplier = 1.5;
float duration = 0.1*doubleSpaceMultiplier;
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:(duration)];
[[selectionView animator] setFrameOrigin:NSMakePoint(xOrigin,selectionView.frame.origin.y)];
[NSAnimationContext endGrouping];
}
- (IBAction)selectMode3:(id)sender
{
float xOrigin = NSMaxX(matrix.frame) - NSWidth(matrix.frame) / matrix.numberOfColumns + matrix.numberOfColumns - 1;
float deltaX = fabsf(xOrigin - selectionView.frame.origin.x);
float doubleSpaceMultiplier = 1;
if (deltaX > 65)
doubleSpaceMultiplier = 1.5;
float duration = 0.1*doubleSpaceMultiplier;
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:(duration)];
[[selectionView animator] setFrameOrigin:NSMakePoint(xOrigin,selectionView.frame.origin.y)];
[NSAnimationContext endGrouping];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButtonBarInspector.m | Objective-C | bsd | 2,024 |
//
// BWTransparentButtonCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTransparentButtonCell.h"
#import "NSImage+BWAdditions.h"
static NSImage *buttonLeftN, *buttonFillN, *buttonRightN, *buttonLeftP, *buttonFillP, *buttonRightP;
static NSColor *disabledColor, *enabledColor;
@interface BWTransparentButtonCell (BWTBCPrivate)
- (void)drawTitleWithFrame:(NSRect)cellFrame;
- (void)drawImageWithFrame:(NSRect)cellFrame;
@end
@implementation BWTransparentButtonCell
+ (void)initialize;
{
NSBundle *bundle = [NSBundle bundleForClass:[BWTransparentButtonCell class]];
buttonLeftN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentButtonLeftN.tiff"]];
buttonFillN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentButtonFillN.tiff"]];
buttonRightN = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentButtonRightN.tiff"]];
buttonLeftP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentButtonLeftP.tiff"]];
buttonFillP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentButtonFillP.tiff"]];
buttonRightP = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentButtonRightP.tiff"]];
enabledColor = [[NSColor whiteColor] retain];
disabledColor = [[NSColor colorWithCalibratedWhite:0.6 alpha:1] retain];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
cellFrame.size.height = buttonFillN.size.height;
if ([self isHighlighted])
NSDrawThreePartImage(cellFrame, buttonLeftP, buttonFillP, buttonRightP, NO, NSCompositeSourceOver, 1, YES);
else
NSDrawThreePartImage(cellFrame, buttonLeftN, buttonFillN, buttonRightN, NO, NSCompositeSourceOver, 1, YES);
if ([self isEnabled])
interiorColor = enabledColor;
else
interiorColor = disabledColor;
if ([self image] == nil)
[self drawTitleWithFrame:cellFrame];
else
[self drawImageWithFrame:cellFrame];
}
- (void)drawTitleWithFrame:(NSRect)cellFrame
{
if (![[self title] isEqualToString:@""])
{
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] init] autorelease];
[attributes addEntriesFromDictionary:[[self attributedTitle] attributesAtIndex:0 effectiveRange:NULL]];
[attributes setObject:interiorColor forKey:NSForegroundColorAttributeName];
[attributes setObject:[NSFont systemFontOfSize:11] forKey:NSFontAttributeName];
NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] initWithString:[self title] attributes:attributes] autorelease];
[self setAttributedTitle:string];
cellFrame.origin.y += 2;
[[self attributedTitle] drawInRect:cellFrame];
}
}
- (void)drawImageWithFrame:(NSRect)cellFrame
{
NSImage *image = [self image];
if (image != nil)
{
[image setScalesWhenResized:NO];
NSRect sourceRect = NSZeroRect;
if ([[image name] isEqualToString:@"NSActionTemplate"])
[image setSize:NSMakeSize(10,10)];
sourceRect.size = [image size];
NSPoint backgroundCenter;
backgroundCenter.x = cellFrame.size.width / 2;
backgroundCenter.y = cellFrame.size.height / 2;
NSPoint drawPoint = backgroundCenter;
drawPoint.x -= sourceRect.size.width / 2;
drawPoint.y -= sourceRect.size.height / 2 ;
drawPoint.x = roundf(drawPoint.x);
drawPoint.y = roundf(drawPoint.y) + 1;
NSImage *glyphImage = image;
if ([image isTemplate])
{
glyphImage = [image tintedImageWithColor:interiorColor];
NSAffineTransform* xform = [NSAffineTransform transform];
[xform translateXBy:0.0 yBy:cellFrame.size.height];
[xform scaleXBy:1.0 yBy:-1.0];
[xform concat];
}
[glyphImage drawAtPoint:drawPoint fromRect:sourceRect operation:NSCompositeSourceOver fraction:1];
}
}
- (NSControlSize)controlSize
{
return NSSmallControlSize;
}
- (void)setControlSize:(NSControlSize)size
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentButtonCell.m | Objective-C | bsd | 3,980 |
//
// BWSelectableToolbarHelper.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWSelectableToolbarHelper.h"
@implementation BWSelectableToolbarHelper
@synthesize contentViewsByIdentifier;
@synthesize windowSizesByIdentifier;
@synthesize selectedIdentifier;
@synthesize oldWindowTitle;
@synthesize initialIBWindowSize;
@synthesize isPreferencesToolbar;
- (id)init
{
if(self = [super init])
{
if (contentViewsByIdentifier == nil)
contentViewsByIdentifier = [[NSMutableDictionary alloc] init];
if (windowSizesByIdentifier == nil)
windowSizesByIdentifier = [[NSMutableDictionary alloc] init];
if (selectedIdentifier == nil)
selectedIdentifier = [[NSString alloc] init];
if (oldWindowTitle == nil)
oldWindowTitle = [[NSString alloc] init];
}
return self;
}
- (id)initWithCoder:(NSCoder *)decoder;
{
if ((self = [super init]) != nil)
{
[self setContentViewsByIdentifier:[decoder decodeObjectForKey:@"BWSTHContentViewsByIdentifier"]];
NSData *data = [decoder decodeObjectForKey:@"BWSTHWindowSizesByIdentifier"];
[self setWindowSizesByIdentifier:[NSUnarchiver unarchiveObjectWithData:data]];
[self setSelectedIdentifier:[decoder decodeObjectForKey:@"BWSTHSelectedIdentifier"]];
[self setOldWindowTitle:[decoder decodeObjectForKey:@"BWSTHOldWindowTitle"]];
[self setInitialIBWindowSize:[decoder decodeSizeForKey:@"BWSTHInitialIBWindowSize"]];
[self setIsPreferencesToolbar:[decoder decodeBoolForKey:@"BWSTHIsPreferencesToolbar"]];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[coder encodeObject:[self contentViewsByIdentifier] forKey:@"BWSTHContentViewsByIdentifier"];
NSData *data = [NSArchiver archivedDataWithRootObject:[self windowSizesByIdentifier]];
[coder encodeObject:data forKey:@"BWSTHWindowSizesByIdentifier"];
[coder encodeObject:[self selectedIdentifier] forKey:@"BWSTHSelectedIdentifier"];
[coder encodeObject:[self oldWindowTitle] forKey:@"BWSTHOldWindowTitle"];
[coder encodeSize:[self initialIBWindowSize] forKey:@"BWSTHInitialIBWindowSize"];
[coder encodeBool:[self isPreferencesToolbar] forKey:@"BWSTHIsPreferencesToolbar"];
}
- (void)dealloc
{
[contentViewsByIdentifier release];
[windowSizesByIdentifier release];
[selectedIdentifier release];
[oldWindowTitle release];
[super dealloc];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWSelectableToolbarHelper.m | Objective-C | bsd | 2,411 |
//
// NSColor+PixelWideLines.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "NSColor+BWAdditions.h"
@implementation NSColor (BWAdditions)
// Use this method to draw 1 px wide lines independent of scale factor. Handy for resolution independent drawing. Still needs some work - there are issues with drawing at the edges of views.
- (void)drawPixelThickLineAtPosition:(int)posInPixels withInset:(int)insetInPixels inRect:(NSRect)aRect inView:(NSView *)view horizontal:(BOOL)isHorizontal flip:(BOOL)shouldFlip
{
// Convert the given rectangle from points to pixels
aRect = [view convertRectToBase:aRect];
// Round up the rect's values to integers
aRect = NSIntegralRect(aRect);
// Add or subtract 0.5 so the lines are drawn within pixel bounds
if (isHorizontal)
{
if ([view isFlipped])
aRect.origin.y -= 0.5;
else
aRect.origin.y += 0.5;
}
else
{
aRect.origin.x += 0.5;
}
NSSize sizeInPixels = aRect.size;
// Convert the rect back to points for drawing
aRect = [view convertRectFromBase:aRect];
// Flip the position so it's at the other side of the rect
if (shouldFlip)
{
if (isHorizontal)
posInPixels = sizeInPixels.height - posInPixels - 1;
else
posInPixels = sizeInPixels.width - posInPixels - 1;
}
float posInPoints = posInPixels / [[NSScreen mainScreen] userSpaceScaleFactor];
float insetInPoints = insetInPixels / [[NSScreen mainScreen] userSpaceScaleFactor];
// Calculate line start and end points
float startX, startY, endX, endY;
if (isHorizontal)
{
startX = aRect.origin.x + insetInPoints;
startY = aRect.origin.y + posInPoints;
endX = aRect.origin.x + aRect.size.width - insetInPoints;
endY = aRect.origin.y + posInPoints;
}
else
{
startX = aRect.origin.x + posInPoints;
startY = aRect.origin.y + insetInPoints;
endX = aRect.origin.x + posInPoints;
endY = aRect.origin.y + aRect.size.height - insetInPoints;
}
// Draw line
NSBezierPath *path = [NSBezierPath bezierPath];
[path setLineWidth:0.0f];
[path moveToPoint:NSMakePoint(startX,startY)];
[path lineToPoint:NSMakePoint(endX,endY)];
[self set];
[path stroke];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/NSColor+BWAdditions.m | Objective-C | bsd | 2,223 |
//
// BWAnchoredButtonIntegration.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
#import "BWAnchoredButton.h"
@implementation BWAnchoredButton ( BWAnchoredButtonIntegration )
- (NSSize)ibMinimumSize
{
return NSMakeSize(0,24);
}
- (NSSize)ibMaximumSize
{
return NSMakeSize(100000,24);
}
- (IBInset)ibLayoutInset
{
IBInset inset;
inset.bottom = 0;
inset.right = 0;
inset.top = topAndLeftInset.x;
inset.left = topAndLeftInset.y;
return inset;
}
- (int)ibBaselineCount
{
return 1;
}
- (float)ibBaselineAtIndex:(int)index
{
return 16;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButtonIntegration.m | Objective-C | bsd | 691 |
//
// BWTokenFieldCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTokenFieldCell.h"
#import "BWTokenAttachmentCell.h"
@implementation BWTokenFieldCell
- (id)setUpTokenAttachmentCell:(NSTokenAttachmentCell *)aCell forRepresentedObject:(id)anObj
{
BWTokenAttachmentCell *attachmentCell = [[BWTokenAttachmentCell alloc] initTextCell:[aCell stringValue]];
[attachmentCell setRepresentedObject:anObj];
[attachmentCell setAttachment:[aCell attachment]];
[attachmentCell setControlSize:[self controlSize]];
[attachmentCell setTextColor:[NSColor blackColor]];
[attachmentCell setFont:[self font]];
return [attachmentCell autorelease];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTokenFieldCell.m | Objective-C | bsd | 747 |
//
// BWAnchoredPopUpButton.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWAnchoredPopUpButton.h"
#import "BWAnchoredButtonBar.h"
#import "NSView+BWAdditions.h"
@implementation BWAnchoredPopUpButton
@synthesize isAtLeftEdgeOfBar;
@synthesize isAtRightEdgeOfBar;
+ (Class)cellClass
{
return [BWAnchoredPopUpButtonCell class];
}
- (id)initWithCoder:(NSCoder *)decoder
{
// Fail gracefully on non-keyed coders
if (![decoder isKindOfClass:[NSKeyedUnarchiver class]])
return [super initWithCoder:decoder];
NSKeyedUnarchiver *coder = (NSKeyedUnarchiver *)decoder;
Class oldClass = [[self superclass] cellClass];
Class newClass = [[self class] cellClass];
[coder setClass:newClass forClassName:NSStringFromClass(oldClass)];
self = [super initWithCoder:coder];
if ([BWAnchoredButtonBar wasBorderedBar])
topAndLeftInset = NSMakePoint(0, 0);
else
topAndLeftInset = NSMakePoint(1, 1);
[coder setClass:oldClass forClassName:NSStringFromClass(oldClass)];
return self;
}
- (void)mouseDown:(NSEvent *)theEvent
{
[self bringToFront];
[super mouseDown:theEvent];
}
- (NSRect)frame
{
NSRect frame = [super frame];
frame.size.height = 24;
return frame;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredPopUpButton.m | Objective-C | bsd | 1,275 |
//
// BWSplitViewInspectorAutosizingView.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "BWSplitView.h"
@interface BWSplitViewInspectorAutosizingView : NSView
{
NSMutableArray *buttons;
BWSplitView *splitView;
}
@property (retain) BWSplitView *splitView;
- (void)layoutButtons;
- (BOOL)isVertical;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWSplitViewInspectorAutosizingView.h | Objective-C | bsd | 424 |
//
// BWTexturedSliderCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTexturedSliderCell.h"
@implementation BWTexturedSliderCell
@synthesize trackHeight;
static NSImage *trackLeftImage, *trackFillImage, *trackRightImage, *thumbPImage, *thumbNImage;
+ (void)initialize
{
if([BWTexturedSliderCell class] == [self class])
{
NSBundle *bundle = [NSBundle bundleForClass:[BWTexturedSliderCell class]];
trackLeftImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderTrackLeft.tiff"]];
trackFillImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderTrackFill.tiff"]];
trackRightImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderTrackRight.tiff"]];
thumbPImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderThumbP.tiff"]];
thumbNImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderThumbN.tiff"]];
}
}
- (id)initWithCoder:(NSCoder *)decoder;
{
if ((self = [super initWithCoder:decoder]) != nil)
{
[self setTrackHeight:[decoder decodeBoolForKey:@"BWTSTrackHeight"]];
[self setControlSize:NSSmallControlSize];
isPressed = NO;
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[super encodeWithCoder:coder];
[coder encodeBool:[self trackHeight] forKey:@"BWTSTrackHeight"];
}
- (NSControlSize)controlSize
{
return NSRegularControlSize;
}
- (void)setControlSize:(NSControlSize)size
{
}
- (NSInteger)numberOfTickMarks
{
return 0;
}
- (void)setNumberOfTickMarks:(NSInteger)numberOfTickMarks
{
}
- (void)drawBarInside:(NSRect)cellFrame flipped:(BOOL)flipped
{
NSRect slideRect = cellFrame;
if (trackHeight == 0)
slideRect.size.height = trackFillImage.size.height;
else
slideRect.size.height = trackFillImage.size.height + 1;
slideRect.origin.y += roundf((cellFrame.size.height - slideRect.size.height) / 2);
// Inset the bar so the knob goes all the way to both ends
slideRect.size.width -= 9;
slideRect.origin.x += 5;
if ([self isEnabled])
NSDrawThreePartImage(slideRect, trackLeftImage, trackFillImage, trackRightImage, NO, NSCompositeSourceOver, 1, flipped);
else
NSDrawThreePartImage(slideRect, trackLeftImage, trackFillImage, trackRightImage, NO, NSCompositeSourceOver, 0.5, flipped);
}
- (void)drawKnob:(NSRect)rect
{
NSImage *drawImage;
if (isPressed)
drawImage = thumbPImage;
else
drawImage = thumbNImage;
NSPoint drawPoint;
drawPoint.x = rect.origin.x + roundf((rect.size.width - drawImage.size.width) / 2);
drawPoint.y = NSMaxY(rect) - roundf((rect.size.height - drawImage.size.height) / 2);
if (trackHeight == 0)
drawPoint.y++;
[drawImage compositeToPoint:drawPoint operation:NSCompositeSourceOver];
}
- (BOOL)_usesCustomTrackImage
{
return YES;
}
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
isPressed = YES;
return [super startTrackingAt:startPoint inView:controlView];
}
- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag
{
isPressed = NO;
[super stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTexturedSliderCell.m | Objective-C | bsd | 3,368 |
//
// BWTransparentPopUpButton.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTransparentPopUpButton.h"
@implementation BWTransparentPopUpButton
+ (Class)cellClass
{
return [BWTransparentPopUpButtonCell class];
}
- (id)initWithCoder:(NSCoder *)decoder
{
// Fail gracefully on non-keyed coders
if (![decoder isKindOfClass:[NSKeyedUnarchiver class]])
return [super initWithCoder:decoder];
NSKeyedUnarchiver *coder = (NSKeyedUnarchiver *)decoder;
Class oldClass = [[self superclass] cellClass];
Class newClass = [[self class] cellClass];
[coder setClass:newClass forClassName:NSStringFromClass(oldClass)];
self = [super initWithCoder:coder];
[coder setClass:oldClass forClassName:NSStringFromClass(oldClass)];
return self;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentPopUpButton.m | Objective-C | bsd | 843 |
//
// BWUnanchoredButton.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "BWUnanchoredButtonCell.h"
@interface BWUnanchoredButton : NSButton
{
NSPoint topAndLeftInset;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWUnanchoredButton.h | Objective-C | bsd | 293 |
//
// BWTransparentTableViewCell.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWTransparentTableViewCell : NSTextFieldCell
{
BOOL mIsEditingOrSelecting;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentTableViewCell.h | Objective-C | bsd | 284 |
//
// BWTransparentScroller.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTransparentScroller.h"
// Vertical scroller
static NSImage *knobTop, *knobVerticalFill, *knobBottom, *slotTop, *slotVerticalFill, *slotBottom;
static float verticalPaddingLeft = 0.0;
static float verticalPaddingRight = 1.0;
static float verticalPaddingTop = 2.0;
static float verticalPaddingBottom = 0.0;
static float minKnobHeight;
// Horizontal scroller
static NSImage *knobLeft, *knobHorizontalFill, *knobRight, *slotLeft, *slotHorizontalFill, *slotRight;
static float horizontalPaddingLeft = 2.0;
static float horizontalPaddingRight = 2.0;
static float horizontalPaddingTop = 0.0;
static float horizontalPaddingBottom = 1.0;
static float minKnobWidth;
static NSColor *backgroundColor;
@interface BWTransparentScroller (BWTSPrivate)
- (void)drawKnobSlot;
@end
@interface NSScroller (BWTSPrivate)
- (NSRect)_drawingRectForPart:(NSScrollerPart)aPart;
@end
@implementation BWTransparentScroller
+ (void)initialize
{
NSBundle *bundle = [NSBundle bundleForClass:[BWTransparentScroller class]];
// Vertical scroller
knobTop = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerKnobTop.tif"]];
knobVerticalFill = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerKnobVerticalFill.tif"]];
knobBottom = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerKnobBottom.tif"]];
slotTop = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerSlotTop.tif"]];
slotVerticalFill = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerSlotVerticalFill.tif"]];
slotBottom = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerSlotBottom.tif"]];
// Horizontal scroller
knobLeft = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerKnobLeft.tif"]];
knobHorizontalFill = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerKnobHorizontalFill.tif"]];
knobRight = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerKnobRight.tif"]];
slotLeft = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerSlotLeft.tif"]];
slotHorizontalFill = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerSlotHorizontalFill.tif"]];
slotRight = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TransparentScrollerSlotRight.tif"]];
backgroundColor = [[NSColor colorWithCalibratedWhite:0.13 alpha:0.855] retain];
minKnobHeight = knobTop.size.height + knobVerticalFill.size.height + knobBottom.size.height + 10;
minKnobWidth = knobLeft.size.width + knobHorizontalFill.size.width + knobRight.size.width + 10;
}
- (id)initWithFrame:(NSRect)frameRect;
{
if (self = [super initWithFrame:frameRect])
{
[self setArrowsPosition:NSScrollerArrowsNone];
if ([self bounds].size.width / [self bounds].size.height < 1)
isVertical = YES;
else
isVertical = NO;
}
return self;
}
- (id)initWithCoder:(NSCoder *)decoder;
{
if (self = [super initWithCoder:decoder])
{
[self setArrowsPosition:NSScrollerArrowsNone];
if ([self bounds].size.width / [self bounds].size.height < 1)
isVertical = YES;
else
isVertical = NO;
}
return self;
}
+ (CGFloat)scrollerWidth
{
return slotVerticalFill.size.width + verticalPaddingLeft + verticalPaddingRight;
}
+ (CGFloat)scrollerWidthForControlSize:(NSControlSize)controlSize
{
return slotVerticalFill.size.width + verticalPaddingLeft + verticalPaddingRight;
}
- (void)drawRect:(NSRect)aRect;
{
[backgroundColor set];
NSRectFill([self bounds]);
// Only draw if the slot is larger than the knob
if (isVertical && ([self bounds].size.height - verticalPaddingTop - verticalPaddingBottom + 1) > minKnobHeight)
{
[self drawKnobSlot];
if ([self knobProportion] > 0.0)
[self drawKnob];
}
else if (!isVertical && ([self bounds].size.width - horizontalPaddingLeft - horizontalPaddingRight + 1) > minKnobWidth)
{
[self drawKnobSlot];
if ([self knobProportion] > 0.0)
[self drawKnob];
}
}
- (void)drawKnobSlot;
{
NSRect slotRect = [self rectForPart:NSScrollerKnobSlot];
if (isVertical)
NSDrawThreePartImage(slotRect, slotTop, slotVerticalFill, slotBottom, YES, NSCompositeSourceOver, 1, NO);
else
NSDrawThreePartImage(slotRect, slotLeft, slotHorizontalFill, slotRight, NO, NSCompositeSourceOver, 1, NO);
}
- (void)drawKnob;
{
NSRect knobRect = [self rectForPart:NSScrollerKnob];
if (isVertical)
NSDrawThreePartImage(knobRect, knobTop, knobVerticalFill, knobBottom, YES, NSCompositeSourceOver, 1, NO);
else
NSDrawThreePartImage(knobRect, knobLeft, knobHorizontalFill, knobRight, NO, NSCompositeSourceOver, 1, NO);
}
- (NSRect)_drawingRectForPart:(NSScrollerPart)aPart;
{
// Call super even though we're not using its value (has some side effects we need)
[super _drawingRectForPart:aPart];
// Return our own rects rather than use the default behavior
return [self rectForPart:aPart];
}
- (NSRect)rectForPart:(NSScrollerPart)aPart;
{
switch (aPart)
{
case NSScrollerNoPart:
return [self bounds];
break;
case NSScrollerKnob:
{
NSRect knobRect;
NSRect slotRect = [self rectForPart:NSScrollerKnobSlot];
if (isVertical)
{
float knobHeight = roundf(slotRect.size.height * [self knobProportion]);
if (knobHeight < minKnobHeight)
knobHeight = minKnobHeight;
float knobY = slotRect.origin.y + roundf((slotRect.size.height - knobHeight) * [self floatValue]);
knobRect = NSMakeRect(verticalPaddingLeft, knobY, slotRect.size.width, knobHeight);
}
else
{
float knobWidth = roundf(slotRect.size.width * [self knobProportion]);
if (knobWidth < minKnobWidth)
knobWidth = minKnobWidth;
float knobX = slotRect.origin.x + roundf((slotRect.size.width - knobWidth) * [self floatValue]);
knobRect = NSMakeRect(knobX, horizontalPaddingTop, knobWidth, slotRect.size.height);
}
return knobRect;
}
break;
case NSScrollerKnobSlot:
{
NSRect slotRect;
if (isVertical)
slotRect = NSMakeRect(verticalPaddingLeft, verticalPaddingTop, [self bounds].size.width - verticalPaddingLeft - verticalPaddingRight, [self bounds].size.height - verticalPaddingTop - verticalPaddingBottom);
else
slotRect = NSMakeRect(horizontalPaddingLeft, horizontalPaddingTop, [self bounds].size.width - horizontalPaddingLeft - horizontalPaddingRight, [self bounds].size.height - horizontalPaddingTop - horizontalPaddingBottom);
return slotRect;
}
break;
case NSScrollerIncrementLine:
return NSZeroRect;
break;
case NSScrollerDecrementLine:
return NSZeroRect;
break;
case NSScrollerIncrementPage:
{
NSRect incrementPageRect;
NSRect knobRect = [self rectForPart:NSScrollerKnob];
NSRect slotRect = [self rectForPart:NSScrollerKnobSlot];
NSRect decPageRect = [self rectForPart:NSScrollerDecrementPage];
if (isVertical)
{
float knobY = knobRect.origin.y + knobRect.size.height;
incrementPageRect = NSMakeRect(verticalPaddingLeft, knobY, knobRect.size.width, slotRect.size.height - knobRect.size.height - decPageRect.size.height);
}
else
{
float knobX = knobRect.origin.x + knobRect.size.width;
incrementPageRect = NSMakeRect(knobX, horizontalPaddingTop, (slotRect.size.width + horizontalPaddingLeft) - knobX, knobRect.size.height);
}
return incrementPageRect;
}
break;
case NSScrollerDecrementPage:
{
NSRect decrementPageRect;
NSRect knobRect = [self rectForPart:NSScrollerKnob];
if (isVertical)
decrementPageRect = NSMakeRect(verticalPaddingLeft, verticalPaddingTop, knobRect.size.width, knobRect.origin.y - verticalPaddingTop);
else
decrementPageRect = NSMakeRect(horizontalPaddingLeft, horizontalPaddingTop, knobRect.origin.x - horizontalPaddingLeft, knobRect.size.height);
return decrementPageRect;
}
break;
default:
break;
}
return NSZeroRect;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentScroller.m | Objective-C | bsd | 8,314 |
//
// BWTokenField.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTokenField.h"
#import "BWTokenFieldCell.h"
@implementation BWTokenField
+ (Class)cellClass
{
return [BWTokenFieldCell class];
}
- (id)initWithCoder:(NSCoder *)decoder
{
// Fail gracefully on non-keyed coders
if (![decoder isKindOfClass:[NSKeyedUnarchiver class]])
return [super initWithCoder:decoder];
NSKeyedUnarchiver *coder = (NSKeyedUnarchiver *)decoder;
Class oldClass = [[self superclass] cellClass];
Class newClass = [[self class] cellClass];
[coder setClass:newClass forClassName:NSStringFromClass(oldClass)];
self = [super initWithCoder:coder];
[coder setClass:oldClass forClassName:NSStringFromClass(oldClass)];
return self;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTokenField.m | Objective-C | bsd | 824 |
//
// BWTexturedSlider.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTexturedSlider.h"
#import "BWTexturedSliderCell.h"
static NSImage *quietSpeakerImage, *loudSpeakerImage, *smallPhotoImage, *largePhotoImage;
static float imageInset = 25;
@implementation BWTexturedSlider
@synthesize indicatorIndex;
@synthesize minButton;
@synthesize maxButton;
+ (void)initialize
{
NSBundle *bundle = [NSBundle bundleForClass:[BWTexturedSlider class]];
quietSpeakerImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderSpeakerQuiet.png"]];
loudSpeakerImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderSpeakerLoud.png"]];
smallPhotoImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderPhotoSmall.tif"]];
largePhotoImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"TexturedSliderPhotoLarge.tif"]];
}
- (id)initWithCoder:(NSCoder *)decoder
{
if ((self = [super initWithCoder:decoder]) != nil)
{
indicatorIndex = [decoder decodeIntForKey:@"BWTSIndicatorIndex"];
[self setMinButton:[decoder decodeObjectForKey:@"BWTSMinButton"]];
[self setMaxButton:[decoder decodeObjectForKey:@"BWTSMaxButton"]];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[super encodeWithCoder:coder];
[coder encodeInt:[self indicatorIndex] forKey:@"BWTSIndicatorIndex"];
[coder encodeObject:[self minButton] forKey:@"BWTSMinButton"];
[coder encodeObject:[self maxButton] forKey:@"BWTSMaxButton"];
}
- (int)trackHeight
{
return [[self cell] trackHeight];
}
- (void)setTrackHeight:(int)newTrackHeight
{
[[self cell] setTrackHeight:newTrackHeight];
[self setNeedsDisplay:YES];
}
- (void)setSliderToMinimum
{
[self setDoubleValue:[self minValue]];
[self sendAction:[self action] to:[self target]];
}
- (void)setSliderToMaximum
{
[self setDoubleValue:[self maxValue]];
[self sendAction:[self action] to:[self target]];
}
- (NSView *)hitTest:(NSPoint)aPoint
{
if ([self indicatorIndex] == 0)
return [super hitTest:aPoint];
NSPoint convertedPoint = [self convertPoint:aPoint fromView:nil];
if (NSPointInRect(convertedPoint, minButton.frame))
return minButton;
else if (NSPointInRect(convertedPoint, maxButton.frame))
return maxButton;
else
return [super hitTest:aPoint];
}
- (void)drawRect:(NSRect)aRect
{
aRect = self.bounds;
sliderCellRect = aRect;
if ([self indicatorIndex] == 2)
{
[minButton setFrameOrigin:NSMakePoint(imageInset-19, 3)];
[maxButton setFrameOrigin:NSMakePoint(NSMaxX(self.bounds)-imageInset+4, 3)];
sliderCellRect.size.width -= imageInset * 2;
sliderCellRect.origin.x += imageInset;
}
else if ([self indicatorIndex] == 3)
{
[minButton setFrameOrigin:NSMakePoint(imageInset-7, 4)];
[maxButton setFrameOrigin:NSMakePoint(NSMaxX(self.bounds)-imageInset, 4)];
sliderCellRect.size.width -= imageInset * 2;
sliderCellRect.origin.x += imageInset;
}
[[self cell] drawWithFrame:sliderCellRect inView:self];
}
- (void)setIndicatorIndex:(int)anIndex
{
[minButton removeFromSuperview];
[maxButton removeFromSuperview];
if (indicatorIndex == 0 && (anIndex == 2 || anIndex == 3))
{
NSRect newFrame = self.frame;
newFrame.size.width += imageInset * 2;
newFrame.origin.x -= imageInset;
[self setFrame:newFrame];
}
if ((indicatorIndex == 2 || indicatorIndex == 3) && anIndex == 0)
{
NSRect newFrame = self.frame;
newFrame.size.width -= imageInset * 2;
newFrame.origin.x += imageInset;
[self setFrame:newFrame];
}
if (anIndex == 2)
{
minButton = [[NSButton alloc] initWithFrame:NSMakeRect(0,0,smallPhotoImage.size.width,smallPhotoImage.size.height)];
[minButton setBordered:NO];
[minButton setImage:smallPhotoImage];
[minButton setTarget:self];
[minButton setAction:@selector(setSliderToMinimum)];
[[minButton cell] setHighlightsBy:2];
maxButton = [[NSButton alloc] initWithFrame:NSMakeRect(NSMaxX(self.bounds) - imageInset,0,largePhotoImage.size.width,largePhotoImage.size.height)];
[maxButton setBordered:NO];
[maxButton setImage:largePhotoImage];
[maxButton setTarget:self];
[maxButton setAction:@selector(setSliderToMaximum)];
[[maxButton cell] setHighlightsBy:2];
[self addSubview:minButton];
[self addSubview:maxButton];
}
else if (anIndex == 3)
{
minButton = [[NSButton alloc] initWithFrame:NSMakeRect(0,0,quietSpeakerImage.size.width,quietSpeakerImage.size.height)];
[minButton setBordered:NO];
[minButton setImage:quietSpeakerImage];
[minButton setTarget:self];
[minButton setAction:@selector(setSliderToMinimum)];
[[minButton cell] setHighlightsBy:2];
maxButton = [[NSButton alloc] initWithFrame:NSMakeRect(NSMaxX(self.bounds) - imageInset,0,loudSpeakerImage.size.width,loudSpeakerImage.size.height)];
[maxButton setBordered:NO];
[maxButton setImage:loudSpeakerImage];
[maxButton setTarget:self];
[maxButton setAction:@selector(setSliderToMaximum)];
[[maxButton cell] setHighlightsBy:2];
[self addSubview:minButton];
[self addSubview:maxButton];
}
indicatorIndex = anIndex;
}
- (void)setEnabled:(BOOL)flag
{
[super setEnabled:flag];
[minButton setEnabled:flag];
[maxButton setEnabled:flag];
}
- (void)scrollWheel:(NSEvent*)event
{
/* Scroll wheel movement appears to be specified in terms of pixels, and
definitely not in terms of the values that the slider contains. Because
of this, we'll have to map our current value to pixel space, adjust the
pixel space value, and then map back to value space again. */
CGFloat valueRange = [self maxValue] - [self minValue];
CGFloat valueOffset = [self doubleValue] - [self minValue];
CGFloat pixelRange = [self isVertical] ? NSHeight([self frame]) : NSWidth([self frame]);
CGFloat valueInPixelSpace = ((valueOffset / valueRange) * pixelRange);
/* deltaX and deltaY are 'flipped' from what you'd expect. Scrolling down
produces + Y values, and scrolling left produces + X values. Because we
want left/down scrolling to decrease the value, we adjust accordingly. */
valueInPixelSpace += [event deltaY];
valueInPixelSpace -= [event deltaX];
double newValue = [self minValue] + ((valueInPixelSpace / pixelRange) * valueRange);
[self setFloatValue:newValue];
[self sendAction:[self action] to:[self target]];
}
- (void)dealloc
{
[minButton release];
[maxButton release];
[super dealloc];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTexturedSlider.m | Objective-C | bsd | 6,525 |
//
// BWSelectableToolbar.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWSelectableToolbar.h"
#import "BWSelectableToolbarHelper.h"
#import "NSWindow+BWAdditions.h"
NSString * const BWSelectableToolbarItemClickedNotification = @"BWSelectableToolbarItemClicked";
static BWSelectableToolbar *documentToolbar;
static NSToolbar *editableToolbar;
@interface NSToolbar (BWSTPrivate)
- (id)_defaultItemIdentifiers;
- (id)_window;
- (id)initWithCoder:(NSCoder *)decoder;
- (void)encodeWithCoder:(NSCoder*)coder;
@end
@interface BWSelectableToolbar (BWSTPrivate)
- (NSArray *)selectableItemIdentifiers;
- (void)setItemSelectors;
- (void)initialSetup;
- (void)toggleActiveView:(id)sender;
- (NSString *)identifierAtIndex:(int)index;
- (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)flag;
- (int)toolbarIndexFromSelectableIndex:(int)selectableIndex;
- (void)selectInitialItem;
- (void)selectItemAtIndex:(int)anIndex;
// IBDocument methods
- (void)addObject:(id)object toParent:(id)parent;
- (void)moveObject:(id)object toParent:(id)parent;
- (void)removeObject:(id)object;
- (id)parentOfObject:(id)anObj;
- (NSArray *)objectsforDocumentObject:(id)anObj;
- (NSArray *)childrenOfObject:(id)object;
@end
@interface BWSelectableToolbar ()
@property (retain) BWSelectableToolbarHelper *helper;
@property (readonly) NSMutableArray *labels;
@property (copy) NSMutableDictionary *enabledByIdentifier;
@property BOOL isPreferencesToolbar;
@end
@implementation BWSelectableToolbar
@synthesize helper;
@synthesize isPreferencesToolbar;
@synthesize enabledByIdentifier;
- (BWSelectableToolbar *)documentToolbar
{
return [[documentToolbar retain] autorelease];
}
- (void)setDocumentToolbar:(BWSelectableToolbar *)obj
{
[documentToolbar release];
documentToolbar = [obj retain];
}
- (NSToolbar *)editableToolbar
{
if ([self respondsToSelector:@selector(ibDidAddToDesignableDocument:)] == NO)
return self;
return [[editableToolbar retain] autorelease];
}
- (void)setEditableToolbar:(NSToolbar *)obj
{
if ([self respondsToSelector:@selector(ibDidAddToDesignableDocument:)])
{
// NSLog(@"--self: %@",self);
// NSLog(@"--editable toolbar is: %@",editableToolbar);
// NSLog(@"--setting editable toolbar to: %@",obj);
[editableToolbar release];
editableToolbar = [obj retain];
}
}
- (id)initWithCoder:(NSCoder *)decoder
{
if ((self = [super initWithCoder:decoder]) != nil)
{
[self setDocumentToolbar:[decoder decodeObjectForKey:@"BWSTDocumentToolbar"]];
[self setHelper:[decoder decodeObjectForKey:@"BWSTHelper"]];
isPreferencesToolbar = [decoder decodeBoolForKey:@"BWSTIsPreferencesToolbar"];
[self setEnabledByIdentifier:[decoder decodeObjectForKey:@"BWSTEnabledByIdentifier"]];
// NSLog(@"init with coder. helper decoded: %@", helper);
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[super encodeWithCoder:coder];
[coder encodeObject:[self documentToolbar] forKey:@"BWSTDocumentToolbar"];
[coder encodeObject:[self helper] forKey:@"BWSTHelper"];
[coder encodeBool:isPreferencesToolbar forKey:@"BWSTIsPreferencesToolbar"];
[coder encodeObject:[self enabledByIdentifier] forKey:@"BWSTEnabledByIdentifier"];
// NSLog(@"encode with coder. helper encoded: %@",helper);
}
// When the user drags the toolbar on the canvas, we want the default toolbar items to be a specific set that's more appropriate for a selectable toolbar (in particular,
// for a preferences window). Generally, you would supply these items in your -toolbarDefaultItemIdentifiers: delegate method. However, since Interface Builder stores
// its default item identifiers in user defaults, the delegate method never gets called. To force the toolbar to have a different set of default items, we supply the
// identifiers in this private method.
- (id)_defaultItemIdentifiers
{
NSArray *defaultItemIdentfiers = [super _defaultItemIdentifiers];
NSArray *defaultIBItemIdentifiers = [NSArray arrayWithObjects:@"NSToolbarSeparatorItem",@"NSToolbarSpaceItem",@"NSToolbarFlexibleSpaceItem",nil];
NSArray *idealDefaultItemIdentifiers = [NSArray arrayWithObjects:@"0D5950D1-D4A8-44C6-9DBC-251CFEF852E2",@"BWToolbarShowColorsItem",
@"BWToolbarShowFontsItem",@"7E6A9228-C9F3-4F21-8054-E4BF3F2F6BA8",nil];
if ([defaultItemIdentfiers isEqualToArray:defaultIBItemIdentifiers])
{
return idealDefaultItemIdentifiers;
}
return defaultItemIdentfiers;
}
- (id)initWithIdentifier:(NSString *)identifier
{
if (self = [super initWithIdentifier:identifier])
{
itemIdentifiers = [[NSMutableArray alloc] init];
itemsByIdentifier = [[NSMutableDictionary alloc] init];
selectedIndex = 0;
inIB = YES;
[self setEditableToolbar:self];
[self performSelector:@selector(initialSetup) withObject:nil afterDelay:0];
}
return self;
}
- (void)awakeFromNib
{
if ([self respondsToSelector:@selector(ibDidAddToDesignableDocument:)] == NO)
{
inIB = NO;
if ([helper isPreferencesToolbar])
{
[[self _window] setShowsToolbarButton:NO];
[self setAllowsUserCustomization:NO];
}
[self performSelector:@selector(selectInitialItem) withObject:nil afterDelay:0];
}
}
- (void)selectFirstItem
{
int toolbarIndex = [self toolbarIndexFromSelectableIndex:0];
[self switchToItemAtIndex:toolbarIndex animate:NO];
}
- (void)selectInitialItem
{
// When the window launches, we want to select the toolbar item that was previously selected.
// So we have to find the toolbar index for our saved selected identifier.
int toolbarIndex;
if ([helper selectedIdentifier] != nil)
toolbarIndex = [itemIdentifiers indexOfObject:[helper selectedIdentifier]];
else
toolbarIndex = [self toolbarIndexFromSelectableIndex:0];
[self switchToItemAtIndex:toolbarIndex animate:NO];
}
- (void)initialSetup
{
// Get a reference to the helper object in the document if we don't have one already
if (helper == nil && inIB)
{
NSArray *windowChildren = [self childrenOfObject:[self parentOfObject:documentToolbar]];
for (id anObj in windowChildren)
{
if ([anObj isMemberOfClass:NSClassFromString(@"BWSelectableToolbarHelper")])
{
helper = anObj;
// NSLog(@"Got a reference to helper: %@",helper);
}
}
}
// if (helper == nil && inIB)
// NSLog(@"Helper is nil");
// Get reference to the editable toolbar in IB
if ([self isMemberOfClass:NSClassFromString(@"IBEditableBWSelectableToolbar")])
{
[self setEditableToolbar:self];
if ([helper contentViewsByIdentifier].count == 0)
[helper setInitialIBWindowSize:[[[self editableToolbar] _window] frame].size];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidResize:)
name:NSWindowDidResizeNotification
object:[[self editableToolbar] _window]];
}
NSToolbarItem *currentItem;
for (currentItem in [self items])
{
[itemIdentifiers addObject:[currentItem itemIdentifier]];
[itemsByIdentifier setObject:currentItem forKey:[currentItem itemIdentifier]];
}
[self setDelegate:self];
[self setItemSelectors];
if ([helper selectedIdentifier] != nil && [helper contentViewsByIdentifier].count != 0)
{
// When the actual app is ran or an item is added or removed from the toolbar in IB, we need to select the previously stored identifier
[self selectItemAtIndex:[itemIdentifiers indexOfObject:[helper selectedIdentifier]]];
}
else
{
// If we don't have a stored identifier, we select the first item in the toolbar
[self selectItemAtIndex:[self toolbarIndexFromSelectableIndex:0]];
}
if ([self isMemberOfClass:NSClassFromString(@"IBEditableBWSelectableToolbar")])
{
// When the toolbar is initially dragged onto the canvas, record the content view and size of the window
NSMutableDictionary *tempCVBI = [[[helper contentViewsByIdentifier] mutableCopy] autorelease];
[tempCVBI setObject:[[[self editableToolbar] _window] contentView] forKey:[helper selectedIdentifier]];
[helper setContentViewsByIdentifier:tempCVBI];
NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];
[tempWSBI setObject:[NSValue valueWithSize:[[[self editableToolbar] _window] frame].size] forKey:[helper selectedIdentifier]];
[helper setWindowSizesByIdentifier:tempWSBI];
}
}
- (int)toolbarIndexFromSelectableIndex:(int)selectableIndex
{
NSMutableArray *selectableItems = [[[NSMutableArray alloc] init] autorelease];
for (NSToolbarItem *currentItem in [[self editableToolbar] items])
{
if (![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSeparatorItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSpaceItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarFlexibleSpaceItem"])
{
[selectableItems addObject:currentItem];
}
}
if (selectableItems.count == 0)
return 0;
NSString *item = [selectableItems objectAtIndex:selectableIndex];
int toolbarIndex = [[[self editableToolbar] items] indexOfObject:item];
return toolbarIndex;
}
// Tells the toolbar to draw the selection behind the toolbar item and records the selected item identifier
- (void)selectItemAtIndex:(int)anIndex
{
NSArray *toolbarItems = self.items;
if (toolbarItems.count > 1)
{
NSToolbarItem *item = [toolbarItems objectAtIndex:anIndex];
NSString *identifier = [item itemIdentifier];
[super setSelectedItemIdentifier:identifier];
[helper setSelectedIdentifier:identifier];
}
}
// This is called when a selectable item is clicked. This is not called in IB (-setSelectedIndex: is used instead).
- (void)toggleActiveView:(id)sender
{
NSString *identifier = [sender itemIdentifier];
selectedIndex = [itemIdentifiers indexOfObject:identifier];
[[NSNotificationCenter defaultCenter] postNotificationName:BWSelectableToolbarItemClickedNotification object:self userInfo:[NSDictionary dictionaryWithObject:sender forKey:@"BWClickedItem"]];
[self switchToItemAtIndex:selectedIndex animate:YES];
}
- (void)setItemSelectors
{
NSToolbarItem *currentItem;
for (currentItem in [self items])
{
[currentItem setTarget:self];
[currentItem setAction:@selector(toggleActiveView:)];
}
}
- (NSString *)identifierAtIndex:(int)index
{
NSToolbarItem *item;
NSString *newIdentifier;
if ([[self editableToolbar] items].count > 1)
{
item = [[[self editableToolbar] items] objectAtIndex:index];
newIdentifier = [item itemIdentifier];
}
return newIdentifier;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowDidResizeNotification
object:[[self editableToolbar] _window]];
[itemIdentifiers release];
[itemsByIdentifier release];
[enabledByIdentifier release];
[helper release];
[super dealloc];
}
#pragma mark Public Methods
- (void)setSelectedItemIdentifier:(NSString *)itemIdentifier
{
BOOL validIdentifier = NO;
for (NSString *identifier in itemIdentifiers)
{
if ([identifier isEqualToString:itemIdentifier])
validIdentifier = YES;
}
if (validIdentifier)
[self switchToItemAtIndex:[itemIdentifiers indexOfObject:itemIdentifier] animate:YES];
}
- (void)setSelectedItemIdentifierWithoutAnimation:(NSString *)itemIdentifier
{
BOOL validIdentifier = NO;
for (NSString *identifier in itemIdentifiers)
{
if ([identifier isEqualToString:itemIdentifier])
validIdentifier = YES;
}
if (validIdentifier)
[self switchToItemAtIndex:[itemIdentifiers indexOfObject:itemIdentifier] animate:NO];
}
- (void)setEnabled:(BOOL)flag forIdentifier:(NSString *)itemIdentifier
{
NSMutableDictionary *enabledDict = [[[self enabledByIdentifier] mutableCopy] autorelease];
[enabledDict setObject:[NSNumber numberWithBool:flag] forKey:itemIdentifier];
[self setEnabledByIdentifier:enabledDict];
}
#pragma mark Public Method Support Methods
- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
{
if ([self respondsToSelector:@selector(ibDidAddToDesignableDocument:)] == NO)
{
NSString *identifier = [theItem itemIdentifier];
if ([[self enabledByIdentifier] objectForKey:identifier] != nil)
{
if ([[[self enabledByIdentifier] objectForKey:identifier] boolValue] == NO)
return NO;
}
}
return YES;
}
- (NSMutableDictionary *)enabledByIdentifier
{
if (enabledByIdentifier == nil)
enabledByIdentifier = [NSMutableDictionary new];
return [[enabledByIdentifier retain] autorelease];
}
#pragma mark NSWindow notifications
- (void)windowDidResize:(NSNotification *)notification
{
NSSize size = [[[self editableToolbar] _window] frame].size;
NSValue *sizeValue = [NSValue valueWithSize:size];
NSString *key = [helper selectedIdentifier];
if ([helper selectedIdentifier])
{
NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];
[tempWSBI setObject:sizeValue forKey:key];
[helper setWindowSizesByIdentifier:tempWSBI];
}
}
#pragma mark NSToolbar delegate methods
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
{
return itemIdentifiers;
}
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
{
return itemIdentifiers;
}
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)identifier willBeInsertedIntoToolbar:(BOOL)willBeInserted
{
return [itemsByIdentifier objectForKey:identifier];
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
return [self selectableItemIdentifiers];
}
#pragma mark Support methods for delegate methods
- (NSArray *)selectableItemIdentifiers
{
NSMutableArray *selectableItemIdentifiers = [[[NSMutableArray alloc] init] autorelease];
if ([self editableToolbar] != nil)
{
for (NSToolbarItem *currentItem in [[self editableToolbar] items])
{
if (![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSeparatorItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSpaceItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarFlexibleSpaceItem"])
{
[selectableItemIdentifiers addObject:[currentItem itemIdentifier]];
}
}
}
else
{
for (NSToolbarItem *currentItem in [self items])
{
if (![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSeparatorItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSpaceItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarFlexibleSpaceItem"])
{
[selectableItemIdentifiers addObject:[currentItem itemIdentifier]];
}
}
}
return selectableItemIdentifiers;
}
#pragma mark IB Inspector support methods
- (void)setIsPreferencesToolbar:(BOOL)flag
{
[helper setIsPreferencesToolbar:flag];
isPreferencesToolbar = flag;
if (flag)
{
// Record the current window title
[helper setOldWindowTitle:[[self parentOfObject:self] title]];
// Change the window title to the name of the active tab
NSToolbarItem *selectedItem;
for (NSToolbarItem *item in [[self editableToolbar] items])
{
if ([[item itemIdentifier] isEqualToString:[[self editableToolbar] selectedItemIdentifier]])
selectedItem = item;
}
[[self parentOfObject:self] setTitle:[selectedItem label]];
// Remove the toolbar button
[[self parentOfObject:self] setShowsToolbarButton:NO];
}
else
{
// Restore the old window title
[[self parentOfObject:self] setTitle:[helper oldWindowTitle]];
// Add the toolbar button
[[self parentOfObject:self] setShowsToolbarButton:YES];
}
}
- (NSMutableArray *)labels
{
NSMutableArray *labelArray = [NSMutableArray array];
for (NSToolbarItem *currentItem in [[self editableToolbar] items])
{
if (![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSeparatorItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarSpaceItem"] &&
![[currentItem itemIdentifier] isEqualToString:@"NSToolbarFlexibleSpaceItem"])
{
[labelArray addObject:[currentItem label]];
}
}
return labelArray;
}
- (int)selectedIndex
{
// The actual selected index can change on us (for instance, when the user re-orders toolbar items). So we need to figure it out dynamically, based on the selected identifier.
if ([[helper selectedIdentifier] isEqualToString:@""])
selectedIndex = 0;
else
selectedIndex = [[self selectableItemIdentifiers] indexOfObject:[helper selectedIdentifier]];
return selectedIndex;
}
- (void)setSelectedIndex:(int)anIndex
{
selectedIndex = anIndex;
[self switchToItemAtIndex:[self toolbarIndexFromSelectableIndex:anIndex] animate:YES];
}
#pragma mark Selection Switching
- (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)shouldAnimate
{
NSString *oldIdentifier = [helper selectedIdentifier];
// Put the selection highlight on the toolbar item
[(BWSelectableToolbar *)[self editableToolbar] selectItemAtIndex:anIndex];
// Clear out the window's first responder
[[[self editableToolbar] _window] makeFirstResponder:nil];
// Make a new container view and add it to the IB document
NSView *containerView = [[[NSView alloc] initWithFrame:[[[[self editableToolbar] _window] contentView] frame]] autorelease];
if (inIB)
[self addObject:containerView toParent:[self parentOfObject:self]];
// Move the subviews from the content view to the container view
NSArray *oldSubviews = [[[[[[self editableToolbar] _window] contentView] subviews] copy] autorelease];
for (NSView *view in oldSubviews)
{
if (inIB)
[self moveObject:view toParent:containerView];
[containerView addSubview:view];
}
// Store the container view and window size in the dictionaries
NSMutableDictionary *tempCVBI = [[[helper contentViewsByIdentifier] mutableCopy] autorelease];
[tempCVBI setObject:containerView forKey:oldIdentifier];
[helper setContentViewsByIdentifier:tempCVBI];
NSSize oldWindowSize = [[[self editableToolbar] _window] frame].size;
NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];
[tempWSBI setObject:[NSValue valueWithSize:oldWindowSize] forKey:oldIdentifier];
[helper setWindowSizesByIdentifier:tempWSBI];
NSString *newIdentifier = [self identifierAtIndex:anIndex];
if ([[helper contentViewsByIdentifier] objectForKey:newIdentifier] == nil) // If we haven't stored the content view in our dictionary. i.e. this is a new tab
{
// Resize the window
[[[self editableToolbar] _window] resizeToSize:[helper initialIBWindowSize] animate:shouldAnimate];
// Record the new tab content view and window size
if (inIB)
{
NSMutableDictionary *tempCVBI = [[[helper contentViewsByIdentifier] mutableCopy] autorelease];
[tempCVBI setObject:[[[self editableToolbar] _window] contentView] forKey:newIdentifier];
[helper setContentViewsByIdentifier:tempCVBI];
NSMutableDictionary *tempWSBI = [[[helper windowSizesByIdentifier] mutableCopy] autorelease];
[tempWSBI setObject:[NSValue valueWithSize:[[[self editableToolbar] _window] frame].size] forKey:newIdentifier];
[helper setWindowSizesByIdentifier:tempWSBI];
}
}
else // If we have the content view in our dictionary, set the window's content view to be the saved view
{
// Resize the window
NSSize windowSize = [[[helper windowSizesByIdentifier] objectForKey:newIdentifier] sizeValue];
[[[self editableToolbar] _window] resizeToSize:windowSize animate:shouldAnimate];
NSArray *newSubviews = [[[[[helper contentViewsByIdentifier] objectForKey:newIdentifier] subviews] copy] autorelease];
if (newSubviews.count > 0 && newSubviews != nil)
{
for (NSView *view in newSubviews)
{
if (inIB)
{
[self moveObject:view toParent:[[self parentOfObject:self] contentView]];
}
[[[[self editableToolbar] _window] contentView] addSubview:view];
}
}
// Remove the container view for the selected tab from the document since those items are now in the window's content view.
if (inIB)
[self removeObject:[[helper contentViewsByIdentifier] objectForKey:newIdentifier]];
// Tell the window to recalculate the key view loop so the views we added to the content view are keyboard accessible
[[[self editableToolbar] _window] recalculateKeyViewLoop];
}
// After the new content view is swapped in, change the window title to be the selected item label
if ([helper isPreferencesToolbar])
{
for (NSToolbarItem *item in [[self editableToolbar] items])
{
if ([[item itemIdentifier] isEqualToString:newIdentifier])
{
[[[self editableToolbar] _window] setTitle:[item label]];
if (inIB)
[[self parentOfObject:self] setTitle:[item label]];
}
}
}
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWSelectableToolbar.m | Objective-C | bsd | 20,570 |
//
// BWAnchoredButtonBarViewIntegration.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
#import "BWAnchoredButtonBar.h"
#import "BWAnchoredButtonBarInspector.h"
@implementation BWAnchoredButtonBar ( BWAnchoredButtonBarIntegration )
- (void)ibPopulateKeyPaths:(NSMutableDictionary *)keyPaths {
[super ibPopulateKeyPaths:keyPaths];
[[keyPaths objectForKey:IBAttributeKeyPaths] addObjectsFromArray:[NSArray arrayWithObjects:@"selectedIndex", nil]];
}
- (void)ibPopulateAttributeInspectorClasses:(NSMutableArray *)classes {
[super ibPopulateAttributeInspectorClasses:classes];
[classes addObject:[BWAnchoredButtonBarInspector class]];
}
- (NSArray *)ibDefaultChildren
{
return [self subviews];
}
- (NSView *)ibDesignableContentView
{
return self;
}
- (NSSize)ibMinimumSize
{
NSSize minSize = NSZeroSize;
if (isAtBottom)
minSize.height = 23;
else
minSize.height = 24;
return minSize;
}
- (NSSize)ibMaximumSize
{
NSSize maxSize;
maxSize.width = 100000;
if (isAtBottom)
maxSize.height = 23;
else
maxSize.height = 24;
return maxSize;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButtonBarIntegration.m | Objective-C | bsd | 1,221 |
//
// BWControlsInspector.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTexturedSliderInspector.h"
@implementation BWTexturedSliderInspector
- (NSString *)viewNibName {
return @"BWTexturedSliderInspector";
}
- (void)refresh {
// Synchronize your inspector's content view with the currently selected objects.
[super refresh];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTexturedSliderInspector.m | Objective-C | bsd | 434 |
//
// BWTransparentScrollView.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTransparentScrollView.h"
#import "BWTransparentScroller.h"
@implementation BWTransparentScrollView
- (id)initWithCoder:(NSCoder *)decoder;
{
if ((self = [super initWithCoder:decoder]) != nil)
{
if ([self respondsToSelector:@selector(ibTester)] == NO)
[self setDrawsBackground:NO];
}
return self;
}
+ (Class)_verticalScrollerClass
{
return [BWTransparentScroller class];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentScrollView.m | Objective-C | bsd | 566 |
//
// BWToolkitFramework.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
// This is a convenience header for importing the BWToolkit framework into your classes.
#import "BWAnchoredButton.h"
#import "BWAnchoredButtonBar.h"
#import "BWAnchoredButtonCell.h"
#import "BWAnchoredPopUpButton.h"
#import "BWAnchoredPopUpButtonCell.h"
#import "BWInsetTextField.h"
#import "BWSelectableToolbar.h"
#import "BWSheetController.h"
#import "BWSplitView.h"
#import "BWTexturedSlider.h"
#import "BWTexturedSliderCell.h"
#import "BWTokenAttachmentCell.h"
#import "BWTokenField.h"
#import "BWTokenFieldCell.h"
#import "BWToolbarItem.h"
#import "BWToolbarShowColorsItem.h"
#import "BWToolbarShowFontsItem.h"
#import "BWTransparentButton.h"
#import "BWTransparentButtonCell.h"
#import "BWTransparentCheckbox.h"
#import "BWTransparentCheckboxCell.h"
#import "BWTransparentPopUpButton.h"
#import "BWTransparentPopUpButtonCell.h"
#import "BWTransparentScroller.h"
#import "BWTransparentScrollView.h"
#import "BWTransparentSlider.h"
#import "BWTransparentSliderCell.h"
#import "BWTransparentTableView.h"
#import "BWTransparentTableViewCell.h"
#import "BWTransparentTextFieldCell.h"
#import "BWUnanchoredButton.h"
#import "BWUnanchoredButtonCell.h"
| 08iteng-ipad | TestMerge/bwtoolkit/BWToolkitFramework.h | Objective-C | bsd | 1,310 |
//
// BWTransparentScrollView.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWTransparentScrollView : NSScrollView
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentScrollView.h | Objective-C | bsd | 247 |
//
// BWToolbarShowColorsItem.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWToolbarShowColorsItem : NSToolbarItem
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWToolbarShowColorsItem.h | Objective-C | bsd | 248 |
//
// BWAnchoredButtonBar.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWAnchoredButtonBar : NSView
{
BOOL isResizable;
BOOL isAtBottom;
int selectedIndex;
id splitViewDelegate;
}
@property BOOL isResizable;
@property BOOL isAtBottom;
@property int selectedIndex;
// The mode of this bar with a resize handle makes use of some NSSplitView delegate methods. Use the splitViewDelegate for any custom delegate implementations
// you'd like to provide.
@property (assign) id splitViewDelegate;
+ (BOOL)wasBorderedBar;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWAnchoredButtonBar.h | Objective-C | bsd | 649 |
//
// BWToolbarItemInspector.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWToolbarItemInspector.h"
@implementation BWToolbarItemInspector
- (NSString *)viewNibName {
return @"BWToolbarItemInspector";
}
- (void)refresh {
// Synchronize your inspector's content view with the currently selected objects
[super refresh];
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWToolbarItemInspector.m | Objective-C | bsd | 430 |
//
// NSColor+BWAdditions.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface NSColor (BWAdditions)
// Use this method to draw 1 px wide lines independent of scale factor. Handy for resolution independent drawing. Still needs some work - there are issues with drawing at the edges of views.
- (void)drawPixelThickLineAtPosition:(int)posInPixels withInset:(int)insetInPixels inRect:(NSRect)aRect inView:(NSView *)view horizontal:(BOOL)isHorizontal flip:(BOOL)shouldFlip;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/NSColor+BWAdditions.h | Objective-C | bsd | 592 |
//
// BWToolbarShowFontsItem.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWToolbarShowFontsItem.h"
@implementation BWToolbarShowFontsItem
- (NSImage *)image
{
NSBundle *bundle = [NSBundle bundleForClass:[BWToolbarShowFontsItem class]];
NSImage *image = [[[NSImage alloc] initWithContentsOfFile:[bundle pathForImageResource:@"ToolbarItemFonts.tiff"]] autorelease];
return image;
}
- (NSString *)itemIdentifier
{
return @"BWToolbarShowFontsItem";
}
- (NSString *)label
{
return @"Fonts";
}
- (NSString *)paletteLabel
{
return @"Fonts";
}
- (id)target
{
return [NSApplication sharedApplication];
}
- (SEL)action
{
return @selector(orderFrontFontPanel:);
}
- (NSString *)toolTip
{
return @"Show Font Panel";
}
@end | 08iteng-ipad | TestMerge/bwtoolkit/BWToolbarShowFontsItem.m | Objective-C | bsd | 825 |
//
// BWUnanchoredButtonContainerIntegration.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
#import "BWUnanchoredButtonContainer.h"
#import "BWUnanchoredButton.h"
@implementation BWUnanchoredButtonContainer ( BWUnanchoredButtonContainerIntegration )
- (NSSize)ibMinimumSize
{
return NSMakeSize(45,22);
}
- (NSSize)ibMaximumSize
{
return NSMakeSize(45,22);
}
- (BOOL)ibIsChildInitiallySelectable:(id)child
{
return NO;
}
- (NSArray *)ibDefaultChildren
{
return [self subviews];
}
- (NSView *)ibDesignableContentView
{
return self;
}
- (IBInset)ibLayoutInset
{
IBInset inset;
inset.left = 0;
inset.top = 1;
inset.bottom = 1;
inset.right = 0;
return inset;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWUnanchoredButtonContainerIntegration.m | Objective-C | bsd | 819 |
//
// BWToolkit.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
@interface BWToolkit : IBPlugin {
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWToolkit.h | Objective-C | bsd | 242 |
//
// BWSplitViewInspector.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <InterfaceBuilderKit/InterfaceBuilderKit.h>
#import "BWSplitView.h"
#import "BWSplitViewInspectorAutosizingView.h"
@interface BWSplitViewInspector : IBInspector
{
IBOutlet NSTextField *maxField, *minField, *maxLabel, *minLabel;
IBOutlet NSButton *dividerCheckbox;
IBOutlet BWSplitViewInspectorAutosizingView *autosizingView;
int subviewPopupSelection, collapsiblePopupSelection, minUnitPopupSelection, maxUnitPopupSelection;
NSMutableArray *subviewPopupContent, *collapsiblePopupContent;
BWSplitView *splitView;
BOOL dividerCheckboxCollapsed;
}
@property int subviewPopupSelection, collapsiblePopupSelection, minUnitPopupSelection, maxUnitPopupSelection;
@property (copy) NSMutableArray *subviewPopupContent, *collapsiblePopupContent;
@property (retain) BWSplitView *splitView;
@property BOOL dividerCheckboxCollapsed;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWSplitViewInspector.h | Objective-C | bsd | 1,004 |
//
// BWInsetTextField.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface BWInsetTextField : NSTextField
{
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWInsetTextField.h | Objective-C | bsd | 232 |
//
// BWTransparentButtonCell.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
#import "BWTransparentButton.h"
@interface BWTransparentButtonCell : NSButtonCell
{
NSColor *interiorColor;
}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTransparentButtonCell.h | Objective-C | bsd | 303 |
//
// NSEvent+BWAdditions.h
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import <Cocoa/Cocoa.h>
@interface NSEvent (BWAdditions)
+ (BOOL)shiftKeyIsDown;
+ (BOOL)commandKeyIsDown;
+ (BOOL)optionKeyIsDown;
+ (BOOL)controlKeyIsDown;
+ (BOOL)capsLockKeyIsDown;
@end
| 08iteng-ipad | TestMerge/bwtoolkit/NSEvent+BWAdditions.h | Objective-C | bsd | 349 |
//
// BWTokenAttachmentCell.m
// BWToolkit
//
// Created by Brandon Walkin (www.brandonwalkin.com)
// All code is provided under the New BSD license.
//
#import "BWTokenAttachmentCell.h"
static NSGradient *blueGradient, *blueStrokeGradient, *blueInsetGradient, *highlightedBlueGradient, *highlightedBlueStrokeGradient, *highlightedBlueInsetGradient, *arrowGradient;
static NSShadow *textShadow;
static NSColor *highlightedArrowColor;
static float arrowWidth = 7.0;
static float arrowHeight = 6.0;
@interface NSTokenAttachmentCell (BWTACPrivate)
- (NSDictionary *)_textAttributes;
@end
@interface BWTokenAttachmentCell (BWTACPrivate)
+ (NSImage *)arrowInHighlightedState:(BOOL)isHighlighted;
@end
@implementation BWTokenAttachmentCell
+ (void)initialize
{
NSColor *blueTopColor = [NSColor colorWithCalibratedRed:217.0/255.0 green:228.0/255.0 blue:254.0/255.0 alpha:1];
NSColor *blueBottomColor = [NSColor colorWithCalibratedRed:195.0/255.0 green:212.0/255.0 blue:250.0/255.0 alpha:1];
blueGradient = [[NSGradient alloc] initWithStartingColor:blueTopColor endingColor:blueBottomColor];
NSColor *blueStrokeTopColor = [NSColor colorWithCalibratedRed:164.0/255.0 green:184.0/255.0 blue:230.0/255.0 alpha:1];
NSColor *blueStrokeBottomColor = [NSColor colorWithCalibratedRed:122.0/255.0 green:128.0/255.0 blue:199.0/255.0 alpha:1];
blueStrokeGradient = [[NSGradient alloc] initWithStartingColor:blueStrokeTopColor endingColor:blueStrokeBottomColor];
NSColor *blueInsetTopColor = [NSColor colorWithCalibratedRed:226.0/255.0 green:234.0/255.0 blue:254.0/255.0 alpha:1];
NSColor *blueInsetBottomColor = [NSColor colorWithCalibratedRed:206.0/255.0 green:221.0/255.0 blue:250.0/255.0 alpha:1];
blueInsetGradient = [[NSGradient alloc] initWithStartingColor:blueInsetTopColor endingColor:blueInsetBottomColor];
NSColor *highlightedBlueTopColor = [NSColor colorWithCalibratedRed:80.0/255.0 green:127.0/255.0 blue:251.0/255.0 alpha:1];
NSColor *highlightedBlueBottomColor = [NSColor colorWithCalibratedRed:65.0/255.0 green:107.0/255.0 blue:236.0/255.0 alpha:1];
highlightedBlueGradient = [[NSGradient alloc] initWithStartingColor:highlightedBlueTopColor endingColor:highlightedBlueBottomColor];
NSColor *highlightedBlueStrokeTopColor = [NSColor colorWithCalibratedRed:51.0/255.0 green:95.0/255.0 blue:248.0/255.0 alpha:1];
NSColor *highlightedBlueStrokeBottomColor = [NSColor colorWithCalibratedRed:42.0/255.0 green:47.0/255.0 blue:233.0/255.0 alpha:1];
highlightedBlueStrokeGradient = [[NSGradient alloc] initWithStartingColor:highlightedBlueStrokeTopColor endingColor:highlightedBlueStrokeBottomColor];
NSColor *highlightedBlueInsetTopColor = [NSColor colorWithCalibratedRed:92.0/255.0 green:137.0/255.0 blue:251.0/255.0 alpha:1];
NSColor *highlightedBlueInsetBottomColor = [NSColor colorWithCalibratedRed:76.0/255.0 green:116.0/255.0 blue:236.0/255.0 alpha:1];
highlightedBlueInsetGradient = [[NSGradient alloc] initWithStartingColor:highlightedBlueInsetTopColor endingColor:highlightedBlueInsetBottomColor];
NSColor *arrowGradientTopColor = [NSColor colorWithCalibratedRed:111.0/255.0 green:140.0/255.0 blue:222.0/255.0 alpha:1];
NSColor *arrowGradientBottomColor = [NSColor colorWithCalibratedRed:58.0/255.0 green:91.0/255.0 blue:203.0/255.0 alpha:1];
arrowGradient = [[NSGradient alloc] initWithStartingColor:arrowGradientTopColor endingColor:arrowGradientBottomColor];
textShadow = [[NSShadow alloc] init];
[textShadow setShadowOffset:NSMakeSize(0,1 / [[NSScreen mainScreen] userSpaceScaleFactor])];
[textShadow setShadowColor:[[NSColor blackColor] colorWithAlphaComponent:0.3]];
highlightedArrowColor = [[NSColor colorWithCalibratedRed:246.0/255.0 green:249.0/255.0 blue:254.0/255.0 alpha:1] retain];
}
- (NSImage *)arrowInHighlightedState:(BOOL)isHighlighted
{
float scaleFactor = [[NSScreen mainScreen] userSpaceScaleFactor];
NSImage *arrowImage = [[[NSImage alloc] init] autorelease];
[arrowImage setSize:NSMakeSize(arrowWidth, arrowHeight)];
[arrowImage setFlipped:YES];
[arrowImage lockFocus];
NSPoint p1 = NSMakePoint(0,0);
NSPoint p2 = NSMakePoint(arrowWidth,0);
NSPoint p3 = NSMakePoint(arrowWidth / 2, arrowHeight - 1 / scaleFactor);
NSBezierPath *triangle = [NSBezierPath bezierPath];
[triangle moveToPoint:p1];
[triangle lineToPoint:p2];
[triangle lineToPoint:p3];
[triangle lineToPoint:p1];
p1 = NSMakePoint(0, 1 / scaleFactor);
p2 = NSMakePoint(arrowWidth, 1 / scaleFactor);
p3 = NSMakePoint(arrowWidth / 2, arrowHeight);
NSBezierPath *triangle2 = [NSBezierPath bezierPath];
[triangle2 moveToPoint:p1];
[triangle2 lineToPoint:p2];
[triangle2 lineToPoint:p3];
[triangle2 lineToPoint:p1];
if (isHighlighted)
{
// Draw shadow
[[[NSColor blackColor] colorWithAlphaComponent:0.2] set];
[triangle fill];
// Draw arrow
[highlightedArrowColor set];
[triangle2 fill];
}
else
{
// Draw shadow
[[[NSColor whiteColor] colorWithAlphaComponent:0.75] set];
[triangle2 fill];
// Draw arrow
[arrowGradient drawInBezierPath:triangle angle:90];
}
[arrowImage unlockFocus];
return arrowImage;
}
- (void)drawTokenWithFrame:(NSRect)aRect inView:(NSView *)aView;
{
float scaleFactor = [[NSScreen mainScreen] userSpaceScaleFactor];
NSRect drawingRect = [self drawingRectForBounds:aRect];
NSRect insetRect = NSInsetRect(drawingRect, 1 / scaleFactor, 1 / scaleFactor);
NSRect insetRect2 = NSInsetRect(insetRect, 1 / scaleFactor, 1 / scaleFactor);
if (scaleFactor < 0.99 || scaleFactor > 1.01)
{
drawingRect = [aView centerScanRect:drawingRect];
insetRect = [aView centerScanRect:insetRect];
insetRect2 = [aView centerScanRect:insetRect2];
}
NSBezierPath *drawingPath = [NSBezierPath bezierPathWithRoundedRect:drawingRect xRadius:0.5*drawingRect.size.height yRadius:0.5*drawingRect.size.height];
NSBezierPath *insetPath = [NSBezierPath bezierPathWithRoundedRect:insetRect xRadius:0.5*insetRect.size.height yRadius:0.5*insetRect.size.height];
NSBezierPath *insetPath2 = [NSBezierPath bezierPathWithRoundedRect:insetRect2 xRadius:0.5*insetRect2.size.height yRadius:0.5*insetRect2.size.height];
if (_tacFlags._selected == NO)
{
[blueStrokeGradient drawInBezierPath:drawingPath angle:90];
[blueInsetGradient drawInBezierPath:insetPath angle:90];
[blueGradient drawInBezierPath:insetPath2 angle:90];
}
else
{
[highlightedBlueStrokeGradient drawInBezierPath:drawingPath angle:90];
[highlightedBlueInsetGradient drawInBezierPath:insetPath angle:90];
[highlightedBlueGradient drawInBezierPath:insetPath2 angle:90];
}
// Darken on mouse over
CGFloat red, blue, green, alpha;
[[self tokenBackgroundColor] getRed:&red green:&green blue:&blue alpha:&alpha];
if (red > 0.427 && red < 0.428)
{
[[NSColor colorWithCalibratedRed:32.0/255.0 green:59.0/255.0 blue:167.0/255.0 alpha:0.1] set];
[NSGraphicsContext saveGraphicsState];
[[NSGraphicsContext currentContext] setCompositingOperation:NSCompositePlusDarker];
[drawingPath fill];
[NSGraphicsContext restoreGraphicsState];
}
}
- (int)interiorBackgroundStyle
{
// If the token isn't selected, tell NSCell to draw a white shadow below the text
if (_tacFlags._selected == NO)
return NSBackgroundStyleRaised;
return [super interiorBackgroundStyle];
}
- (NSDictionary *)_textAttributes
{
if (_tacFlags._selected)
{
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] init] autorelease];
[attributes addEntriesFromDictionary:[super _textAttributes]];
[attributes setObject:textShadow forKey:NSShadowAttributeName];
return attributes;
}
return [super _textAttributes];
}
- (id)pullDownImage
{
NSImage *arrowImage;
if (_tacFlags._selected)
arrowImage = [self arrowInHighlightedState:YES];
else
arrowImage = [self arrowInHighlightedState:NO];
return arrowImage;
}
- (NSRect)pullDownRectForBounds:(NSRect)bounds
{
NSRect pullDownRect = [super pullDownRectForBounds:bounds];
pullDownRect.origin.x--;
if (!_tacFlags._selected)
pullDownRect.origin.y++;
float scaleFactor = [[NSScreen mainScreen] userSpaceScaleFactor];
if (scaleFactor < 0.99 || scaleFactor > 1.01)
pullDownRect = [[self controlView] centerScanRect:pullDownRect];
return pullDownRect;
}
// --- For testing menu arrows ---
//- (BOOL)_hasMenu
//{
// return YES;
//}
@end
| 08iteng-ipad | TestMerge/bwtoolkit/BWTokenAttachmentCell.m | Objective-C | bsd | 8,310 |