Am 17.09.2010 um 07:57 schrieb Jens Nöckel:

> 
> On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote:
> 
>> Am 17.09.2010 um 06:31 schrieb Jens Nöckel:
>> 
>>> 
>>> On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote:
>>> 
>>>> 
>>>> On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote:
>>>> 
>>>>> Le 05/06/2010 18:45, Jens Nöckel a écrit :
>>>>>> So my question to the LyX dev team would be: could you add a preference 
>>>>>> item that lets the user set some flag, so that the call
>>>>>> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
>>>>>> can be made dependent on that flag? Maybe the simplest place to put this 
>>>>>> in would be not in the Preferences, but in the Mac-only part of the LyX 
>>>>>> menu. But on the other hand, that wouldn't look very consistent - so the 
>>>>>> Preferences, under "Keyboard/Mouse" would perhaps be the most logical 
>>>>>> location where to add such a flag. Any ideas on that would be great - 
>>>>>> I'm sure it should be possible to add a little extra button somewhere.
>>>>> 
>>>>> This should be done in a way that does not break with qt < 4.6.
>>>>> 
>>>>> JMarc
>>>> 
>>>> I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and 
>>>> successfully connected it to a checkbox in the Keyboard Preferences. The 
>>>> default value is false (meaning the current standard behavior - this 
>>>> follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the 
>>>> line
>>>> 
>>>>    
>>>> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta);
>>>> 
>>>> in  GuiApplication::execBatchCommands()
>>>> 
>>>> right after
>>>> 
>>>> #ifdef Q_WS_MACX
>>>> 
>>>> Everything is working great. I can set the preference and it gets applied 
>>>> when the application is re-launched (maybe one could apply it immediately, 
>>>> but I wasn't sure how I can then make sure that the menu shortcuts are 
>>>> updated to display the correct modifier keys). If anyone sees something 
>>>> wrong with this approach, please let me know.
>>>> 
>>>> To avoid problems with earlier Qt versions, I will (but haven't yet) 
>>>> enclose all my code in: 
>>>> 
>>>> #if QT_VERSION > 0x040600
>>>> ...
>>>> #endif
>>>> 
>>>> and if it isn't already there, I'll also put in 
>>>> #ifdef Q_WS_MACX
>>>> ...
>>>> #endif
>>>> 
>>>> All my testing was done with the official lyx-1.6.1 source release, so my 
>>>> next hurdle will be to get an SVN version to build. I haven't tried that 
>>>> for several years, so I may have some  questions tomorrow... if all else 
>>>> fails, I could perhaps just send the diffs to the official release.
>>>> 
>>>> Jens
>>>> 
>>>> 
>>> 
>>> Hi again,
>>> it's been a while, but now I have a patch for lyx-devel/trunk that 
>>> implements the customizable switching of Control and Modifier keys on Mac 
>>> OS X for LyX 2.0 with Qt 4.6.
>> 
>> Hi Jens,
>> 
>> I'm not the nestor here but I'd like to welcome you.
>> 
>>> Although I still have (at least) one open problem, maybe someone here wants 
>>> to try it out (I tested it and it works with the svn checkout):
>>> 
>>> <modifierKey.diff.zip>
>>> 
>>> As a brief explanation: By setting a preference, you decide whether Ctrl 
>>> and Meta are swapped next time LyX starts up (as is currently hard-coded in 
>>> LyX/Mac), or not (as many emacs users prefer).
>> 
>> (Sorry, I should have raised my hand earlier.)
>> 
>> I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it 
>> and decided I don't like it. 
>> I don't know any application where you can swap Ctrl and Meta. Neither on 
>> MacOSX nor on Windows or Linux.
>> The option to do so with Qt4 makes me think that this shouldn't be done at 
>> application level. 
>> It should be a global Qt preference. That's my personal opinion. But of 
>> course it's a matter of taste...
>> Is there any other application using that feature (except emacs I guess)?
>> 
>>> My main question is still the following: 
>>> There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines 
>>> the role of Control and Apple keys, but this new UI element will appear for 
>>> all versions of Qt and all platforms, even though it has an effect only 
>>> with Qt >= 4.6 (in the other files, my changes are only applied when the 
>>> right OS and version is detected). In order to make this checkbox disappear 
>>> when it's not needed, what is the best approach? Is there a Qt or LyX 
>>> directive for conditional UI elements that I could use in PrefInput.ui 
>>> (similar to compiler directives as in my previous post)? My guess is that 
>>> the answer is no. 
>> 
>> I don't know, but I would look for a function to hide the UI element 
>> conditionally.
>> 
>> Perhaps it is enough to have that preference without UI at first, document 
>> it and ask users later about the 
>> acceptance and how urgent the UI is needed.
>> 
>>> An alternative would be to patch PrefInput.ui at the configure stage when 
>>> MacOSX is detected.
>> 
>> This is not that nice. You have to move to something like PrefInput.ui.in 
>> for SVN check-in and remove the real PrefInput.ui from VCS.
>> Next you have to care for at least 3 build systems - autotools, cmake and 
>> scons. I would strongly vote against that move.
>> 
>>> But there I would need advice from someone who knows the LyX build system.
>> 
>> 
>> Two formal points:
>> * You sent a patch of 4k size as zip file - so you make it impossible to 
>> view it inline. 
>> I had the patch to save and unpack to read it. :(
>> * The indentation of your code is by blanks. The convention is to use tabs.
>> 
>> Stephan
> 
> Hi Stephan,
> it would be OK with me to just have a preference without UI, but I wanted to 
> explore the UI because Pavel already gave me a nice starting point for how to 
> do it (earlier in this thread). 

I can understand you very good.

(I cannot see Pavels E-Mails in this thread - but that's not the point, 
non-relevant).

> Anyway, about the philosophical reasons for why this is an issue in need of 
> fixing, see the LyX Wiki (the discussion goes back many years, so I can't 
> repeat it all here): http://wiki.lyx.org/Mac/LyXmodifierKeys

I took a quick look. And had the idea to make the default for the new RC 
variable dynamic. It can depend on the keyboard binding.
When mac.bind is used make it false, for emacs.bind make it true.

> Regarding a global Qt option: can that work if the libs are included as a 
> private framework?

I don't know if global Qt options exist and how they work if any. But, I'd 
guess the storage of that would be some plist file in your home dir.
In that sense with global I meant global for the user - not the machine.

> In the standalone LyX, there is no system-wide Qt that is being used, so any 
> Qt setting would have to be done at the application level, right?

I have to check Qt4 at first to answer that.

In general that's a question for packaging of LyX. I think LyX should work with 
Qt4 frameworks. Then a private framework should be provided as option for 
machines with no or with the wrong Qt version. Currently there is no mechanism 
to decide that. That's why I package LyX with private Qt4 frameworks only.

Stephan

Reply via email to