Re: Search LyX Text Functionality.

2007-07-17 Thread Tommaso Cucinotta

Abdelrazak Younes ha scritto:

I'll try to look at the Controller code tommorrow.

Obviously, the controller was missing. Added a new patch.

   T.



Re: Search LyX Text Functionality.

2007-07-17 Thread Jürgen Spitzmüller
Tommaso Cucinotta wrote:
 Added a new patch.

Hi Tommaso,

this is just to let you know that we are actually noticing what you are 
doing :-) You might be aware that we are busy with getting 1.5.0 out (and in 
feature freeze), so you will have to be a bit patient.

I have applied your patch and had a quick look (I had to add the Controllers 
to controllers/Makefile.am to make it compile). It looks very promising! Some 
things are not working yet (e.g. searching for special symbols like ligature 
breaks, replacing), but you might be aware of that. I also think you new 
input widget (i.e. the small work area) might be of general use for other 
dialogs, such as the url and index dialogs (which would fix the problems with 
non-escaped characters).

Impressing stuff.

Jürgen

P.S. Some formal issues I've noticed with the patch:
- our source files are encoded in latin 1 (your patch mangles names with 
special characters, such as Bjønnes)
- please adapt the formatting (always tab for indendation, max line lenght ~75 
chars) to the rest of the code. Have a look at development/code_rules for 
some hints.

Jürgen


Convert source code to utf8? (was Re: Search LyX Text Functionality.

2007-07-17 Thread Abdelrazak Younes

Jürgen Spitzmüller wrote:
- our source files are encoded in latin 1 (your patch mangles names with 
special characters, such as Bjønnes)


Shouldn't we convert that to utf8 before 1.5.0? I remind you that we 
need to do that for layouts too.


Abdel.



Re: Search LyX Text Functionality.

2007-07-17 Thread Tommaso Cucinotta

Abdelrazak Younes ha scritto:

I'll try to look at the Controller code tommorrow.

Obviously, the controller was missing. Added a new patch.

   T.



Re: Search LyX Text Functionality.

2007-07-17 Thread Jürgen Spitzmüller
Tommaso Cucinotta wrote:
> Added a new patch.

Hi Tommaso,

this is just to let you know that we are actually noticing what you are 
doing :-) You might be aware that we are busy with getting 1.5.0 out (and in 
feature freeze), so you will have to be a bit patient.

I have applied your patch and had a quick look (I had to add the Controllers 
to controllers/Makefile.am to make it compile). It looks very promising! Some 
things are not working yet (e.g. searching for special symbols like ligature 
breaks, replacing), but you might be aware of that. I also think you new 
input widget (i.e. the small work area) might be of general use for other 
dialogs, such as the url and index dialogs (which would fix the problems with 
non-escaped characters).

Impressing stuff.

Jürgen

P.S. Some formal issues I've noticed with the patch:
- our source files are encoded in latin 1 (your patch mangles names with 
special characters, such as "Bjønnes")
- please adapt the formatting (always tab for indendation, max line lenght ~75 
chars) to the rest of the code. Have a look at development/code_rules for 
some hints.

Jürgen


Convert source code to utf8? (was Re: Search LyX Text Functionality.

2007-07-17 Thread Abdelrazak Younes

Jürgen Spitzmüller wrote:
- our source files are encoded in latin 1 (your patch mangles names with 
special characters, such as "Bjønnes")


Shouldn't we convert that to utf8 before 1.5.0? I remind you that we 
need to do that for layouts too.


Abdel.



Search LyX Text Functionality.

2007-07-16 Thread Tommaso Cucinotta

Hi all,

please, consider the feature request I posted to bugzilla:
having an advanced search/replace functionality
allowing to find/replace segments of LyX Text, including
math.

Initial idea description and prototype implementation patch:

 http://bugzilla.lyx.org/show_bug.cgi?id=3982

Patch for full GUI-support (dockable search panel a'la Acrobat,
with its own GuiWorkArea):

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Core functionality in the patch is just basic, but I think that, at
least for the search part, it is not impossible to complete (with
reg exp search etc...). I'm available to complete the implementation,
if there is any chance for it to get into the mainstream branch.

Bye,

   T.


Re: Search LyX Text Functionality.

2007-07-16 Thread Abdelrazak Younes

Tommaso Cucinotta wrote:

Hi all,

please, consider the feature request I posted to bugzilla:
having an advanced search/replace functionality
allowing to find/replace segments of LyX Text, including
math.

Initial idea description and prototype implementation patch:

 http://bugzilla.lyx.org/show_bug.cgi?id=3982

Patch for full GUI-support (dockable search panel a'la Acrobat,
with its own GuiWorkArea):

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Core functionality in the patch is just basic, but I think that, at
least for the search part, it is not impossible to complete (with
reg exp search etc...). I'm available to complete the implementation,
if there is any chance for it to get into the mainstream branch.


Hello Tommaso,

Just to confirm that there is a good change to have it in trunk but I 
have two comments:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
- Second, I have solved already the multi-workArea issue in my mvc 
branch. If you agree to rebase your work on it, I will help you refining 
the approach and I will commit it in my branch.


My branch:

svn+ssh://svn.lyx.org/lyx/lyx-devel/branches/personal/younes/mvc

I intent to merge this branch to trunk as soon as trunk is opened and I 
have solved a few issues with the background banner and with child 
documents.


Abdel.




Re: Search LyX Text Functionality.

2007-07-16 Thread Tommaso Cucinotta

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used svn diff src lib  lyx.patch, and I didn't notice it was 
not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or just a 
standard way to

produce patches with svn (I used to use CVS for all past projects).
- Second, I have solved already the multi-workArea issue in my mvc 
branch. If you agree to rebase your work on it, I will help you 
refining the approach and I will commit it in my branch.

Of course I will. I'm going to download your branch.

My branch:

svn+ssh://svn.lyx.org/lyx/lyx-devel/branches/personal/younes/mvc

I intent to merge this branch to trunk as soon as trunk is opened and 
I have solved a few issues with the background banner and with child 
documents.

   T.


Re: Search LyX Text Functionality.

2007-07-16 Thread Richard Heck

Tommaso Cucinotta wrote:

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used svn diff src lib  lyx.patch, and I didn't notice it 
was not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or just 
a standard way to

produce patches with svn (I used to use CVS for all past projects).

You need to add the files to the repository so svn will see them:
   svn add QSearch.{h,cpp} QSearchAdv.{h,cpp}
should do it.

Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto



Re: Search LyX Text Functionality.

2007-07-16 Thread Abdelrazak Younes

Richard Heck wrote:

Tommaso Cucinotta wrote:

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used svn diff src lib  lyx.patch, and I didn't notice it 
was not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or just 
a standard way to

produce patches with svn (I used to use CVS for all past projects).

You need to add the files to the repository so svn will see them:
   svn add QSearch.{h,cpp} QSearchAdv.{h,cpp}
should do it.


I was about to say that too but the problem is that Tommaso does not 
have commit priviledge; will svn add work without that?


Abdel.



Re: Search LyX Text Functionality.

2007-07-16 Thread Richard Heck

Abdelrazak Younes wrote:

Richard Heck wrote:

Tommaso Cucinotta wrote:

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used svn diff src lib  lyx.patch, and I didn't notice it 
was not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or 
just a standard way to

produce patches with svn (I used to use CVS for all past projects).

You need to add the files to the repository so svn will see them:
   svn add QSearch.{h,cpp} QSearchAdv.{h,cpp}
should do it.


I was about to say that too but the problem is that Tommaso does not 
have commit priviledge; will svn add work without that?
Yes, it doesn't actually commit anything: only svn ci will do that. svn 
add just registers the files with your local copy, so svn diff, etc, 
will see them.


Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto



Re: Search LyX Text Functionality.

2007-07-16 Thread Tommaso Cucinotta

Richard Heck ha scritto:
Yes, it doesn't actually commit anything: only svn ci will do that. 
svn add just registers the files with your local copy, so svn diff, 
etc, will see them.

In fact, done. Please, find the patched patch at bug 3998.

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Added missing files in diff (QSearchAdv.{cpp,h}, SearchAdvUi.ui). Cleaned up
commented code.

Use: open a document, C-S-f, type what you want to search (also math
expressions) then hit Enter to repeatidly Find the next match, hit Esc to go
back to the document. C-S-f shows the dialog again with the last search (could
be improved to store and allow browsing of last searches).

T.



Re: Search LyX Text Functionality.

2007-07-16 Thread Abdelrazak Younes

Tommaso Cucinotta wrote:

Richard Heck ha scritto:
Yes, it doesn't actually commit anything: only svn ci will do that. 
svn add just registers the files with your local copy, so svn diff, 
etc, will see them.

In fact, done. Please, find the patched patch at bug 3998.

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Added missing files in diff (QSearchAdv.{cpp,h}, SearchAdvUi.ui). 
Cleaned up

commented code.


Looks terrific ;-)

Here's some comments on the code nevertheless:


Index: lib/bind/cua.bind
===
--- lib/bind/cua.bind   (revisione 19086)
+++ lib/bind/cua.bind   (copia locale)
@@ -62,6 +62,7 @@
 \bind C-S-Mmath-display

 \bind C-f  dialog-show findreplace
+\bind C-S-fdialog-show findreplaceadv


I'd prefer avancedfindreplace personally.


Index: src/BufferView.cpp
===
--- src/BufferView.cpp  (revisione 19086)

+   case LFUN_WORD_FINDADV:
+   findAdv(this, cmd);

AdvancedFind() IMHO.


+static docstring stringifyFromCursor(DocIterator  cur, MatchStringAdv 
const  match) {


The convention in LyX sourcecode is to put local functions in the 
anonymous namespace:


namespace {
docstring stringifyFromCursor(..)
...
}


Index: src/frontends/qt4/QSearchAdv.h

AdvancedSearch.h would be better, we try to move away for Qxxx naming.


+
+protected Q_SLOTS:
+   void findNextClicked();
+   void findPrevClicked();
+   void replaceClicked();
+   void replaceallClicked();
+   void closeClicked();

Instead of those, you could use automatic slots:
+   void on_findNextPB_clicked();

This saves the manual signal/slot connection.


+   ControlSearchAdv * ctrl_;
+   WorkArea * origWorkArea_;   // The work area in which to search
+   GuiWorkArea * searchWorkArea_;  // The work area defining what to search

This GuiWorkArea is a child of QSearchAdvDialog right?


Index: src/frontends/qt4/QSearchAdv.cpp
===
+   origWorkArea_ = theApp()-currentView()-currentWorkArea();
+	searchWorkArea_ = new GuiWorkArea(frameRect.width(), 
frameRect.height(), 10, *theApp()-currentView());


Good.

+   searchWorkArea_-setBufferView(ctrl_-bufferView());
+   searchWorkArea_-connectBuffer(ctrl-buffer());

You will need to simplify this with my branch.

I'll try to look at the Controller code tommorrow.

Good stuff ;-)

Abdel.



Search LyX Text Functionality.

2007-07-16 Thread Tommaso Cucinotta

Hi all,

please, consider the feature request I posted to bugzilla:
having an advanced search/replace functionality
allowing to find/replace segments of LyX Text, including
math.

Initial idea description and prototype implementation patch:

 http://bugzilla.lyx.org/show_bug.cgi?id=3982

Patch for full GUI-support (dockable search panel a'la Acrobat,
with its own GuiWorkArea):

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Core functionality in the patch is just basic, but I think that, at
least for the search part, it is not impossible to complete (with
reg exp search etc...). I'm available to complete the implementation,
if there is any chance for it to get into the mainstream branch.

Bye,

   T.


Re: Search LyX Text Functionality.

2007-07-16 Thread Abdelrazak Younes

Tommaso Cucinotta wrote:

Hi all,

please, consider the feature request I posted to bugzilla:
having an advanced search/replace functionality
allowing to find/replace segments of LyX Text, including
math.

Initial idea description and prototype implementation patch:

 http://bugzilla.lyx.org/show_bug.cgi?id=3982

Patch for full GUI-support (dockable search panel a'la Acrobat,
with its own GuiWorkArea):

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Core functionality in the patch is just basic, but I think that, at
least for the search part, it is not impossible to complete (with
reg exp search etc...). I'm available to complete the implementation,
if there is any chance for it to get into the mainstream branch.


Hello Tommaso,

Just to confirm that there is a good change to have it in trunk but I 
have two comments:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
- Second, I have solved already the multi-workArea issue in my "mvc" 
branch. If you agree to rebase your work on it, I will help you refining 
the approach and I will commit it in my branch.


My branch:

svn+ssh://svn.lyx.org/lyx/lyx-devel/branches/personal/younes/mvc

I intent to merge this branch to trunk as soon as trunk is opened and I 
have solved a few issues with the background banner and with child 
documents.


Abdel.




Re: Search LyX Text Functionality.

2007-07-16 Thread Tommaso Cucinotta

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used "svn diff src lib > lyx.patch", and I didn't notice it was 
not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or just a 
standard way to

produce patches with svn (I used to use CVS for all past projects).
- Second, I have solved already the multi-workArea issue in my "mvc" 
branch. If you agree to rebase your work on it, I will help you 
refining the approach and I will commit it in my branch.

Of course I will. I'm going to download your branch.

My branch:

svn+ssh://svn.lyx.org/lyx/lyx-devel/branches/personal/younes/mvc

I intent to merge this branch to trunk as soon as trunk is opened and 
I have solved a few issues with the background banner and with child 
documents.

   T.


Re: Search LyX Text Functionality.

2007-07-16 Thread Richard Heck

Tommaso Cucinotta wrote:

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used "svn diff src lib > lyx.patch", and I didn't notice it 
was not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or just 
a standard way to

produce patches with svn (I used to use CVS for all past projects).

You need to add the files to the repository so svn will see them:
   svn add QSearch.{h,cpp} QSearchAdv.{h,cpp}
should do it.

Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto



Re: Search LyX Text Functionality.

2007-07-16 Thread Abdelrazak Younes

Richard Heck wrote:

Tommaso Cucinotta wrote:

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used "svn diff src lib > lyx.patch", and I didn't notice it 
was not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or just 
a standard way to

produce patches with svn (I used to use CVS for all past projects).

You need to add the files to the repository so svn will see them:
   svn add QSearch.{h,cpp} QSearchAdv.{h,cpp}
should do it.


I was about to say that too but the problem is that Tommaso does not 
have commit priviledge; will "svn add" work without that?


Abdel.



Re: Search LyX Text Functionality.

2007-07-16 Thread Richard Heck

Abdelrazak Younes wrote:

Richard Heck wrote:

Tommaso Cucinotta wrote:

Abdelrazak Younes ha scritto:
- First your patch is not complete in bugzilla, the added 
QSearch.{h,cpp} and QSearchAdv.{h,cpp} are missing. Please send a 
complete patch.
Hello, I used "svn diff src lib > lyx.patch", and I didn't notice it 
was not adding new files to
the patch. Any switch to svn that might do what I need, here ? Or 
just a standard way to

produce patches with svn (I used to use CVS for all past projects).

You need to add the files to the repository so svn will see them:
   svn add QSearch.{h,cpp} QSearchAdv.{h,cpp}
should do it.


I was about to say that too but the problem is that Tommaso does not 
have commit priviledge; will "svn add" work without that?
Yes, it doesn't actually commit anything: only svn ci will do that. svn 
add just registers the files with your local copy, so svn diff, etc, 
will see them.


Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto



Re: Search LyX Text Functionality.

2007-07-16 Thread Tommaso Cucinotta

Richard Heck ha scritto:
Yes, it doesn't actually commit anything: only svn ci will do that. 
svn add just registers the files with your local copy, so svn diff, 
etc, will see them.

In fact, done. Please, find the patched patch at bug 3998.

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Added missing files in diff (QSearchAdv.{cpp,h}, SearchAdvUi.ui). Cleaned up
commented code.

Use: open a document, C-S-f, type what you want to search (also math
expressions) then hit Enter to repeatidly Find the next match, hit Esc to go
back to the document. C-S-f shows the dialog again with the last search (could
be improved to store and allow browsing of last searches).

T.



Re: Search LyX Text Functionality.

2007-07-16 Thread Abdelrazak Younes

Tommaso Cucinotta wrote:

Richard Heck ha scritto:
Yes, it doesn't actually commit anything: only svn ci will do that. 
svn add just registers the files with your local copy, so svn diff, 
etc, will see them.

In fact, done. Please, find the patched patch at bug 3998.

 http://bugzilla.lyx.org/show_bug.cgi?id=3998

Added missing files in diff (QSearchAdv.{cpp,h}, SearchAdvUi.ui). 
Cleaned up

commented code.


Looks terrific ;-)

Here's some comments on the code nevertheless:


Index: lib/bind/cua.bind
===
--- lib/bind/cua.bind   (revisione 19086)
+++ lib/bind/cua.bind   (copia locale)
@@ -62,6 +62,7 @@
 \bind "C-S-M""math-display"

 \bind "C-f"  "dialog-show findreplace"
+\bind "C-S-f""dialog-show findreplaceadv"


I'd prefer avancedfindreplace personally.


Index: src/BufferView.cpp
===
--- src/BufferView.cpp  (revisione 19086)

+   case LFUN_WORD_FINDADV:
+   findAdv(this, cmd);

AdvancedFind() IMHO.


+static docstring stringifyFromCursor(DocIterator & cur, MatchStringAdv 
const & match) {


The convention in LyX sourcecode is to put local functions in the 
anonymous namespace:


namespace {
docstring stringifyFromCursor(..)
...
}


Index: src/frontends/qt4/QSearchAdv.h

AdvancedSearch.h would be better, we try to move away for Qxxx naming.


+
+protected Q_SLOTS:
+   void findNextClicked();
+   void findPrevClicked();
+   void replaceClicked();
+   void replaceallClicked();
+   void closeClicked();

Instead of those, you could use automatic slots:
+   void on_findNextPB_clicked();

This saves the manual signal/slot connection.


+   ControlSearchAdv * ctrl_;
+   WorkArea * origWorkArea_;   // The work area in which to search
+   GuiWorkArea * searchWorkArea_;  // The work area defining what to search

This GuiWorkArea is a child of QSearchAdvDialog right?


Index: src/frontends/qt4/QSearchAdv.cpp
===
+   origWorkArea_ = theApp()->currentView()->currentWorkArea();
+	searchWorkArea_ = new GuiWorkArea(frameRect.width(), 
frameRect.height(), 10, *theApp()->currentView());


Good.

+   searchWorkArea_->setBufferView(_->bufferView());
+   searchWorkArea_->connectBuffer(ctrl->buffer());

You will need to simplify this with my branch.

I'll try to look at the Controller code tommorrow.

Good stuff ;-)

Abdel.