Re: How to Write MissionControl/Expose Replacement

2012-08-18 Thread Commodore 64

On Aug 18, 2012, at 11:08 PM, "Glenn L. Austin"  wrote:

> On Aug 18, 2012, at 4:48 PM, Commodore 64  wrote:
> 
>> Because MissionControl is not spatially stable.  The windows keep moving 
>> around and you always have to search for it visually.  Its useless for a 
>> power user.
> 
> Which windows, what what do *you* mean by "spatially stable?"
> 

I forgot to mention another project that uses spatially stable metaphor.  
Basically I want to rewrite MissionControl to be more like TabCandy for Firefox.

http://www.azarask.in/blog/post/tabcandy/

Anyone who is willing to help me get started and also participate in coding is 
more than welcome.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to Write MissionControl/Expose Replacement

2012-08-18 Thread Commodore 64
On Aug 18, 2012, at 11:08 PM, "Glenn L. Austin"  wrote:

> On Aug 18, 2012, at 4:48 PM, Commodore 64  wrote:
> 
>> Because MissionControl is not spatially stable.  The windows keep moving 
>> around and you always have to search for it visually.  Its useless for a 
>> power user.
> 
> Which windows, what what do *you* mean by "spatially stable?"
> 

Spatially stable means that MissionControl/Exposé does not try at all to keep a 
window where you last saw it.  Here is how to repro it:

1)  Open yourselves a dozen or so windows.
2)  Invoke MissionControl/Exposé.
3)  Notice the position of your favorite window, say Mail.  Perhaps it is in 
the lower-left corner?
4)  Keep working and invoke it again after diong something.
5)  Mail may now all of a sudden appear in the top-right corner for example.  
This is specially true if you close some of the windows that you had opened 
last time.

This mandates that the user visually scans for a window in Exposé every time 
after invocation and may take a few seconds to visually find a window.  Almost 
all the time, during a context switch, I take so long to find a window that 
when I find it, I forget why I wanted to switch to it in the first 
place---especially if I have to use the space bar to temporarily zoom in to see 
what that small thumbnail is all about.

You can rethink it in terms of, for example, comparing it to driving home from 
work everyday.  When you go home, you don't look at the street names to find 
out where your home is.  You just know it by position; you simply and 
unconsciously know which turn to take as you drive.  It is in your spatial 
memory.  Contrast this to someone lifting your home and placing it in a 
different neighborhood randomly by 15 miles everyday and sending you its new 
address before you leave work.  Now you will need a GPS and have to look at 
which streets you are turning into when you drive home.  This is MissionControl 
and Exposé my friend.  Takes much longer to find what you need.

I want to rewrite a variant of WindowScape.  The idea is that _you_ control 
where each thumbnail goes on the screen.  Each thumbnail stays where you left 
it and never moves.  You can make is so small that is is barely readable, but 
you will still know which window it is because _you_ put it there.  This is how 
the human brain works---by memorizing the spatial position of objects.

For more, please see the research project:

http://www.cc.gatech.edu/pixi/wp-content/uploads/WindowScape-Tashman.pdf


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to Write MissionControl/Expose Replacement

2012-08-18 Thread Glenn L. Austin
On Aug 18, 2012, at 4:48 PM, Commodore 64  wrote:

> Because MissionControl is not spatially stable.  The windows keep moving 
> around and you always have to search for it visually.  Its useless for a 
> power user.

Which windows, what what do *you* mean by "spatially stable?"

If you mean that the screen order changes? That's an option in the Mission 
Control preferences pane ("Automatically rearrange spaces based on most recent 
use").  If you mean by the order of the applications on each screen, then that 
could be an issue.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver <><
"Where there's breath, there's hope!"



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Jens Alfke

On Aug 18, 2012, at 11:29 AM, Koen van der Drift  
wrote:

>> This is a good start. I believe "user stylesheet" is the term of art for a 
>> local override stylesheet. From a quick Google, the relevant APIs are on the 
>> WebPreferences class: -setUserStyleSheetEnabled: and 
>> -setUserStyleSheetLocation:. You could start with one of the common "reset" 
>> stylesheets and customize it from there.
> 
> I tried that, but the settings in my css file are not used.

That will establish default values, but values in page stylesheets will still 
override them. If you want your values to override those on the page, add the 
"!important" modifier to them.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to Write MissionControl/Expose Replacement

2012-08-18 Thread Lee Ann Rucker
For items 1 and 2, start with the "SonOfGrab" sample app. Everything you need 
to know about window contents is in there. I tweaked it heavily to make a 
utility for getting live updates of windows on other Spaces for debugging. 
(Alas, windows do not report their Space ID - a public but optional dictionary 
value - in Mountain Lion, so it's less useful now.)

As for the rest of it - even if you could find a way to modify windows without 
asking their app nicely, you'll probably break some of them.

- Original Message -
From: "Commodore 64" 
To: "CocoaDev list" 
Sent: Saturday, August 18, 2012 2:26:33 PM
Subject: How to Write MissionControl/Expose Replacement

I'd like to know how to how to write my own MissionControl/Exposè replacement 
for Mountain Lion.  I am very new to Cocoa, and this might be my first project 
with Cocoa.

For those of us who think it might not be possible, it is already done in 
TotalSpaces (http://totalspaces.binaryage.com).  Whether its a good idea to 
write a basic OS feature replacement remains to be debated.

I am wondering how to do the following basic things.

1)  I am going to need to know how to get a list of all open windows including 
full-screen apps.  I'll need to iterate over these and get a preview image of 
these.  How do I get this?  Will the technique work for all apps written is any 
framework, or will it only work for apps written in Cocoa?  What about legacy 
Carbon apps?

2)  I'll also need to get notified that a particular window was resized, so 
that I can update my thumbnail images.  MissionControl thumbnails are live---as 
the source window updates, the thumbnails also update.  I'd like to support 
this, and would like to know how.

3)  Once the user selects which windows to bring to top, I'd like to 
programmatically hide the others that don't belong to the current Space.  How 
does one hide a window?

4)  Animation.  I have read a book on Core Animation, so I know some bits and 
pieces.  I am thinking that I will need to create a CALayer, draw every 
thumbnail on it, place the CALayer on top of everything on the desktop, do the 
animation, and then hide the CALayer.  

5)  I'd like to control the action that the window is about to take when the 
user clicks the minimize button.  How does one do this?  I'd like to perform my 
own custom animation.

6)  And finally, I'd like to intercept CMD-TAB and like to do my own thing.

Any pointers on these topics will be greatly appreciated.  I'll also like to 
know if someone has done an open source project that does similar things so 
that I can get the idea.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com

This email sent to lruc...@vmware.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to Write MissionControl/Expose Replacement

2012-08-18 Thread Commodore 64

On Aug 18, 2012, at 4:37 PM, Charles Srstka  wrote:

> On Aug 18, 2012, at 4:26 PM, Commodore 64  wrote:
> 
>> I'd like to know how to how to write my own MissionControl/Exposè 
>> replacement for Mountain Lion.  I am very new to Cocoa, and this might be my 
>> first project with Cocoa.
> 
> ... Why?
> 

Because MissionControl is not spatially stable.  The windows keep moving around 
and you always have to search for it visually.  Its useless for a power user.

Please see:  http://www.cc.gatech.edu/~craig/windowscape.htm



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to Write MissionControl/Expose Replacement

2012-08-18 Thread Charles Srstka
On Aug 18, 2012, at 4:26 PM, Commodore 64  wrote:

> I'd like to know how to how to write my own MissionControl/Exposè replacement 
> for Mountain Lion.  I am very new to Cocoa, and this might be my first 
> project with Cocoa.

... Why?

Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Calculating row heights for view-based table rows, on re-use throws error

2012-08-18 Thread Erik Stainsby
Thanks for the thought Fritz. Removing my ham-handed attempt to purge the 
tableView of its rows indeed resolved the out of range error.

On 2012-08-18, at 8:24 AM, Fritz Anderson  wrote:

>> My expectation is that I ought to be able to clear the table (iterating 
>> through the rows and applying -removeRowsAtIndexes:withAnimation:  to 
>> discard the present rowViews, and start clean with the next record to be 
>> displayed, generating new rowViews as needed (because the number of 
>> component elements (phone numbers/email addresses/etc) will vary from one 
>> record to the next). 
> 
> Not a good expectation, if you are altering a collection while you are 
> iterating it. (You imply that's what you're doing, but it's not clear.) Doing 
> so leaves the collection in an inconsistent condition, and anything that 
> depends on the collection will have invalid data. (But see next paragraph.) 
> The table view might, for instance, try to index to a row for which the 
> backing data no longer exists.

I am now left with the two simple problems of 
a) trying to remove populated but out dated tableRowViews from the tableView, 
and 
b) establishing the correct rowHeight for each subsequent reuse of the 
tableView.

Any advice on where to start reading appreciated.

~ Erik


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to Write MissionControl/Expose Replacement

2012-08-18 Thread Commodore 64
I'd like to know how to how to write my own MissionControl/Exposè replacement 
for Mountain Lion.  I am very new to Cocoa, and this might be my first project 
with Cocoa.

For those of us who think it might not be possible, it is already done in 
TotalSpaces (http://totalspaces.binaryage.com).  Whether its a good idea to 
write a basic OS feature replacement remains to be debated.

I am wondering how to do the following basic things.

1)  I am going to need to know how to get a list of all open windows including 
full-screen apps.  I'll need to iterate over these and get a preview image of 
these.  How do I get this?  Will the technique work for all apps written is any 
framework, or will it only work for apps written in Cocoa?  What about legacy 
Carbon apps?

2)  I'll also need to get notified that a particular window was resized, so 
that I can update my thumbnail images.  MissionControl thumbnails are live---as 
the source window updates, the thumbnails also update.  I'd like to support 
this, and would like to know how.

3)  Once the user selects which windows to bring to top, I'd like to 
programmatically hide the others that don't belong to the current Space.  How 
does one hide a window?

4)  Animation.  I have read a book on Core Animation, so I know some bits and 
pieces.  I am thinking that I will need to create a CALayer, draw every 
thumbnail on it, place the CALayer on top of everything on the desktop, do the 
animation, and then hide the CALayer.  

5)  I'd like to control the action that the window is about to take when the 
user clicks the minimize button.  How does one do this?  I'd like to perform my 
own custom animation.

6)  And finally, I'd like to intercept CMD-TAB and like to do my own thing.

Any pointers on these topics will be greatly appreciated.  I'll also like to 
know if someone has done an open source project that does similar things so 
that I can get the idea.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: stripped down webview

2012-08-18 Thread Evadne Wu
You can use the DOM: dynamically create a Script tag then allow it to
load more stuff by abusing -stringByEvaluatingJavaScriptFromString: .

On Aug 18, 2012, at 2:51 PM, Koen van der Drift
 wrote:

> Is there a similar way to inject an external javascript.js file into my 
> webView? I think I can use that to strip out the divs I don't want to show.
>
>
>
> On Aug 18, 2012, at 3:32 PM, Koen van der Drift  
> wrote:
>
>>
>> On Aug 18, 2012, at 3:26 PM, Matt Patenaude  wrote:
>>
>>> Ah! Your problem is URLWithString:. You want fileURLWithPath:. :)
>>
>> Well spotted, thanks!
>>
>> - Koen.
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/ev%40monoceroi.com
>
> This email sent to e...@monoceroi.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Koen van der Drift
Is there a similar way to inject an external javascript.js file into my 
webView? I think I can use that to strip out the divs I don't want to show.



On Aug 18, 2012, at 3:32 PM, Koen van der Drift  
wrote:

> 
> On Aug 18, 2012, at 3:26 PM, Matt Patenaude  wrote:
> 
>> Ah! Your problem is URLWithString:. You want fileURLWithPath:. :)
> 
> Well spotted, thanks!
> 
> - Koen.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Koen van der Drift

On Aug 18, 2012, at 3:26 PM, Matt Patenaude  wrote:

> Ah! Your problem is URLWithString:. You want fileURLWithPath:. :)

Well spotted, thanks!

- Koen.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Matt Patenaude
Ah! Your problem is URLWithString:. You want fileURLWithPath:. :)

-Matt

Sent from my iPhone

On Aug 18, 2012, at 12:12 PM, Koen van der Drift  
wrote:

> 
> On Aug 18, 2012, at 2:46 PM, Matt Patenaude  wrote:
> 
>> User stylesheets should work just fine, so you should try to figure out 
>> what's going wrong with that. Perhaps don't use standardPreferences; use 
>> [self.webView setPreferencesIdentifier:@"mySpecialPreferences"] to generate 
>> a new preferences object for your WebView, then [self.webView preferences] 
>> to get a preferences object to customize.
> 
> Nope, still doen't work, the custom css is not used.  Unless I did something 
> wrong:
> 
>[self.webView setPreferencesIdentifier: @"mySpecialPreferences"];
> 
>WebPreferences  *prefs = [self.webView preferences];
>[prefs setJavaScriptEnabled: YES];
>[prefs setCacheModel: WebCacheModelDocumentBrowser];
>[prefs setPlugInsEnabled: YES];
> 
>NSString *path = [[NSBundle mainBundle] pathForResource: @"default" 
> ofType: @"css"];
>NSURL *cssUrl = [NSURL URLWithString: path];
> 
>[prefs setUserStyleSheetEnabled: YES];
>[prefs setUserStyleSheetLocation: cssUrl];
> 
>[self.webView setPreferences: prefs];
> 
> 
> 
>> 
>> If that still doesn't work, why don't you just hide your WebView and show a 
>> spinner while it's loading, and then after it loads and you've injected your 
>> stylesheets, show it?
> 
> The delay is a separate issue, but this works great to prevent it.  Thanks!
> 
> - Koen.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Koen van der Drift

On Aug 18, 2012, at 2:46 PM, Matt Patenaude  wrote:

> User stylesheets should work just fine, so you should try to figure out 
> what's going wrong with that. Perhaps don't use standardPreferences; use 
> [self.webView setPreferencesIdentifier:@"mySpecialPreferences"] to generate a 
> new preferences object for your WebView, then [self.webView preferences] to 
> get a preferences object to customize.

Nope, still doen't work, the custom css is not used.  Unless I did something 
wrong:

[self.webView setPreferencesIdentifier: @"mySpecialPreferences"];

WebPreferences  *prefs = [self.webView preferences];
[prefs setJavaScriptEnabled: YES];
[prefs setCacheModel: WebCacheModelDocumentBrowser];
[prefs setPlugInsEnabled: YES];

NSString *path = [[NSBundle mainBundle] pathForResource: @"default" ofType: 
@"css"];
NSURL *cssUrl = [NSURL URLWithString: path];

[prefs setUserStyleSheetEnabled: YES];
[prefs setUserStyleSheetLocation: cssUrl];

[self.webView setPreferences: prefs];



> 
> If that still doesn't work, why don't you just hide your WebView and show a 
> spinner while it's loading, and then after it loads and you've injected your 
> stylesheets, show it?

The delay is a separate issue, but this works great to prevent it.  Thanks!

- Koen.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Matt Patenaude
User stylesheets should work just fine, so you should try to figure out what's 
going wrong with that. Perhaps don't use standardPreferences; use [self.webView 
setPreferencesIdentifier:@"mySpecialPreferences"] to generate a new preferences 
object for your WebView, then [self.webView preferences] to get a preferences 
object to customize.

If that still doesn't work, why don't you just hide your WebView and show a 
spinner while it's loading, and then after it loads and you've injected your 
stylesheets, show it?

-Matt

On Aug 18, 2012, at 11:29 AM, Koen van der Drift  
wrote:

> 
> On Aug 18, 2012, at 1:40 PM, Kyle Sluder  wrote:
> 
>> This is a good start. I believe "user stylesheet" is the term of art for a 
>> local override stylesheet. From a quick Google, the relevant APIs are on the 
>> WebPreferences class: -setUserStyleSheetEnabled: and 
>> -setUserStyleSheetLocation:. You could start with one of the common "reset" 
>> stylesheets and customize it from there.
> 
> 
> I tried that, but the settings in my css file are not used.
> 
>   WebPreferences  *prefs = [WebPreferences standardPreferences];
>[prefs setJavaScriptEnabled: YES];
>[prefs setCacheModel: WebCacheModelDocumentBrowser];
>[prefs setPlugInsEnabled: YES];
> 
>NSString *path = [[NSBundle mainBundle] pathForResource: @"default" 
> ofType: @"css"];
>NSURL *css = [NSURL URLWithString: path];
> 
>[prefs setUserStyleSheetEnabled: YES];
>[prefs setUserStyleSheetLocation: css];
> 
>[self.webView setPreferences: prefs];
> 
> 
> 
> So I am now hacking in the DOM, and this way I can add my stylesheet:
> 
>   NSError *error = nil;
> 
>   DOMDocument* domDocument = [webView mainFrameDocument];
>DOMElement* styleElement = [domDocument createElement: @"style"];
>[styleElement setAttribute: @"type" value: @"text/css"];
> 
>   NSString *path = [[NSBundle mainBundle] pathForResource: @"default" 
> ofType: @"css"];
>NSString *css = [NSString stringWithContentsOfFile: path encoding: 
> NSUTF8StringEncoding error: &error];
>   
>DOMText *cssText = [domDocument createTextNode: css];
>   [styleElement appendChild: cssText];
>   
>   DOMElement* headElement= (DOMElement*)[[domDocument 
> getElementsByTagName: @"head"] item:0];
>   [headElement appendChild:styleElement];
> 
> 
> This way the css gets inserted into the DOM, but I still have the delay.
> 
> 
> I am open for any suggestions/improvements :)
> 
> - Koen.
> 
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/matt%40mattpatenaude.com
> 
> This email sent to m...@mattpatenaude.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Koen van der Drift

On Aug 18, 2012, at 1:40 PM, Kyle Sluder  wrote:

> This is a good start. I believe "user stylesheet" is the term of art for a 
> local override stylesheet. From a quick Google, the relevant APIs are on the 
> WebPreferences class: -setUserStyleSheetEnabled: and 
> -setUserStyleSheetLocation:. You could start with one of the common "reset" 
> stylesheets and customize it from there.


I tried that, but the settings in my css file are not used.

   WebPreferences  *prefs = [WebPreferences standardPreferences];
[prefs setJavaScriptEnabled: YES];
[prefs setCacheModel: WebCacheModelDocumentBrowser];
[prefs setPlugInsEnabled: YES];

NSString *path = [[NSBundle mainBundle] pathForResource: @"default" ofType: 
@"css"];
NSURL *css = [NSURL URLWithString: path];

[prefs setUserStyleSheetEnabled: YES];
[prefs setUserStyleSheetLocation: css];

[self.webView setPreferences: prefs];



So I am now hacking in the DOM, and this way I can add my stylesheet:

NSError *error = nil;
   
DOMDocument* domDocument = [webView mainFrameDocument];
 DOMElement* styleElement = [domDocument createElement: @"style"];
 [styleElement setAttribute: @"type" value: @"text/css"];
   
NSString *path = [[NSBundle mainBundle] pathForResource: @"default" 
ofType: @"css"];
 NSString *css = [NSString stringWithContentsOfFile: path encoding: 
NSUTF8StringEncoding error: &error];

 DOMText *cssText = [domDocument createTextNode: css];
[styleElement appendChild: cssText];

DOMElement* headElement= (DOMElement*)[[domDocument 
getElementsByTagName: @"head"] item:0];
[headElement appendChild:styleElement];


This way the css gets inserted into the DOM, but I still have the delay.


I am open for any suggestions/improvements :)

- Koen.






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: help indexer or hiutil help

2012-08-18 Thread Ben Kennedy
On 18 Aug 2012, at 10:32 am, Matt Neuburg  wrote:

> Try the apple-help-authoring list. And be accurate; I'm sure you're not 
> really calling your help index MyHelp.index (are you???). Also, does your 
> help actually *use* anchors? You won't find any unless there are some. m.

Anchors have never worked for me.  I've defined them both in old-style  and modern  formats, yet hiutil seems to ignore them.  Years 
ago I gave up and started settling for opening help pages at the top-of-page.

Have always been puzzled why the help system seems so needlessly arcane.

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Kyle Sluder
On Aug 18, 2012, at 4:24 AM, Koen van der Drift  
wrote:

> In my OS X app I show some webpages in a WebView, but I'd like to show them 
> stripped down, remove clutter, e.g. as is done in Evernote and other apps. 
> 
> Any suggestions where to start? Maybe use a local css file?

This is a good start. I believe "user stylesheet" is the term of art for a 
local override stylesheet. From a quick Google, the relevant APIs are on the 
WebPreferences class: -setUserStyleSheetEnabled: and 
-setUserStyleSheetLocation:. You could start with one of the common "reset" 
stylesheets and customize it from there.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: help indexer or hiutil help

2012-08-18 Thread Matt Neuburg
On Thu, 16 Aug 2012 20:46:17 -0500, Shane 
 said:
>On Fri, Aug 10, 2012 at 4:12 PM, Shane
> wrote:
>> I'm trying to use Help Indexer.app after a long while and a few
>> upgrades of a working help project. When trying to select the
>> MyHelp.help bundle, I can't because its grayed out. Any ideas?
>>
>> But I can get into the bundle on the command line, so I go into the
>> dirs and try to use hiutil as shown in the man page (-Caf), and then
>> follow up with hiutil -Af, but it keeps returning null.
>>
>> $ hiutil -Caf ./MyHelp.index . (tried current dir, top level dir, etc...)
>> $ hiutil -Af ./MyHelp.index
>> (null)
>>
>> My structure looks like this.
>> MyHelp.help/
>>`- Contents/
>> |- Info.plist
>> `- Resources
>> |- English.proj\
>> |  |- MyHelp.html
>> |  |- MyHelp.helpindex
>> |  |- InfoPlist.strings
>> |  |- ...
>> |
>> `- Shared
>>
>> Any help much appreciated.
>
>Shameless bump. Anyone?

Try the apple-help-authoring list. And be accurate; I'm sure you're not really 
calling your help index MyHelp.index (are you???). Also, does your help 
actually *use* anchors? You won't find any unless there are some. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Jens Alfke

On Aug 18, 2012, at 8:26 AM, Steve Christensen  wrote:

> How about asynchronously downloading the page HTML into a string, doing a 
> text replace of the name of the CSS file to your local one, then passing the 
> modified HTML to the web view?

Doesn't work if there are style rules directly in the HTML, which is not 
uncommon.

Also, parsing HTML is kind of a minefield given the sort of malformed tag-soup 
that's common on teh interwebz.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to (slowly) rotate a view

2012-08-18 Thread Matt Neuburg
On Mon, 06 Aug 2012 00:11:39 +0700, "Gerriet M. Denkmann" 
 said:
> I use this code (iOS 5.1):
>   CGAffineTransform m = { c, +s, -s, c, 0, 0 };   //  rotation, s = 
> sin(angle), c = cos(angle)
>   CALayer *layer = self.view.layer;   //  view is UIView, self is 
> subclass of UIViewController
>   [ CATransaction begin];
>   [ CATransaction setAnimationDuration: 9 ];
>   [ layer setAffineTransform: m ];
>   [ CATransaction commit];
>The view rotates ok, but does it instantly, instead of taking 9 seconds.
>
>What am I doing wrong?

You are attempting to use implicit property animation (setAffineTransform:) on 
a view's primary layer. You can't do that; the property will change, but it 
won't animate. To get animation on that particular layer, you must use explicit 
animation (CABasicAnimation) or view animation. Explained here:

http://www.apeth.com/iOSBook/ch17.html

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: loading UIView in correct orientation

2012-08-18 Thread Matt Neuburg
On Fri, 03 Aug 2012 23:22:17 +0700, "Gerriet M. Denkmann" 
 said:
>
>I have a subclass of UIViewController which displays a small view in the 
>center of the display.
>shouldAutorotateToInterfaceOrientation: returns YES.
>This view is only shown on demand.
>
>
>The problem:
>If the device is in Portrait-Up position when the ViewController is created 
>then everything is fine.
>Otherwise the centered view is loaded in the wrong position, and I have to 
>rotate the device by 90° and back again, to get the centered view right.

Same answer as the email I just sent. Rotation of views, and especially the 
problem of launching into a rotated interface, is well discussed in my book, in 
that same chapter:

http://www.apeth.com/iOSBook/ch19.html

You're falling prey to an elementary mistake, namely setting up the 
size/position of the view too early (in response to the wrong event). m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: rotating UIView without changing size

2012-08-18 Thread Matt Neuburg
On Sat, 04 Aug 2012 00:39:43 +0700, "Gerriet M. Denkmann" 
 said:
>If I understand this correctly, I have to do:
>create a view controller for my basicView (currently there is none) and 
>use [ basicViewController addChildViewController: sliderViewController ] and 
>not use [ self addSubview: self.sliderView ];
>
>Anything else I have to do?
>Any sample code, where I could study this? 
>Any documentation I should read (about the containment API)?
>Any WWDC videos I should watch?
>
>The View Controller Programming Guide for iOS says: "The area each view 
>controller fills is determined by its parent." But how?

Sorry to come in so late here, but it happens that the view hierarchy and the 
view controller hierarchy and how they must fit together is one of the things 
that is particularly well explained in my book, and you can even read the 
relevant chapter online:

http://www.apeth.com/iOSBook/ch19.html

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Steve Christensen
How about asynchronously downloading the page HTML into a string, doing a text 
replace of the name of the CSS file to your local one, then passing the 
modified HTML to the web view?

Sent from my iPhone

On Aug 18, 2012, at 6:52 AM, Koen van der Drift  
wrote:

> 
> On Aug 18, 2012, at 7:24 AM, Koen van der Drift  
> wrote:
> 
>> In my OS X app I show some webpages in a WebView, but I'd like to show them 
>> stripped down, remove clutter, e.g. as is done in Evernote and other apps. 
>> 
>> Any suggestions where to start? Maybe use a local css file?
>> 
> 
> 
> Answering to myself...
> 
> 
> Alright, I found some clues on SO, and am now able to replace the css file 
> with my own by tweaking the DOMDocument.  The only place I could think of to 
> do this is in
> 
> - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
> 
> But since the webview loads asynchronously,  I first see the page with the 
> original css for a second or two, and then it changes to the page using my 
> local css file only after the whole page has loaded.
> 
> Is there another place where I could hook into so the page shows correctly 
> immediately?  
> 
> 
> Next is to strip the DOM form all elements I don't need :)
> 
> - Koen.
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/punster%40mac.com
> 
> This email sent to puns...@mac.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calculating row heights for view-based table rows, on re-use throws error

2012-08-18 Thread Fritz Anderson
On 17 Aug 2012, at 9:15 PM, Erik Stainsby  wrote:

> I have a view-based table in which there are four distinct row types, 
> representing distinct object types which may appear. The tableRowViews are in 
> the nib and represented in the code here as xxxCellView entities. 
> 
> 
> - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
> 
>   id obj = [_content objectAtIndex:row];

Notice that here you call objectAtIndex:, I assume from within your class 
RSTableController.

> 2012-08-17 18:51:52.767 RSSuperContactsX[24075:303] *** -[__NSArrayM 
> objectAtIndex:]: index 6 beyond bounds [0 .. 5]

Notice that the system finds you have passed an illegal index to 
objectAtIndex:...

>   2   CoreFoundation  0x7fff900455dc -[__NSArrayM 
> objectAtIndex:] + 252
>   3   RSSuperContactsX0x000130f5 
> -[RSTableController tableView:heightOfRow:] + 101

... from within your -[RSTableController tableView:heightOfRow:].

> My expectation is that I ought to be able to clear the table (iterating 
> through the rows and applying -removeRowsAtIndexes:withAnimation:  to discard 
> the present rowViews, and start clean with the next record to be displayed, 
> generating new rowViews as needed (because the number of component elements 
> (phone numbers/email addresses/etc) will vary from one record to the next). 

Not a good expectation, if you are altering a collection while you are 
iterating it. (You imply that's what you're doing, but it's not clear.) Doing 
so leaves the collection in an inconsistent condition, and anything that 
depends on the collection will have invalid data. (But see next paragraph.) The 
table view might, for instance, try to index to a row for which the backing 
data no longer exists.

UNLESS: You bracket your alterations to the table with -beginUpdates and 
-endUpdates.

> I have no iterator code running at the time this error occurs, so I suspect I 
> have failed to correctly setup some aspect of the tableView/rowView 
> mechanics.  Does anything suggest itself to anyone ? 

The table view itself is iterating your rows.


By the way, heed the documentation for -beginUpdates :

> Note that these methods should be called to reflect changes in your model; 
> they do not make any underlying model changes.



— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Apple Aperture-like look & feel

2012-08-18 Thread Steven Woolgar

otool is your friend when you want to find these things out.

Aperture, Logic and the other Apple Pro apps use a framework called 
ProKit.  It is internal and private.


See: /System/Library/PrivateFrameworks/ProKit.framework
The images are in a custom binary file: 
/System/Library/PrivateFrameworks/ProKit.framework/Versions/A/Resources/ProThemeBits.car



W.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: stripped down webview

2012-08-18 Thread Koen van der Drift

On Aug 18, 2012, at 7:24 AM, Koen van der Drift  
wrote:

> In my OS X app I show some webpages in a WebView, but I'd like to show them 
> stripped down, remove clutter, e.g. as is done in Evernote and other apps. 
> 
> Any suggestions where to start? Maybe use a local css file?
> 


Answering to myself...


Alright, I found some clues on SO, and am now able to replace the css file with 
my own by tweaking the DOMDocument.  The only place I could think of to do this 
is in

- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame

But since the webview loads asynchronously,  I first see the page with the 
original css for a second or two, and then it changes to the page using my 
local css file only after the whole page has loaded.

Is there another place where I could hook into so the page shows correctly 
immediately?  


Next is to strip the DOM form all elements I don't need :)

- Koen.





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


stripped down webview

2012-08-18 Thread Koen van der Drift
In my OS X app I show some webpages in a WebView, but I'd like to show them 
stripped down, remove clutter, e.g. as is done in Evernote and other apps. 

Any suggestions where to start? Maybe use a local css file?


- Koen.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com