On 14/11/13 12:19, Ankit Shah wrote:
>> ./configure --with-version-suffix=-trunk
> That helped to run both version simultaneously.
> 
> I'm currently checking how the program flow switches from 
> FindAndReplaceWidget::showEvent() function to 
> FindAndReplaceWidget::findAndReplace() and forward using these dispatch calls:
> dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
> dispatch(FuncRequest(LFUN_BUFFER_END_SELECT));
> 1. Just out of curiosity I found two types of dispatch, 
> lyx::dispatch(FuncRequest) and another one simply dispatch(FuncRequest) 
> what's the difference between them?

excellent question, guess the FindAndReplace, inheriting DockView, inheriting 
Dialog, calls the Dialog::dispatch(), which is implemented in a very 
complicated way in Dialog.cpp:

void Dialog::dispatch(FuncRequest const & fr) const
{
        lyx::dispatch(fr);
}

:D!

> 2. Lastly should I currently try get myself acquainted with how program flow 
> works or  or I should presently just focus on how FindAndReplace is actually 
> working by exploring lyxfind.cpp?

it's good a bit of both. Getting yourself "oriented" in the LyX sources tree is 
always good. It will allow you to be able to understand where to search for 
something. Not sure if you like to use a complex IDE environment that tracks 
method calls, or vi extensions that navigate you through definitions and uses 
of symbols, but in case you don't, then find & grep are your friends, namely:

  grep -r -Hn 'whatever' *
  find . -name '*.cpp' -exec grep -Hn 'whatever' {} \;

> 3. One last question invoking the normal Find and Replace dialog box using 
> just Ctrl + F didn't show any debug info. How is the normal Find and Replace 
> handled?

Again, with a bit of grep, you can see what/when stuff is logged:

  $ grep Debug FindAndReplace.cpp 
                                LYXERR(Debug::FIND, "Focusing replace WA");
                                LYXERR(Debug::FIND, "Selecting entire replace 
buffer");
                        LYXERR(Debug::FIND, "Focusing find WA");
                        LYXERR(Debug::FIND, "Selecting entire find buffer");
        LYXERR(Debug::FIND, "children.size()=" << children.size());
        LYXERR(Debug::FIND, "children.size()=" << children.size());
                LYXERR(Debug::FIND, "Dispatching LFUN_WORD_FINDADV");
                LYXERR(Debug::FIND, "dispatched");
                        LYXERR(Debug::FIND, "findBackAdv5: cur: "
        LYXERR(Debug::FIND, "FindAndReplaceOptions: "
        LYXERR(Debug::DEBUG, "showEvent()" << endl);
        LYXERR(Debug::FIND, "Selecting entire find buffer");


Does this answer your question ? If also when you do "Find Next" you don't see 
anything on the terminal, then either you used the wrong syntax for "./src/lyx 
-dbg find", or you didn't configure with --enable-debug and *re-compiled* LyX 
from the top dir.

> I'm actually doing such type of coding for the first time unlike the regular 
> rookie college programs so my question may seem silly, I'm sorry for that.

not at all! Actually, if you keep following a bit lyx::dispatch() throughout 
the whole LyX code, it will be all an excellent orientation exercise.

If you follow through the code all the way from

  FindAndReplace.cpp: FindAndReplaceWidget::on_findNextPB_clicked()

(I hit the Find Next button)

  down to 

  lyxfind.cpp: bool findAdv(BufferView * bv, FindAndReplaceOptions const & opt)

then you'll already master the basic view->model communication, which is a 
fundamental brick of LyX internals.

Bye,

        T.

Reply via email to