Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - Add Apple Dictionary popup for selected words
Add Apple Dictionary popup for selected words
 
   NeoOffice Forum Index -> NeoOffice New Feature Requests
View previous topic :: View next topic  
Author Message
hinkmond
Blue Pill


Joined: Jan 08, 2010
Posts: 1

PostPosted: Fri Jan 08, 2010 5:02 pm    Post subject: Add Apple Dictionary popup for selected words

Hi Patrick,

It was great to meet you and Fran today. Here's the new feature request I talked about earlier:

Apple Dictionary dialog box should be popped up by selecting a word in your document, bring up the popup menu and then select "Look Up In Dictionary".

The example screenshots of how Scrivener does this are attached in this request:

See:
Attachment #1: Select word, bring up popup menu, select "Look Up In Dictionary"
Attachment #2: Apple Dictionary dialog pops up with the definition

Thanks!
Hinkmond
By the way, NeoOffice works great with Scrivener (with their export files to ODT feature)! Using the two together is a natural fit. See: http://www.literatureandlatte.com/scrivener.html
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Fri Jan 08, 2010 7:13 pm    Post subject:

I looked at the TextEdit application in Mac OS X 10.4.x, 10.5.x, and 10.6.x and it looks that this "Look Up In Dictionary" menu is new in Mac OS X 10.6.x Snow Leopard.

Edit by pluby: I was wrong. Mac OS X 10.4.x and later support this feature. To use it in TextEdit in pre-Snow Leopard versions of TextEdit, place the mouse over the word and press Command-Control-D.

I am not sure how TextEdit is invoking the dictionary and I would have to investigate the following two details before I can determine if this new feature is feasible and, if so, estimate how much programming work this feature would require for me to implement:

1. Since NeoOffice documents allow you to specify the language to use for certain portions of text, does Mac OS X allow us to tell the Dictionary application to show the entry for the language that the selected word is set to in your document?

2. Are functions for querying the Dictionary application's word list to see if the word exists?

Before I spend a lot of time investigating these details, I would like to know if it is a feature that lots of other NeoOffice donors have been wishing for. If any other donors would like to see this feature, please post and let us know.

If a dozen or so donors tell us that this would be a really valuable feature, I will start my investigation to see if we can implement this feature.

Patrick
Back to top
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Fri Jan 08, 2010 11:52 pm    Post subject:

pluby wrote:
Edit by pluby: I was wrong. Mac OS X 10.4.x and later support this feature. To use it in TextEdit in pre-Snow Leopard versions of TextEdit, place the mouse over the word and press Command-Control-D.

I am not sure how TextEdit is invoking the dictionary and I would have to investigate the following two details before I can determine if this new feature is feasible

There's 0 documentation about how this lookup works at ADC (at least the last time I looked), since all the support for it is automatic ("free") in Cocoa apps using standard Cocoa text-system stuff. Here's some information I gathered previously, though, about implementing the Cmd-Ctrl-D dictionary lookup (it also exists as the "select and choose the context menu item" in Safari 4 and TextEdit on 10.5; it might be in Safari 4 on 10.4, too):

Quote:
Smokey Ardisson (no bugmail - do not email) 2009-04-01 22:38:56 PDT

(In reply to comment #32)
> Does finishing the OS X Services implementation have any bearing on this?

If HÃ¥kan's "new" theory in the second half of comment 27 is correct and if the
Services implementation provides them, perhaps. Otherwise, no Wink

I looked at ADC not too long ago and still couldn't find any documentation on
what the hover-based Cmd-Ctrl-D lookup required to work; it's a black box.
(For instance, OOo Aqua does have Accessibility support that more-or-less works
with VoiceOver, Cmd-Ctrl-D does not work there.)

[reply] [-] Comment 34 Simon Fraser 2009-04-01 22:56:24 PDT

You have to implement the NSTextInput protocol on one of your NSViews.

(Simon Fraser being an Apple engineer who, among other things, works on WebKit.)

pluby wrote:
1. Since NeoOffice documents allow you to specify the language to use for certain portions of text, does Mac OS X allow us to tell the Dictionary application to show the entry for the language that the selected word is set to in your document?

From experimentation, it seems not; the Dictionary will always look up the word in whatever dictionary is set as the default (top item in the list) in the Dictionary.app preferences.

pluby wrote:
2. Are functions for querying the Dictionary application's word list to see if the word exists?

I'd guess not, since it just returns "No entries found" when you look up a word that doesn't have a match in the default dictionary.

pluby wrote:
Before I spend a lot of time investigating these details, I would like to know if it is a feature that lots of other NeoOffice donors have been wishing for. If any other donors would like to see this feature, please post and let us know.

My guess is that this is going to be a lot of thrashing around in the dark trying to figure out exactly what's needed, since the support is free in Cocoa text fields and the only place I know that it works that doesn't use standard Cocoa text widgets is WebKit (i.e., the content area in Safari).

Smokey

_________________
"[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Back to top
djpimley
The Anomaly
(earlier version)


Joined: Jun 11, 2006
Posts: 481
Location: Great Britain

PostPosted: Sat Jan 09, 2010 2:17 am    Post subject:

I don't know if this adds any value, but I thought I should mention it: Mellel uses the exact same method to invoke the Apple dictionary (and has done since 10.4.) Mellel is a Cocoa application though.
Back to top
djpimley
The Anomaly
(earlier version)


Joined: Jun 11, 2006
Posts: 481
Location: Great Britain

PostPosted: Wed Jan 13, 2010 4:14 am    Post subject:

sardisson wrote:
There's 0 documentation about how this lookup works at ADC

I had a little look, out of curiosity. Is this documentation any help?
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Wed Jan 13, 2010 9:47 am    Post subject:

djpimley wrote:
sardisson wrote:
There's 0 documentation about how this lookup works at ADC

I had a little look, out of curiosity. Is this documentation any help?


This is very helpful and I think these functions can be used to do the native lookup and popup window to display.

I would still need to integrate these functions into NeoOffice's underlying OpenOffice.org code. Since that will probably be more than a trivial amount of work, I would still like to see at least a handful more donors tell us they want this feature before I commit to this feature.

Are there any other donors that want to see this feature?

Patrick
Back to top
djpimley
The Anomaly
(earlier version)


Joined: Jun 11, 2006
Posts: 481
Location: Great Britain

PostPosted: Wed Jan 13, 2010 4:36 pm    Post subject:

I think it would be a very nice addition. I am constantly looking up words in Safari while browsing articles on the web and I would be pleased to be able to do the same in Writer. The look-up is great because it provides a true dictionary function rather than simply a spell-check, which - correct me if I'm wrong - is all Writer can offer at present.
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Wed Jan 13, 2010 4:42 pm    Post subject:

pluby wrote:
This is very helpful and I think these functions can be used to do the native lookup and popup window to display.


I have an update: I don't need the "DCM" functions at all and, instead, I would invoke the following function:

NSPerform(@"Look Up in Dictionary", NSPasteboard *pasteboardContainginWordToLookUp)

This would launch the Dictionary application and lookup the word just TextEdit's "Look Up in Dictionary" menu. More importantly, this function works in Mac OS X 10.4.x whereas the the "DCM" funtions do not.

Patrick
Back to top
rays
The Anomaly
(earlier version)


Joined: Sep 23, 2004
Posts: 475
Location: Geneva, Switzerland

PostPosted: Wed Jan 13, 2010 11:37 pm    Post subject:

Adding this feature would certainly give NeoOffice yet more integration with the native Mac environment in a seemless and natural way. I think it will be very popular with my users if it can be done. As you know, I work in a mixed language organization and our users are often checking that their/they're Exclamation choices are the appropriate ones in the current context.
_________________
Ray Saunders
World Scout Bureau
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Wed Jan 20, 2010 1:02 pm    Post subject:

Do any other donors want to see this feature in NeoOffice? We have 4 NeoOffice donors that have posted that they want to see this feature but I would like to see at least a handful more donors also post before I put a lot of time into implementing this feature.

FYI. I have done a little preliminary work on this earlier this week and I have figured out how to implement one of the key changes that is needed for this feature to work in Writer. The key change is determining the current word that is underneath the cursor and the highlighting that word.

In Writer there are 3 different cases that I got this working for: regular document text, comments, and floating frames. I assume that I would have to do similar implementation to get this working in Calc and Impress but I wanted to start with Writer as that is the NeoOffice module that this feature is most likely to be used in.

Now that I can detect the word under the cursor, sending it to the Dictionary service is fairly easy. The remaining key change that needs to be done get this feature fully working in Writer is inserting the localized "Look Up in Dictionary" menu in the popup menu that appears when you Control-click on a word.

Patrick
Back to top
ovvldc
Captain Naiobi


Joined: Sep 13, 2004
Posts: 2352
Location: Zürich, CH

PostPosted: Thu Jan 21, 2010 3:21 am    Post subject:

I feel the same as for many other mac features: not essential, but nice. I wouldn't use it very often now, because I work in languages that I am fluent in, but I may well move to a place where I would need to look up words very often Smile.

Best wishes,
Oscar

_________________
"What do you think of Western Civilization?"
"I think it would be a good idea!"
- Mohandas Karamchand Gandhi
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Thu Jan 21, 2010 8:37 am    Post subject:

ovvldc wrote:
I feel the same as for many other mac features: not essential, but nice. I wouldn't use it very often now, because I work in languages that I am fluent in, but I may well move to a place where I would need to look up words very often Smile.


If it helps you or other donors, there is already a NeoOffice :: Services :: Look Up in Dictionary menu in NeoOffice. If you select a word and then select that menu, the same action that was requested in this feature request will occur and the Dictionary application will launch and show the entry for your selected word.

Essentially, the feature request is to reduce the steps to access the Dictionary by adding the same menu in the contextual popup menu that you see when you Control-click or right-click on a word.

Patrick
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Mon Feb 08, 2010 1:04 am    Post subject:

I had a little extra time this weekend and I think I have been able to implement this feature in Writer. With this new feature, you should be able to Control-click or right click in any word and the popup menu that appears will have a localized "Look Up in Dictionary" menu item. If you select that menu item, the word that the cursor is in will be sent to the Mac OS X Dictionary service which, in turn, will open Apple's Dictionary application.

Can anyone install the following test patch and tell us if the new feature works for you?:

Intel:
http://joe.neooffice.org/test/NeoOffice-3.0.2-Patch-0-Test-5-Intel.dmg

PowerPC:
http://joe.neooffice.org/test/NeoOffice-3.0.2-Patch-0-Test-5-PowerPC.dmg

Patrick
Back to top
rays
The Anomaly
(earlier version)


Joined: Sep 23, 2004
Posts: 475
Location: Geneva, Switzerland

PostPosted: Mon Feb 08, 2010 1:24 am    Post subject:

Sweet!

Works for me in English but possible strange side effect when I switch System Preferences language to French. This may be caused by something else as I only switched to French to re-launch NeoOffice to see if it would pick-up the French dictionary and noticed that the menus - with the exception of the NeoOffice menu itself - did not switch language?

Other apps (e.g. Safari) switch all menu languages as before.

Of course, one of the few French words actually recognised is "bonjour" - attributed to Apple!

[edited to delete unnecessary PS]

_________________
Ray Saunders
World Scout Bureau
Back to top
Samwise
Captain Naiobi


Joined: Apr 25, 2006
Posts: 2315
Location: Montpellier, France

PostPosted: Mon Feb 08, 2010 3:29 am    Post subject:

Ray, it sounds like you set the language to English in Preferences > Paramètres Linguistiques > Langues.
Should be set to Default if you want to use the topmost language in System Preferences > International.
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice New Feature Requests All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.