Re: About menus and the dispatch() methods shuffling

2007-11-26 Thread Abdelrazak Younes

Jean-Marc Lasgouttes wrote:


OK, I tried to do something, but since I cannot get a hold of what is
the logic about where the updates are done (they used to be
centralized at the end of LyXFunc::dispatch,


The BufferView update is done in BufferView::processUpdateFlags() called 
at the end of dispatch(). This method may or may not trigger a screen 
redraw by emitting the Buffer::changed signal.



now they are several
'return' shortcuts in there and GuiView::dispatch seems to do its own
thing),


When an action is triggered from the GUI, it does not go through 
LyXFunc::dispatch() first but is directly handled by 
LyXView::dispatch(). This is because we have to make sure that the 
current LyXView (as pointed by LyXFunc) is the correct one.



I give up: I would break the code even more. At least now I
can assume that you know how it works. 


Yes.



I do not really understand though why there is in GuiView code like
INSET_APPLY that requires access to a cursor. I would think this is a
bufferview thing.


Maybe yes but not really sure because INSET_APPLY is a just a Dialog 
thing (very bad IMO). As a first step, I just wanted to get rid of all 
GUI oriented methods in the core. Now that the LyXView interface is lean 
and mean we can transfer back some things to the core if it make sense, 
on a case by case basis.


I'll do the cleanup as you suggested.

Abdel.



Re: About menus and the dispatch() methods shuffling

2007-11-26 Thread Jean-Marc Lasgouttes
Abdelrazak Younes <[EMAIL PROTECTED]> writes:

> Before foolishly complain try to insert a duplicate shortcut in 1.5
> and you will obtain the same 10 warnings.

I was about to write sheepishly that indeed the same problem occurs in
1.5. Sorry.

>> If I may respectfully intervene, I think this is wrong (the word "crap"
>> came briefly to my mind). Correct encapsulation (like what we do with
>> cursor and bufferview) is like
>>
>>   ... let lyxfunc dispatch what it knows about ...
>
> As you respectfully consider this is crap I'll respectfully let you do
> the cleanup.

Note that the word crap only came briefly and did not stick (if I may
say) ;). And I swore I would not touch this code ! Moreover, since you
do not tell me why you (assuming it was you) thought it would be
better to do it this way, doing a war of code change is not very
interesting.

[...some time passes...]

OK, I tried to do something, but since I cannot get a hold of what is
the logic about where the updates are done (they used to be
centralized at the end of LyXFunc::dispatch, now they are several
'return' shortcuts in there and GuiView::dispatch seems to do its own
thing), I give up: I would break the code even more. At least now I
can assume that you know how it works. 

I do not really understand though why there is in GuiView code like
INSET_APPLY that requires access to a cursor. I would think this is a
bufferview thing.

JMarc


Re: About menus and the dispatch() methods shuffling

2007-11-26 Thread Abdelrazak Younes

Jean-Marc Lasgouttes wrote:

With recent build where Uwe has introduced duplicate shortcuts, I see
on a mere starting:

Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.
Menu warning: menu entries "New Line|w" and "Inter-word Space|w" share the same 
shortcut.


This means that menu expansion is done 10 time when launching LyX. The
code has changed a lot in this area (and I foolishly promised not to
complain about what is happening in there), but the current situation
is crazy.


Before foolishly complain try to insert a duplicate shortcut in 1.5 and 
you will obtain the same 10 warnings.



I understand though that it is a good foundation for
declaring later than the whole menubackend thing is too costly and
should be scrapped :-|


The 10 warnings are indeed a good sign that it should be scrapped.




On a related problem I can't help but notice that LyXFunc.cpp contains
lines like:

// Let the frontend dispatch its own actions.
case LFUN_WINDOW_NEW:
case LFUN_WINDOW_CLOSE:
case LFUN_LYX_QUIT:
BOOST_ASSERT(theApp());
theApp()->dispatch(cmd);
// Nothing more to do.
return;

(and the same for lyxview).

If I may respectfully intervene, I think this is wrong (the word "crap"
came briefly to my mind). Correct encapsulation (like what we do with
cursor and bufferview) is like

  ... let lyxfunc dispatch what it knows about ...


As you respectfully consider this is crap I'll respectfully let you do 
the cleanup.


Abdel.