PDA

View Full Version : QCodeEdit



fullmetalcoder
28th July 2006, 17:09
hi, I've had planned quite a while ago to rewrite the text editing module of Edyuk and, as I was bored with writing Edyuk docs last week, I started thinking about that.

QCodeEdit is meant to be a framework providing :

a powerful and flexible widget mixing a QTextEdit and various panels
an easily extendable framework for "language definitions" : i.e. each programming language is associated with one or more file extensions and gets its own parenthesis matcher, text indenter and syntax highlighter
an wide set of powerful generic components that interfaces between XML definitions and "language framework"The archive I'm releasing is just a first draft and currently features only the core of the language framework and the generic highlighting engine.

For simplicity's sake it's gonna be possible to attach the language framework to a QTextEdit or to QCodeEdit indifferently.

The beta is bundled with a minimal example and an XML definition for C++ (with Doxygen stuff)

Have fun and feed me back.
:)

elcuco
4th August 2006, 17:05
Anyone tred this code...?

Anyway, I tested your code. In order to make it run I needed to apply this patch:


diff -ru qcodeedit-0.1.0-beta-orig/example/example.pro qcodeedit-0.1.0-beta/example/example.pro
--- qcodeedit-0.1.0-beta-orig/example/example.pro 2006-07-28 16:37:06.000000000 +0300
+++ qcodeedit-0.1.0-beta/example/example.pro 2006-08-01 23:03:25.000000000 +0300
@@ -4,8 +4,10 @@

TEMPLATE = app
TARGET = example
-
+INCLUDEPATH += ../include ../src ../src/editor ../src/language ../src/generic
+DEFINES += _QCODE_EDIT_GENERIC_
CONFIG += release qcodeedit
+LIBS += -L../src/ -lqcodeedit


I also needed to copy the *.so file into the example dir. When you type text the application does work, but when pasting large portions of text (qwidget.cpp was my test case) or load it via the command line the text does not get painted.

About the code itself:
The idea of having different contexts in the language definitions if cool. This means that different color can be applied to the same word depending of it's location on the text.

I am not sure that putting the colors definitions inside the syntax declaration is a good idea: you are not able to modify the colors of your syntax. For example, people which have a pink desktop will have problems with your code, since the text editor will always be with white background.

I am not sure that re-inventing the wheel and defining a new syntax declaration is a good idea. If you choose another project language definitions are will gain a lot of syntaxes for free, and you now only have to code an engine to display them. For example:

Sharp develop also use XML for describing the syntaxes:
http://www.icsharpcode.net/OpenSource/SD/

GtkSourceView also uses XML (see also my minimal implementation for this definitions)
http://gtksourceview.sourceforge.net/

And also notepad++ (win32 application):
http://notepad-plus.sourceforge.net/uk/site.htm

Another suggestion can be using plain "ini" files instead XML. This will make the construction on new syntax definition files much easier.

Matt Smith
12th February 2007, 10:59
The convention in Qt is that only Trolltech issues classes with names like QClassName. Third-party developers are expected to put initials after the Q to identify it as theirs, as in QfmcCodeEdit. You can find the naming guidelines here (http://www.trolltech.com/developer/notes/naming). You are supposed to register the initials with Trolltech, but I have registered my own (ij) and have not heard from them and it has not appeared on their site.

fullmetalcoder
13th February 2007, 07:24
Anyone tred this code...?

Anyway, I tested your code. In order to make it run I needed to apply this patch:


diff -ru qcodeedit-0.1.0-beta-orig/example/example.pro qcodeedit-0.1.0-beta/example/example.pro
--- qcodeedit-0.1.0-beta-orig/example/example.pro 2006-07-28 16:37:06.000000000 +0300
+++ qcodeedit-0.1.0-beta/example/example.pro 2006-08-01 23:03:25.000000000 +0300
@@ -4,8 +4,10 @@

TEMPLATE = app
TARGET = example
-
+INCLUDEPATH += ../include ../src ../src/editor ../src/language ../src/generic
+DEFINES += _QCODE_EDIT_GENERIC_
CONFIG += release qcodeedit
+LIBS += -L../src/ -lqcodeedit
I also needed to copy the *.so file into the example dir. When you type text the application does work, but when pasting large portions of text (qwidget.cpp was my test case) or load it via the command line the text does not get painted.

About the code itself:
The idea of having different contexts in the language definitions if cool. This means that different color can be applied to the same word depending of it's location on the text.

I am not sure that putting the colors definitions inside the syntax declaration is a good idea: you are not able to modify the colors of your syntax. For example, people which have a pink desktop will have problems with your code, since the text editor will always be with white background.

I am not sure that re-inventing the wheel and defining a new syntax declaration is a good idea. If you choose another project language definitions are will gain a lot of syntaxes for free, and you now only have to code an engine to display them. For example:

Sharp develop also use XML for describing the syntaxes:
http://www.icsharpcode.net/OpenSource/SD/

GtkSourceView also uses XML (see also my minimal implementation for this definitions)
http://gtksourceview.sourceforge.net/

And also notepad++ (win32 application):
http://notepad-plus.sourceforge.net/uk/site.htm

Another suggestion can be using plain "ini" files instead XML. This will make the construction on new syntax definition files much easier.

I'm pleased to have some feedback but I must inform you that the code I posted here is quite out-of-date... I've continued developping it for use with Edyuk and you can always find the latest version on the SVN trunk or (a little older one) on the latest surce package.

The syntax definition in itself still needs some work. Honestly I didn't pretend to have crafted the ultimate file format here. I just thought about one that would be human readable and has some convinience. I'm not against using other ones but as you might have noticed I'm using some rather special mechanism like the href stuff and the context aware definitions (or nested definitions). Besides if you want to support another generic definition format all you need is to reimplement the some interfaces for highlighting, paren matching, ... and also create and add proper definitions to the factory.

About the colors : I didn't had much time to think about that but you're probably right... I should place them in a separate file. I'll give it a try in a next version.

Using INI files should allow faster and a little easier syntax creation but it would also make them look ugly when using nested/context-aware highlighting definitions...



The convention in Qt is that only Trolltech issues classes with names like QClassName. Third-party developers are expected to put initials after the Q to identify it as theirs, as in QfmcCodeEdit. You can find the naming guidelines here (http://www.trolltech.com/developer/notes/naming). You are supposed to register the initials with Trolltech, but I have registered my own (ij) and have not heard from them and it has not appeared on their site.
I had never heard of that and, IMHO, it's rubbish... Long prefixes make the code longer to type and sometimes harder to understand. Moreover, everytime I use the Q prefix it's to state a self-sufficient component (apart from Qt dependencies of course :rolleyes:) that is meant to become someday a library well-integrated into Qt... Ultimately, if the Trolls asked me to change that I'd rather put a namespace than changing all class names... ;)

No-Nonsense
13th February 2007, 09:35
I'm pleased to have some feedback but I must inform you that the code I posted here is quite out-of-date... I've continued developping it for use with Edyuk and you can always find the latest version on the SVN trunk [...]

I would like to try out the latest version of QCodeEdit as I am programming a source editor for some custom language.
I started with a QTextEdit, added a QSyntaxHighlighter and wanted to have line-numbers and later syntax completion and icons on the line-number-gutter. I just started a own editor based on QTextEdit and using various Qt editors as a base how to implement a gutter etc.

Sadly I cannot compile your source as the *.pro file is missing in ./src/lib/qcodeedit/ or do you have a separate SVN repository for QCodeEdit?


The syntax definition in itself still needs some work. Honestly I didn't pretend to have crafted the ultimate file format here. I just thought about one that would be human readable and has some convinience. I'm not against using other ones but as you might have noticed I'm using some rather special mechanism like the href stuff and the context aware definitions (or nested definitions).

You could look at the Katepart language definitions. Personally I dislike some of their syntax (some XML elements start with a lowercase char, some with uppercase...; some of the rules are overdefined, e.g. matching a decimal/hex/... can be done with a regexp instead too). But what you could add support for a context stack (or isn't this needed by your definitions?) and standard colors.


About the colors : I didn't had much time to think about that but you're probably right... I should place them in a separate file. I'll give it a try in a next version.

I would prefer the way Katepart solves this: They define some standard colors (keyword, comment, decimal, hex, float, ...). The user (programmer) can then set the colors and styles for these. In the syntax definition file you would allow to set a color or to use one of these placeholders. Then QCodeEdit would init the associated colors with some defaults the programmer can overwrite at any point with other values.
You could also extend this to letting the syntax definition define the placeholder-names and offer a way for the programmer to get a list of names and build a config dialog for the user to set the colors.

-Jens

travlr
13th February 2007, 11:31
-Jens

Jens, are you the same no-nonsense from Elite Trader??

No-Nonsense
13th February 2007, 11:35
Jens, are you the same no-nonsense from Elite Trader??

No, don't think so. What is Elite Trader?

-Jens

travlr
13th February 2007, 11:38
No, don't think so. What is Elite Trader?

-Jens

Oh.. Ok. I guess not.
ET is a forum where financial market traders gather.

-travlr

fullmetalcoder
13th February 2007, 12:34
I would like to try out the latest version of QCodeEdit as I am programming a source editor for some custom language.
I started with a QTextEdit, added a QSyntaxHighlighter and wanted to have line-numbers and later syntax completion and icons on the line-number-gutter. I just started a own editor based on QTextEdit and using various Qt editors as a base how to implement a gutter etc.

Sadly I cannot compile your source as the *.pro file is missing in ./src/lib/qcodeedit/ or do you have a separate SVN repository for QCodeEdit?

QCodeEdit is a componnent and when released as is it contains a pro file to compile it as a static or shared lib. However I thought it would be absolutely useless to keep this pro file in Edyuk repositories and packages. Instead I split the pro files into : a wrapper .pro that's quite simple and distributed only in QCodeEdit packages and a .pri file (PRoject Include) which has to be included in your project via the include() function...

If you want to start playing with QCodeEdit I really recommend to use the iclude() function at first because it will spare you the pain of compiling an lib and then linking your app to it... However if you need a sample pro file to build and install QCodeEdit as a regular lib on your system : just ask me, I'll craft you one in a few minutes... :)



You could look at the Katepart language definitions. Personally I dislike some of their syntax (some XML elements start with a lowercase char, some with uppercase...; some of the rules are overdefined, e.g. matching a decimal/hex/... can be done with a regexp instead too). But what you could add support for a context stack (or isn't this needed by your definitions?) and standard colors.

I don't quite understand your last sentence... :o



I would prefer the way Katepart solves this: They define some standard colors (keyword, comment, decimal, hex, float, ...). The user (programmer) can then set the colors and styles for these. In the syntax definition file you would allow to set a color or to use one of these placeholders. Then QCodeEdit would init the associated colors with some defaults the programmer can overwrite at any point with other values.
You could also extend this to letting the syntax definition define the placeholder-names and offer a way for the programmer to get a list of names and build a config dialog for the user to set the colors.

Yep! I got to do it that way but unfortunately I'm ATM kept rather busy by the developpment of Edyuk and such improvements will have to wait a bit.:o

No-Nonsense
13th February 2007, 14:51
QCodeEdit is a componnent and when released as is it contains a pro file to compile it as a static or shared lib.

This may be OT here, but with my simple extended QTextEdit (only line-number-gutter) I had problems to get it working as a static library. I could get it to work as a shared library (plugin for Qt Designer) or by simply adding all files to the source an header variable in the *.pro and using "promote to custom widget".

I already searched the forums here, but did not find any usefull hints. I only changed the plugin pro file and added the static keyword there. Do I have to change anything else to get this to work? Maybe I can send you my test sources?

Another problem I had was acessing member objects of my custom TextEdit (i.e. the Gutter). I always had to include the header (ok) but also add the *.h and *.cpp to the project sources & headers when using as a plugin. Is there a way to only use the library and the *.h files? Because if not the plugin makes no sense to me as I could use it directly by including all files.


If you want to start playing with QCodeEdit I really recommend to use the iclude() function at first because it will spare you the pain of compiling an lib and then linking your app to it... However if you need a sample pro file to build and install QCodeEdit as a regular lib on your system : just ask me, I'll craft you one in a few minutes... :)

Could you provide me a samle project please? :)



I don't quite understand your last sentence... :o
In the Kate syntax definition you define some sort of a statemachine. There is a start context and rules that can stay or change the context. Then you are able to push and pop the current context while changing it. An example is given here: http://docs.kde.org/stable/en/kdebase/kate/katehighlight-xml-format.html

Thanks in advance,
-Jens

fullmetalcoder
15th February 2007, 15:44
Could you provide me a samle project please? :)

Sure! But I need an e-mail address... :rolleyes:



In the Kate syntax definition you define some sort of a statemachine. There is a start context and rules that can stay or change the context. Then you are able to push and pop the current context while changing it. An example is given here: http://docs.kde.org/stable/en/kdebase/kate/katehighlight-xml-format.html

The Kate syntax engine sounds nice and as far as I've played with it, decently fast... However the problem I have is simple : time... Unless their implementation is small enough and can easily be ported to Qt4/QCodeEdit I won't try to use their definition format because I'm quite busy ATM...:(

fullmetalcoder
16th February 2007, 14:52
Here comes the fun! I finally took a few minutes to package the last source of QcodeEdit and released them as QCodeEdit 1.0 (https://sourceforge.net/project/showfiles.php?group_id=168260&package_id=201786&release_id=486901) on Edyuk's Sf.net donwload server. :)

Hoping this will help those who need a ready-made editing framework and motivate those asking for a new syntax engine... ;)

magland
16th February 2007, 15:47
Looking forward to trying it out...

Had some trouble compiling. The readme.txt is confusing, because there are three .pro files in the main directory of distribution.

... so I tried
>> qmake qcodeedit.pro
>> make

But this sent me into a recursive situation ??
qmake -win32 -o Makefile qcodeedit.pro
qmake -win32 -o Makefile qcodeedit.pro
qmake -win32 -o Makefile qcodeedit.pro
qmake -win32 -o Makefile qcodeedit.pro
qmake -win32 -o Makefile qcodeedit.pro
qmake -win32 -o Makefile qcodeedit.pro
....

I'm using Windows with MinGW
Help?

fullmetalcoder
16th February 2007, 19:28
Looking forward to trying it out...
I'm using Windows with MinGW
Help?
Apologies... I made a shell script but no batch equivalent... Anyway it shouldn't be to hard... Just copy makeall.sh as makeall.bat, open it as text and remove the first line (you may also need to replace every occurence of "make" by "mingw32-make") and everything should be fine.

magland
19th February 2007, 12:00
Thanks, the library seemed to compile, but now I'm having trouble compiling example.pro. I get the following error. Any advice?

tmp\obj\main.o(.text+0x171): In function `Z5qMainiPPc':
C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined reference to `QPlainTextEditCreat
or::id()'
tmp\obj\main.o(.text+0x192):C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined refer
ence to `QFoldPanelCreator::id()'
tmp\obj\main.o(.text+0x1b3):C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined refer
ence to `QLineNumberPanelCreator::id()'
tmp\obj\main.o(.text+0x1d4):C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined refer
ence to `QLineMarkPanelCreator::id()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\example.exe] Error 1
mingw32-make[1]: Leaving directory `C:/cstuff/qcodeedit-1.0'
mingw32-make: *** [release] Error 2

fullmetalcoder
19th February 2007, 17:42
Whoops... I almost forgot how stupid Window$ is since I have moved to Linux... :o

The problem is that some classes need explicit export so the linking to a shared lib fails. You can either fall back to the standalone program (standalone.pro) or set the library to compile as static (the first option is the best because you are likely to face the opposite problem with the second one... i.e. explicit shared import from a static lib...)

A third option would be to patch files by hand :

in src/defs.h :
replace : class c##Creator : public Q##t##Creator \
by : class Q_API c##Creator : public Q##t##Creator \

mikhailt
9th March 2007, 12:57
Thaks a lot for your library! The idea is very good, you made a very important and common used component :)

Libary
I build QCodeEdit on Win with Qt 4.2.2, but project need some small changes to be compiled

1. qmargin.h should be included in qeditor.h
#include "qmargin.h"

2. qlanguagefactory.h line 61
void setLanguage(QCodeEdit *e, QLanguageDefinition *d, QCompletionEngine *e);
here was the redefinition of variable.'e'
btw, variable names like a,b,c,d is a bad style

Eample project.
1. Makefiles for example, generated by qmake, should be edited a bit.
To compile axample I added a full path to qcodeedit.lib to Makefiles.

2. Then Q_ID in main.cpp statement
def << Q_ID(QLineMarkPanel)
<< Q_ID(QLineNumberPanel)
<< Q_ID(QFoldPanel)
<< Q_ID(QPlainTextEdit);
does not work properly and generate 4 unresolved externals for functions like QLineMarkPanelCreator, QFoldPanelCreator and so on.
Btw macros are evil, a bad, unclear programming way.

3. To resolve externals file #include "qeditorfactory.h" should be included i n main.cpp

4. But file qeditorfactory.h sontains to links to
#include "edyuk.h"
#include "qsettingsclient.h"
These are not present in the project at all. This comes us to lots of errors.

Thus example can not be compiled unfortunately and it remains unclear what this QCodeEdit does.
Good library but useless, because nobody, except author, knows how to use it :confused:

elcuco
9th March 2007, 14:33
I have tested this library today. Here are my toughts:


The instructions for building are wrong. The instructions for building the project says to run qmake; make. The project is buildable using the makeall.sh scripts. Note that you also point to the documentation, but it's not shiped, and you do not explain how to create it.
No Doxyfile available. There is not Doxyfile (or something similar) on the project, which makes it impossible to create the documentation. I have to build a Doxyfile myself. I can also note that the documentatino tries to be very detailed but it fails, and many things (for example the XLD specifications) are just not done.
The build system is not smart. Using a subdirs project and keeping a single Makefile per directory, will be smarter. Porting the demo/librabry to other build systems might be also a good idea.
Some files on the tarball are +X. For example LGPL.txt. Nothing important.
The some subdirectories contain a .svn directory. Which means the tarball is not really clean, see (4) as well. Nothing important.
The language defintions, are not done in a smart way. For example, there is not separation of language definitions and dispplay: the colors and fonts are embbeded into the language definitions, what if I don't want keywords to be hightlighted? Also, the hightlight/keyword/words list is definetly a bad idea. The word list is saved as a single string instead of a list of nodes, which means that the library needs to load that node and then re-parse it. Also, the doxygen implementation is not optimal, as it only takes into account words, and is not aware of contents. While we are talking about doxygen, the c++ and python share the same doxygen definitions, which means that I hoped that both syntaxes would include the doxygen domain. Instead, you have 3 implementations of doxygen: in cpp.xld, python.xld and dox.xld.
Using popups for search, is not a good idea. Modern applications should use something similar to vim/Firefox search. And besides, the search was not triggere on my box by the ctfl+f shortcut. Actually, even after I choosed it from the pop-up menu, it did not find the word "include" in a cpp file.
When I run the application, is uses 100% cpu, and 50% for X, even at idle states. The library needs a little more fine tunning, otherwise it is just not usable.
The license is not clear. The text says "You may use, distribute and copy QCodeEdit binaries under the terms of GNU Library General Public License (LGPL) version 2", and then "QCodeEdit sources are considered as part of Edyuk and thus GNU General Public License (GPL) version 2". Note also that LGPL and GPL talk generally about source code and not binaries. What are my rights regarding the library?
The code is not FreeSoftware. At the top of GPL.txt you add new restrictions to the GPL, which is is not permitted by the GPL. Look at point (6) of the GPL.
I could not make the completion work.

fullmetalcoder
9th March 2007, 18:25
@ mikhailt :

I don't like macros myself but I didn't find any other way to achieve editor modularization... :o Besides if the example did not build it is most likely due not using the build script (but I should have made this clearer and provided a window equivalent... :o). FYI information the QEditorFactory is a convinience class that's not fully part of the QCodeEdit library because of its dependency on Edyuk. However I left it here because it can always be ported to any other app just by replacing (or removing) the exporting macros and implement another settings handling. I might take time to remove these dependencies later on while keeping all QEditorFactory's functionalities but I've not much time now...

@ elcuco :

1,2,3,4,5 : Whoops... You're right once again... Got to correct this.
6 : I've explained already why definitions are what they are currently. I probably won't have time to change that before a long time but after having a look at the generic components that are bundled (and handle the XLD files) one, especially you ;), should be able to build proper interfaces to support Kate (or any other) syntax definitions.
7 : that's your opinion but I assume I should just provide default search/replace widget of both type...
8 : Well, whe I use QCodeEdit, even from Edyuk, I never face such a situation except maybe on loading of big files but at least the UI doesn't freeze...
9 : Not clear? Well I think it would be... There are basically two cases :

One embeds QCodeEdit into an app or modify it and thus MUST release its work under GPL
One just links to an UNMODIFIED version of QCodeEdit and undergo no restrictions apart from these stated by the LGPL (which are not very tough, are they?)10 : Someone told me this already but I forgot to modify the files...
11 : the completion is not build-in... There is just a ready framework that only needs a proper QCompletionEngine to be implemented and registered by the app. It seemed to me that it would be impossible to implement an efficient completion in a generic way so I only kept the raw C++ interface.

I will try to issue a fixed version of QCodeEdit ASAP taking all your remarks into account but please remember that I'm rather busy ATM. :(

fullmetalcoder
21st March 2007, 11:44
Good news from the front line!

After a cleanup of Edyuk's SVN trunk the latest sources of QCodeEdit are now available directly from SVN (http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit) with bundled examples and proper project files :

$ svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit qcodeedit

I'm working on a new spec for generic highlighting definitions which should be much more flexible and fix most (if not all) issues reported here. :)

fullmetalcoder
26th May 2007, 09:24
The new version of QCodeEdit bringing a new approach on generic definitions is now available. The spec has evolved a lot :
Each syntax element is represented by an "entity", which can be of various type
Entity have a name which correspond to the tag name of an XML element
There are no built-in entities... Entities implementation (actually they are private components) are loaded from plugins
The syntactic rules and formatting data are now split into two XML files
Formats can be inherited. i.e if an entity do not specify a format key it automatically grabs one from its first parent that supply one.The entities are of two types. "Primitives" which, just like in gfx, are small elements that perform "real" tasks and "complex" which combines several "primitives" according to predefined rules.

Available "primitive" standards entities are :
Sequence entity (<sequence> tag) : match a character sequence
Word entity (<word> tag) : match a word i.e. a sequence of word characters delimited by non words characters
Special entity (<special> tag) : match a special character (e.g an end-of-line)Available "primitive" standards entities are :
Context entity (<context> tag) : the most interesting one. match a start entity (if any specified) then processes children until a stop entity (if any) is matched. Supports two other handy special children : escape and jump. The first one should be self explanatory. The second corresponds to an entity that MUST be matched in order to span over several lines if stop entity is valid but did not match in the current line.
List entity (<list> tag) : a list of entities among which one must match (i.e it's basically a convinient OR). In addition it supports prefix and suffix which may or may not be mandatoryAlong with these (already sufficient to craft a syntax definition for most (if not all) existing programming languages) come another that can't be classified easily :
Href entity (<href> tag) : all entities can have an id attribute and this entity allow reducing code duplication by referencing an existing entity through its id. For more flexibility the href can be resolved either on build or on first call to one of its method or every time a method is called.The code available on SVN already handle highlighting very well but do not yet perform any of the other generic tasks (parenthesis matching, text indenting and code folding) thus, due to some internal dependencies, completion is no longer working but don't worry... it'll come back soon (maybe next monday if I find enough time to hack it back :))

Note : the plugin system used by QCodeEdit generic components is very flexible and light-weight. For convinience I did not put it directly inside QCodeEdit but as another Edyuk 3rdparty module. You can grab it this way :
$ svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qpluginsystem qpluginsystem
Also note that for compilation to succeed, qpluginsystem and qcodeedit dirs grabbed from SVN must be at the same level i.e. a dir tree might look like this :
prog
|-- qcodeedit
|-- qpluginsystem
|-- etc..

fullmetalcoder
27th July 2007, 13:14
QCodeEdit 2 is on the road! :)

This new version bring speed and lower memory usage by dropping QTextDocument. Yet, it keeps most (if not all) it non-rich-text-related features (i.e. bidi rendering, smart cursors, ...). This is achieved by mixing a homemade rendering and QTextLayout, the latter being summoned only when really needed which helps preserving the performance and memory gains for anyone who don't need such fancy features (are there much coders that write anything but english in their sources anyway???).

Other important progress have been made since my last report here :

the panel system evolved quite a lot and those enjoying the firefox-like search panels should be happy enough
the highlighting engine also evolved a great deal. The use of NFAs, discussed in another thread, made it way faster than it ever had been and also a lot more flexible
the API become simpler and the code lighter
The code is available, through SVN, here : https://edyuk.svn.sf.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2/

I'd be glad to get as much feedback as possible to improve it and make it a solid codebase for text editing applications. Feedback about bidi handling would be especially valued since I can't really know how good it is being an evil Westerner which only uses Latin-1 charset. ;)

fullmetalcoder
28th July 2007, 16:43
After having a quick glance at QCodeEdit 2, elcuco urged me to do some benchmarks since I claimed my newborn to be MUCH better than QTextDocument, QTextEdit and co.

Even without considering everything what comes build in in QCodeEdit (line numbers, line marks, folding, generic highlighting definition, foundations for completion, ...) and lacks in the concurrent, these results (http://edyuk.org/misc/benchmarks-qce-qte-28-07-2007.tar.gz) should be enough to assert the advantage of using QCodeEdit (or at least something that does not rely on QTextDocument ;) ).

Notes :

The archive holds a spreadsheet which sums up the benchmarks result but also the benchmarks output files from which it has been filled...
The full code for the benchmarking tool and the files used to benchmark are available in the "benchmark" subdir of the SVN repository mentioned in my previous post

magland
28th July 2007, 19:10
Looks promising... When will QCodeEdit 2 be available for use? I tried downloading from svn using below address but was unable to connect.

fullmetalcoder
29th July 2007, 08:13
I tried downloading from svn using below address but was unable to connect.
You can't "download" from SVN but, provided you have a Subversion client (http://subversion.tigris.org/links.html#clients) installed, you can "checkout" the content of a repository... The code is already available through SVN but no package will be issued before at least a week...

Methedrine
30th July 2007, 20:48
I have a little trouble getting QCodeEdit2 to compile on Ubuntu Feisty, see this log:


daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$ qmake -v
QMake version 2.01a
Using Qt version 4.3.0 in /usr/lib
daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$ qmake
daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$ make
cd lib/ && make -f Makefile
make[1]: Betrete Verzeichnis '/home/daehlith/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2/lib'
g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQNFA_BUILD -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtXml -I/usr/include/qt4 -I. -Idocument -Ilanguage -Iwidgets -Iqxs -Iqnfa -I../../qpluginsystem -I.build -I.build -o .build/qsearchreplacepanel.o widgets/qsearchreplacepanel.cpp
.build/ui_searchreplace.h: In member function »void Ui_SearchReplace::setupUi(QWidget*)«:
.build/ui_searchreplace.h:56: Fehler: »class QVBoxLayout« hat kein Element namens »setLeftMargin«
.build/ui_searchreplace.h:57: Fehler: »class QVBoxLayout« hat kein Element namens »setTopMargin«
.build/ui_searchreplace.h:58: Fehler: »class QVBoxLayout« hat kein Element namens »setRightMargin«
.build/ui_searchreplace.h:59: Fehler: »class QVBoxLayout« hat kein Element namens »setBottomMargin«
.build/ui_searchreplace.h:73: Fehler: »class QHBoxLayout« hat kein Element namens »setLeftMargin«
.build/ui_searchreplace.h:74: Fehler: »class QHBoxLayout« hat kein Element namens »setTopMargin«
.build/ui_searchreplace.h:75: Fehler: »class QHBoxLayout« hat kein Element namens »setRightMargin«
.build/ui_searchreplace.h:76: Fehler: »class QHBoxLayout« hat kein Element namens »setBottomMargin«
.build/ui_searchreplace.h:169: Fehler: »class QHBoxLayout« hat kein Element namens »setLeftMargin«
.build/ui_searchreplace.h:170: Fehler: »class QHBoxLayout« hat kein Element namens »setTopMargin«
.build/ui_searchreplace.h:171: Fehler: »class QHBoxLayout« hat kein Element namens »setRightMargin«
.build/ui_searchreplace.h:172: Fehler: »class QHBoxLayout« hat kein Element namens »setBottomMargin«
make[1]: *** [.build/qsearchreplacepanel.o] Fehler 1
make[1]: Verlasse Verzeichnis '/home/daehlith/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2/lib'
make: *** [sub-lib-make_default] Fehler 2
daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$

Sorry that these error message are german, but its just the compiler complaining about missing functions. Solution?

fullmetalcoder
30th July 2007, 21:24
Sorry that these error message are german, but its just the compiler complaining about missing functions. Solution?
This has been discussed in Edyuk thread already : Qt Designer from Qt 4.3.0 generates ui files that uic from Qt 4.2 can not turn into proper code since margin managements of layout has changed... There are several ways to get rid of this :

switch to Qt 4.3.0 (obvious but not always affordable)
modify ui files (either by hand or, possibly, through designer from Qt 4.2) to replace new properties by old, backward compatible ones
wait for the Trolls to fix this (I've submitted a bug report, just wait and see...)

Methedrine
30th July 2007, 21:28
This has been discussed in Edyuk thread already : Qt Designer from Qt 4.3.0 generates ui files that uic from Qt 4.2 can not turn into proper code since margin managements of layout has changed... There are several ways to get rid of this :

switch to Qt 4.3.0 (obvious but not always affordable)
modify ui files (either by hand or, possibly, through designer from Qt 4.2) to replace new properties by old, backward compatible ones
wait for the Trolls to fix this (I've submitted a bug report, just wait and see...)

I am using Qt 4.3.0 obviously. Guess I have to edit it by hand then.

fullmetalcoder
31st July 2007, 09:42
I am using Qt 4.3.0 obviously.
I did not even spot that... It's much weirder then... try out re-generating the header file from the ui (make distclean && qmake && make OR "dummy edit" in the .ui)


Guess I have to edit it by hand then.
Try a dummy edit first, to see if your uic version still generates a faulty code and feed me back... The bug submitted to TT might prove broader than expected...

Methedrine
31st July 2007, 10:26
I did not even spot that... It's much weirder then... try out re-generating the header file from the ui (make distclean && qmake && make OR "dummy edit" in the .ui)


Thank you, make distclean solved the issue. Should have checked that myself first, actually. Anyway, worked now :)

fullmetalcoder
31st July 2007, 13:34
Anyway, worked now :)
Nice to hear! Please feed me back. All suggestions, feelings and bug reports are relevant. QCodeEdit is meant to be usable and useful (i.e. to fulfil both users and coders need ;))

Time for fun has just come. Here's the last eye-candy : the generic highlighting definition for XML being displayed to test itself. I'm quite proud of the efficiency of it, especially relatively to its small size and human-readability! :cool:

BTW if you feel like creating new syntax definitions please do it. The 5 existing ones are far from being complete, though sufficient for Edyuk until now (C++, Doxygen, Python, C# and XML)

Methedrine
25th September 2007, 17:02
Hey,

is there any update on the QCodeEdit / QCodeModel 2 development? :-)

The framework looked fairly impressive the last time I checked it out.

fullmetalcoder
25th September 2007, 19:25
is there any update on the QCodeEdit / QCodeModel 2 development? :-)

The framework looked fairly impressive the last time I checked it out.
There have loads of improvements since I last talked about it here but since I did not get much feedback I stopped reporting progress.... The code is still available through in Edyuk SVN trunk and be tested both independently (a minimal example is provided) and within Edyuk. QCodeModel 2 is fairly mature (try out Edyuk completion... ;)) and QCodeEdit 2 works pretty well but it will need more testing/polishing before I can release anything (the search functionnalities are quite limited ATM for instance).

Usability
19th October 2007, 09:54
This editor looks like it could be very useful to me. In particular I like the ability to extend the syntax highlighting just with XML, as I have a couple of obscure languages I want to support.

I have it starting up inside my application, but cannot figure out how to make it go to a chosen line number. I need this for locating items in the source when the user clicks on them in my structure view.

Is this possible?
I am using the version from Edyuk beta 3.

Thanks in advance.

Usability
19th October 2007, 10:46
And another thing...
Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.

fullmetalcoder
20th October 2007, 10:10
And another thing...
Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.
As it was meant to be a code editor I decided, to make it both simpler to code and faster to run, to restrict the fonts to fixed width... With some slight modifications in a few spots it could be adapted to support variable width fonts but do you really need this???

As for going to a given line it is extremely simple :

// editor being of type QEditor*
editor->setCursor(editor->document()->cursor(line, colum));
:)

If you want to use bleeding edge QCodeEdit you can get it from Edyuk SVN repository...

P.S : if you bring support for new languages (or improve the existing ones) please consider sending me the new syntax definition files :)

Usability
21st October 2007, 16:38
As it was meant to be a code editor I decided, to make it both simpler to code and faster to run, to restrict the fonts to fixed width... With some slight modifications in a few spots it could be adapted to support variable width fonts but do you really need this???

I am trying to make this interface as attractive as possible, and would be reluctant to restrict the users choice of fonts so harshly.


As for going to a given line it is extremely simple :

// editor being of type QEditor*
editor->setCursor(editor->document()->cursor(line, colum));
:)

This worked a treat, thanks!



P.S : if you bring support for new languages (or improve the existing ones) please consider sending me the new syntax definition files :)

The plan is that the application I am writing will one day be released commercially. So my use of this editor assumes that you are willing to release the code with a commercial license. Obviously you would expect something in return, so we could pay you or contribute all the language templates we create. Do you have a price for commercial use?

fullmetalcoder
21st October 2007, 16:52
The plan is that the application I am writing will one day be released commercially. So my use of this editor assumes that you are willing to release the code with a commercial license. Obviously you would expect something in return, so we could pay you or contribute all the language templates we create. Do you have a price for commercial use?
I have nothing against releasing my code under a commercial license and I'm sure we could find an agreement on the "price" (the word is way softer when it's something you get than when you have to pay it ;)) if it were legally possible... What I mean is simple : I wrote QCodeEdit using Qt Open Source Edition and I'll probably never be able to use a Commercial Edition so I don't know if I am allowed to release my code under a commercial license, even if you DO have a Qt Commercial Edition... I guess we'd need to discuss this with Trolltech...

Usability
21st October 2007, 18:03
I just started creating a new language file, and have a quick question.
The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?

Thanks in advance.

fullmetalcoder
21st October 2007, 18:13
I just started creating a new language file, and have a quick question.
The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?
There's no such tag ATM but I'll add it ASAP... :o Keep an eye on the SVN...

croftj
27th October 2007, 13:26
Hi,

It would be nice while you are working on such a handy widget is to add a much needed feature which hasn't been done for the last 10 years or so.

It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).

Thanks!

fullmetalcoder
31st October 2007, 11:46
And another thing...
Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.
Support for variable width font has at last been brought (available in the SVN...) :)


The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?
Done. :) A new attribute has been added : caseSensitive. It is supported by all tags (except, obviously, by the <embed> one). All element that do not set it inherit the value of their parent and the default value of the root element is "true".BTW, as all boolean attributes it can be set indifferently using "true", "false", "enabled", "disabled", "0" or "1"


It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).
I'm thinking about it. I admit it would be extremely nice to have but it's not that easy to implement...

Usability
31st October 2007, 12:38
Cool!

I confirm I see proportional fonts and the case sensitivity flag works. To save others working back through this thread and dealing with the abbreviated links, here is the svn command to get this.


svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit

There appear to be a few glitches.


On my system, when I use a proportional font, find doesn't work.
Also with proportional fonts, the text that is made bold by the syntax highlighting does not increase in character spacing, so gets squashed together.
With a fixed width font the find backwards icon (up arrow) behaves strangely. The first reverse find sometimes updates the line number in the status bar, but does not move the cursor at all. Other times it just does nothing.

fullmetalcoder
31st October 2007, 16:27
On my system, when I use a proportional font, find doesn't work.
Well... Quite unsurprisingly it does work for me whatever the font is. However it sometimes isn't triggered when pressing enter from the line edit... That's weird and I'll look into it ASAP



Also with proportional fonts, the text that is made bold by the syntax highlighting does not increase in character spacing, so gets squashed together.
The bold text looked normal to me at first but you're right, spacing could be a little bigger and I'll solve this easily for I know why it happens :)



With a fixed width font the find backwards icon (up arrow) behaves strangely. The first reverse find sometimes updates the line number in the status bar, but does not move the cursor at all. Other times it just does nothing.
The find backward is known not to work... However I didn't have time to fix it lately. I'll try my best...

Usability
31st October 2007, 16:52
Well... Quite unsurprisingly it does work for me whatever the font is. However it sometimes isn't triggered when pressing enter from the line edit... That's weird and I'll look into it ASAP


Your right, the font has nothing to do with it. Find stops working for a while if you search for something thats not in the file, or you repeat the find after the last occurance. Having done this, neither the enter or find forward button work even if you change the search for something that does exist.

Clicking the reverse find brings it back to life again.

fullmetalcoder
1st November 2007, 11:42
Your right, the font has nothing to do with it. Find stops working for a while if you search for something thats not in the file, or you repeat the find after the last occurance. Having done this, neither the enter or find forward button work even if you change the search for something that does exist.

Clicking the reverse find brings it back to life again.
Find now works as expected:

it no longer tries a backward search when asked for a forward one
it is now able to perform proper backward searches
it now respects boundaries (i.e search within selection)
focus is now sent back to the line edit every time a checkbox of the search panel is (un)checked so that pressing enter afterwards triggers search as expected:)

BTW I tried to increase spacing for bold fonts by using a proper QFontMetrics object operating on a bold font (instead of the default document font) but it didn't appeared to change much... however as bold characters didn't get squashed on my box it might solve the glitches on yours...

Usability
1st November 2007, 14:53
Getting better all the time!
I confirm find in both directions works now, and that syntax highlighting in bold on proportional fonts is nicely spaced.

One gremlin I did notice was that if you select some bold text, the background shading breaks up. Its OK if you select a complete line, or if the text isn't bold, its specifically the word selection of bold text that is not working quite right. I attached a snapshot of this below.

Also I noticed my previous svn command was wrong. Here is the (hopefully) correct version


svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2

fullmetalcoder
1st November 2007, 16:28
One gremlin I did notice was that if you select some bold text, the background shading breaks up. Its OK if you select a complete line, or if the text isn't bold, its specifically the word selection of bold text that is not working quite right. I attached a snapshot of this below.
Side effect of the previous fix... Looks like QFontMetrics behaves differently on Linux and Windows BTW for I did not notice this (could also be my variable width font being more "bold-friendly" ...;)). Anyway I just fixed it (or so I believe, but I need a confirmation...)

Usability
1st November 2007, 16:46
Side effect of the previous fix... Looks like QFontMetrics behaves differently on Linux and Windows BTW for I did not notice this (could also be my variable width font being more "bold-friendly" ...;)). Anyway I just fixed it (or so I believe, but I need a confirmation...)

Indeed you fixed it, and stunningly quickly too! Thank you.

You are going to hate me for this, but I found one more....
When you click on a line that has some bold words to the left of where the mouse cursor was when you clicked, the text cursor is not placed under the mouse cursor. It appears a few characters to the right of where the mouse was.

If you click on a line with no bold, it works fine. The text cursor is inserted where the mouse cursor was.

fullmetalcoder
2nd November 2007, 10:51
You are going to hate me for this, but I found one more....
When you click on a line that has some bold words to the left of where the mouse cursor was when you clicked, the text cursor is not placed under the mouse cursor. It appears a few characters to the right of where the mouse was.

If you click on a line with no bold, it works fine. The text cursor is inserted where the mouse cursor was.
Come on! Why would I hate such a helpful tester? ;) If I claim to support variable width fonts I'd better do it properly... Proper fix should be on SVN already by the time you read this message. :)

Usability
2nd November 2007, 13:22
That fixed it, thanks!

A very nice editor you have there.

Usability
2nd November 2007, 14:21
I just found a folding bug.

Invoke the example shipped with the editor thus:
example/example
In the text that appears, enter an open brace, ie {
The folding markers appear, but there is no end to the fold due to the bracket imbalance.
Click on the - to close the fold, and the editor will crash.

fullmetalcoder
2nd November 2007, 15:06
I just found a folding bug.
I just fixed it :) Thank you for your accurate reports.

Usability
2nd November 2007, 15:28
Indeed you did, and stunningly quickly too!
Thank you :D

fullmetalcoder
3rd November 2007, 19:39
It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).
I just added column column-based edit which opens way for selection but I'll need advice on this to ensure that they will not alter the overall usability of the editor...

By the way I did a lot more than column based edit (though it also allows it) : I added something I called "cursor mirrors". These are cursors which mimic the actions of the "real" cursor. You can place them anywhere by holding the Control key while clicking and start typing. :)

There are some limitations and probably some polishing left to do but it works quite fine and open new perspectives for tedious and repetitive tasks...

Usability
4th November 2007, 09:46
I added something I called "cursor mirrors". These are cursors which mimic the actions of the "real" cursor. You can place them anywhere by holding the Control key while clicking and start typing. :)


Wild! I have never seen anything like that before. It seems likely it will be useful, but only time will tell.

Is the column editing available yet, or just work in progress? I couldn't find any way to select a column yet.

My preference for a user interface is the nedit approach of click then control click to specify the corners of the column, or a control drag to specify its area. The kwrite/kate approach of shift-ctrl-b to toggle between rectangular and normal selection modes always seemed clunky by comparison. But going down the ctrl drag route would mean finding another way to drop your cursor mirrors. Ctrl+alt for the mirrors perhaps.

Incidentally, I did spot a minor bug yesterday while introducing code folding markers into one of our languages. You can reproduce it with the cpp.qnfa file. Try this change

line 38 before
<sequence parenthesis="curly:close" indent="1" fold="1">}</sequence>
after
<sequence parenthesis="curly:close" indent="1" fold="1"> </sequence>

Note the close marker is changed from a } to a space. The editor will now segfault on invocation. Sure its a stupid thing do to, and was in fact a mistake, but crashing seemed a bit harsh.

fullmetalcoder
4th November 2007, 13:33
Is the column editing available yet, or just work in progress? I couldn't find any way to select a column yet.
Column editing, as far as I understood, is just a restriction of cursor mirrors. I added a way to do it directly : Ctrl + drag the cursor vertically and it will automatically add cursor mirrors all along. :)


My preference for a user interface is the nedit approach of click then control click to specify the corners of the column, or a control drag to specify its area. The kwrite/kate approach of shift-ctrl-b to toggle between rectangular and normal selection modes always seemed clunky by comparison. But going down the ctrl drag route would mean finding another way to drop your cursor mirrors. Ctrl+alt for the mirrors perhaps.
I was thinking about keeping the "regular" cursor mirrors as they are now and using ctrl+shift + mouse cursor drag to perform column selection... Can you test the current implementation and tell me what you think?


Incidentally, I did spot a minor bug yesterday while introducing code folding markers into one of our languages. You can reproduce it with the cpp.qnfa file. Try this change

line 38 before
<sequence parenthesis="curly:close" indent="1" fold="1">}</sequence>
after
<sequence parenthesis="curly:close" indent="1" fold="1"> </sequence>
Note the close marker is changed from a } to a space. The editor will now segfault on invocation. Sure its a stupid thing do to, and was in fact a mistake, but crashing seemed a bit harsh.
There indeed was a caveat in the xml to nfa converter... It made the assumption that all elements add a text child node... thanks for the report, I've just fixed this.:)

Usability
4th November 2007, 14:35
Column editing, as far as I understood, is just a restriction of cursor mirrors. I added a way to do it directly : Ctrl + drag the cursor vertically and it will automatically add cursor mirrors all along. :)

I have never seen anything like this before, and I think its unique. You might start a trend with this.

However I think the feature requested by croftj is the ability to cut and paste rectangles of text. Most editors have this, just run up kate, kwrite, or nedit and try it. Its ctrl-drag in nedit and ctrl-shift-b then a normal drag in kate/kwrite.

You can cut a rectangle of text and paste it in somewhere else. The cursor mirrors do not help with this.


I was thinking about keeping the "regular" cursor mirrors as they are now and using ctrl+shift + mouse cursor drag to perform column selection... Can you test the current implementation and tell me what you think?

I think both cursor mirrors and column selections have their own uses, and keeping both would be good.

For example if you want to change several lines of "filename.h" to <filename.h>, it would be perfect. However suppose you wanted to pick up characters 4 to 10 of every line, cut them out, and paste them all back in again at column 15. Its simple with a rectangular selection, but I can see no way of doing this with the current qcodeedit. ctrl+shift+drag does the same as a normal drag as far as I can tell, and the cursor mirrors do not appear to help for this.

I think if you add rectangular cut/paste, you would need only one more feature to have an editor that could hold its own with the usual kate/kwrite/nedit crowd. I could get tempted to contribute a simple tabbed GUI for it and use it as a stand alone editor, if as I suspect, qcodeedit2 is faster. Being independent of KDE would be a useful advantage also.

After rectanguar cut/paste the only other important omission would be commenting in/out a block of text. You could convert to comment by prepending what ever the language template identified with context id="comment/single", and convert from comment by removing that.

This is important for languages like VHDL and TCL that only have the type of comment character stops at the end of the line.

fullmetalcoder
4th November 2007, 14:48
I have never seen anything like this before, and I think its unique. You might start a trend with this.
Time will tell... In case you care about history this feature had been requested already back in the times of DevQt genesis...;)


However I think the feature requested by croftj is the ability to cut and paste rectangles of text. Most editors have this, just run up kate, kwrite, or nedit and try it. Its ctrl-drag in nedit and ctrl-shift-b then a normal drag in kate/kwrite.

You can cut a rectangle of text and paste it in somewhere else. The cursor mirrors do not help with this.
It DOES... It may not look obvious to the user but I use the exact same internal infrastructure to and rectangular selection, and it's already working... The CTRL+drag gives you a column edit right? Now do CTRL+SHIFT + drag (and move to right/left) and you'll obtain a rectangular selection that can be copied/cut/pasted. The paste mode is inspired from Kate/Kwrite : the MIME data is given a "text/column-selection" data which can be inserted on several lines (even if there is already some text...) and, as a fallback, the subsequent selections separated by linefeeds.



ctrl+shift+drag does the same as a normal drag as far as I can tell, and the cursor mirrors do not appear to help for this.
:o I knew I forgot something... D'n'D does not work yet with rectangular selection...


I could get tempted to contribute a simple tabbed GUI for it and use it as a stand alone editor
There is already such a GUI : Edyuk trimmed of all its plugins ;)


After rectanguar cut/paste the only other important omission would be commenting in/out a block of text. You could convert to comment by prepending what ever the language template identified with context id="comment/single", and convert from comment by removing that.
I'll try to add that ASAP.

Usability
4th November 2007, 17:31
The CTRL+drag gives you a column edit right?

It gives me a trail of cursor mirrors. Is that the same thing?



Now do CTRL+SHIFT + drag (and move to right/left) and you'll obtain a rectangular selection that can be copied/cut/pasted.


It doesn't for me. I get a regular selection. It gives you the complete lines that were diagonally dragged over.



The paste mode is inspired from Kate/Kwrite : the MIME data is given a "text/column-selection" data which can be inserted on several lines (even if there is already some text...) and, as a fallback, the subsequent selections separated by linefeeds.


That sounds perfect, its just I don't see it with the current svn checkout.
I tried using
example/example lib/qcodeedit.cpp

I do not get anything special happening holding down shift and control while clicking and then dragging diagonally. Just a regular complete line selection occurs.

:confused:

Usability
4th November 2007, 17:52
If I click, then somewhere else shift click, I would expect a selection to appear between the two places. This is not working on my machine, which may be relevant to the rectangular selection issues.

fullmetalcoder
4th November 2007, 19:34
It doesn't for me. I get a regular selection. It gives you the complete lines that were diagonally dragged over.

That sounds perfect, its just I don't see it with the current svn checkout.
Apologies... I forgot committing the latest changes... :o


It gives me a trail of cursor mirrors. Is that the same thing?
It is. But your working copy lacks a restriction so the "trail" may not be as usable as it should...

I've finally dealt with the drag and drop issue and the code (for ALL these neat features) is at last available on SVN. Have fun! :D

Usability
4th November 2007, 20:37
That is definitely better. I get a rectangular selection now, provided I use ctrl-shift and drag the mouse gently down the screen. If I move the mouse too fast, it skips some lines. So my rectangular selection has gaps in it!

I noticed another thing about clicking the start of a block and shift clicking the end. The first time I try this after invocation, it works and I get the range selected. All subsequent attempts fail. Do you see this?

If this worked it would provide a workaround to the drag speed restriction.

fullmetalcoder
5th November 2007, 09:14
That is definitely better. I get a rectangular selection now, provided I use ctrl-shift and drag the mouse gently down the screen. If I move the mouse too fast, it skips some lines. So my rectangular selection has gaps in it!
Fixed. I also made dragging more consistent and natural : dragging back does not leave unwanted cursors/selection anymore :)


I noticed another thing about clicking the start of a block and shift clicking the end.
As far as I understand the code ;), this action shouldn't even have lead to a selection but I fixed this... I also added the possibility to column select without dragging : click somewhere and then click somewhere else while holding down shift and control.

The only downside of having such functionnalities is that I'll have to write a maual if I want users to take advantage of them...;) Anybody willing to help with this?

Usability
5th November 2007, 09:50
We have a working column editor now. :D

This is an impressive software component. You should be proud.

Usability
5th November 2007, 10:58
Here is a thought.
With your cursor mirrors, could you allow the cursor movement keys to operate on all the cursors?

I just wanted to add some characters to the end of a 100 or so lines of different length. It would have been really nice to drop a cursor mirror on all the lines, push the end of line key, and start typing.

Then you could do other useful edits with a column of cursors, for example left arrow back a few characters and insert something.

You would kill of the cursor mirrors and return to a single cursor with a mouse click.

fullmetalcoder
5th November 2007, 15:54
Here is a thought.
With your cursor mirrors, could you allow the cursor movement keys to operate on all the cursors?
I added the possiblity to move aligned cursors (including but not limited to column edit) as long as the "real" cursor remains on the same line. This moves support Shift-based selection so it is possible to turn a column edit into column selection or to extend a column selection through the keyboard. :)


I just wanted to add some characters to the end of a 100 or so lines of different length. It would have been really nice to drop a cursor mirror on all the lines, push the end of line key, and start typing.
Support for such "extended" key bindings is more controversial (and currently trickier to implement) for it would break column edit but I guess I can always add a workaround for the end of line key since I admit this one would be handy...

Edit : after reviewing the changes with a more critical eye it appeared to be less consistent than I expected so I instead implemented a proper full "cursor move mirroring". Mirrors disappear as soon as any cursor (real or mirror) leave the line it was on and the alignment can always be restored (as long as there are cursor mirrors of course...;)) thorugh the start key.

fullmetalcoder
5th November 2007, 17:53
After rectanguar cut/paste the only other important omission would be commenting in/out a block of text. You could convert to comment by prepending what ever the language template identified with context id="comment/single", and convert from comment by removing that.

This is important for languages like VHDL and TCL that only have the type of comment character stops at the end of the line.
Done. :D
As you suggested I selected the "comment/single" context (and the content of the first <start> tag so avoid putting regexp here...). The actions are accessible via Ctrl+D and Ctrl+Shift+D, as in Kwrite/Kate but also through the context menu (beware though... they operate on current line(s), not on the one to which mouse cursor points...).

vermarajeev
6th November 2007, 08:54
Lots of errors in "qcodeedit-1.0".

What I did on windows (qt4.2)?
1. Unzipped the file
2. Loaded the example.pro
3. Loaded the qcodeedit.pro
4. Loaded the standalone.pro
5. made example.pro dependent on qcodeedit and standalone
6. Build
7. Lots of errors

c:\Qt\4.2.2\include\QtCore\../../src\corelib\global\qglobal.h(1464) : error C2027: use of undefined type 'QMargin'
src\editor\qeditor.h(34) : see declaration of 'QMargin'
c:\Qt\4.2.2\include\QtCore\../../src\corelib\tools\qlist.h(327) : see reference to class template instantiation 'QTypeInfo<T>' being compiled
with
[
T=QMargin
]
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xstring(521) : while compiling class-template member function 'void QList<T>::node_copy(QList<T>::Node *,QList<T>::Node *,QList<T>::Node *)'
with
[
T=QMargin
]
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(136) : while compiling class-template member function 'QList<T>::~QList(void)'
with
[
T=QMargin
]
src\editor\qeditor.h(134) : see reference to class template instantiation 'QList<T>' being compiled
with
[
T=QMargin
]
c:\Qt\4.2.2\include\QtCore\../../src\corelib\tools\qlist.h(329) : error C2514: 'QMargin' : class has no constructors
src\editor\qeditor.h(34) : see declaration of 'QMargin'
c:\Qt\4.2.2\include\QtCore\../../src\corelib\tools\qlist.h(332) : error C2514: 'QMargin' : class has no constructors
src\editor\qeditor.h(34) : see declaration of 'QMargin'
qplaintextedit.cpp ..... (and many more.......)

Any idea??
I wonder how others are able to compile.

elcuco
6th November 2007, 10:11
This means that the UI files are generated by QtDesigner4.3, and are not compatible with Qt4.2.

You have to install Qt4.3 or fix the UI files by loading them into Qtdesigner4.2 and then saving them back. There will be some information loose (the margins etc), but it will be easy to fix.

fullmetalcoder
6th November 2007, 13:47
I wonder how others are able to compile.
They are using the code from SVN trunk... ;) The code you downloaded is really old and hardly worth testing considering all the bugfixes and improvements that have been done since then...

Usability
6th November 2007, 17:00
I wonder how others are able to compile.

Sure, its confusing with that obsolete qcodeedit directory sitting there.
The thing you need to know is that the working version of qcodeedit is the one inside Edyuk. You can get it like this:


svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2

We need a FAQ on this.

Usability
6th November 2007, 17:05
Is there any way of making the editor save its contents under a new name?

pEditor->setFileName(qsNewFileName);
pEditor->save();

Looked tempting, but setFileName is protected. This would seem like basic functionality I would expect to be able to do without subclassing.

fullmetalcoder
6th November 2007, 17:35
Is there any way of making the editor save its contents under a new name?

pEditor->setFileName(qsNewFileName);
pEditor->save();

Looked tempting, but setFileName is protected. This would seem like basic functionality I would expect to be able to do without subclassing.
The "protected" visibility of this method stems from early genesis of QCodeEdit when it was not yet fully separated from Edyuk and thus dependent on qmdilib... Fixed. :)

Usability
6th November 2007, 18:06
Sorted, thanks!

vermarajeev
7th November 2007, 04:22
Very confusing :crying:
I go to edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2 and then how do I download the code. I get a link
1. "Revision 365: /trunk/3rdparty"
2. Click on "codeedit2"
3. another tab appears.

Is there a way I can download the new version of codeedit?

Usability
7th November 2007, 07:31
Very confusing :crying:
Is there a way I can download the new version of codeedit?

Is there a reason you cannot just run the svn command I posed further up this page? That will create a qcodeedit2 directory containing all the source.
You do not need a login account or anything, which is something that surprised me the first time I did it.

This is all you need to download the editor, build the editor and its example program, and run the demo



svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2
cd qcodeedit2
qmake
make
example/example lib/qcodeedit.cpp


I think the speed with which this editor is being developed means you have to get into svn.

The demo is no use as an editor, no save menu for example, its just there to show you how to call the editor from your own code. And its handy for logging bugs :)

vermarajeev
7th November 2007, 09:15
See the attached file.
I copy the path "http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2" in Mozilla and I get the page as shown in the image attached.

jpn
7th November 2007, 09:23
Go grab yourself a subversion client: http://subversion.tigris.org/ (svn-1.4.5-setup.exe is a good choice for Windows).

Usability
7th November 2007, 09:24
I get the page as shown in the image attached.

Thats the place. You want all of those files, directories, contents of the directories etc. Download them from the browser if you must.

Or there is always the single svn command.

Usability
7th November 2007, 14:48
I think we had a regression in the find feature in the last build. I notice now that if I do

example/example lib/qcodeedit.cpp

then ctrl-f to get the find dialog, then search for "this", it finds the first hit but refuses to find any of the others. Both the next icon, and the return key fail to repeat the find.

croftj
8th November 2007, 18:07
Great! I'll have to start laying with this. Maybe I can now ditch my pricey editor CRiSP. I like it a lot but it has a few features I don't like and it costs money and I can only run it on one of my machines without paying more money. Yes, I'm cheap!

-joe


Time will tell... In case you care about history this feature had been requested already back in the times of DevQt genesis...;)


It DOES... It may not look obvious to the user but I use the exact same internal infrastructure to and rectangular selection, and it's already working... The CTRL+drag gives you a column edit right? Now do CTRL+SHIFT + drag (and move to right/left) and you'll obtain a rectangular selection that can be copied/cut/pasted. The paste mode is inspired from Kate/Kwrite : the MIME data is given a "text/column-selection" data which can be inserted on several lines (even if there is already some text...) and, as a fallback, the subsequent selections separated by linefeeds.



:o I knew I forgot something... D'n'D does not work yet with rectangular selection...


There is already such a GUI : Edyuk trimmed of all its plugins ;)


I'll try to add that ASAP.

allstar
9th November 2007, 13:11
The QCodeEdit is amazing.
I would like to use it in my project. I am able to compile it only dynamicly/shared, but I when compiling statically on windows using mingw i get error, because it links -lqtmaind -lqtcored -lqtguid , but in the static-Qt, there are only theese libraries without the "d" at the end of the library names.

Thanks for help.

fullmetalcoder
9th November 2007, 17:52
The QCodeEdit is amazing.
I would like to use it in my project. I am able to compile it only dynamicly/shared, but I when compiling statically on windows using mingw i get error, because it links -lqtmaind -lqtcored -lqtguid , but in the static-Qt, there are only theese libraries without the "d" at the end of the library names.

Thanks for help.
Trying running "make release" (or "mingw32-make release") instead of just "make"... If it does not work open the project files and make sure the build mode is set to "release" (CONFIG += release)...


I think we had a regression in the find feature in the last build. I notice now that if I do

example/example lib/qcodeedit.cpp

then ctrl-f to get the find dialog, then search for "this", it finds the first hit but refuses to find any of the others. Both the next icon, and the return key fail to repeat the find.
Right. It comes from the new behavior of QDocumentCursor::clearSelection() which used to leave the column number unchanged while it now sets it back to anchor column (introduced to make column selection consistent...). The fix is fortunately a one-liner and should be committed by the time you read this :)

allstar
9th November 2007, 19:11
Trying running "make release" (or "mingw32-make release") instead of just "make"... If it does not work open the project files and make sure the build mode is set to "release" (CONFIG += release)...

Yes, the primary problem was solved, but then I got undefined references to DOM, so I added QT += xml that helped with the xml, but then I got another error:


C:\qcodeedit2\example>make release
make -f Makefile.Release
make[1]: Entering directory `C:/qcodeedit2/example'
g++ -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-ps
eudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o "release\example.exe"
.build\main.o -L"d:\build\qt-win-opensource-src-4.3.2\lib" -lmingw32 -lqtmain -
L.. -lqcodeedit -lQtXml -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -l
winspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvap
i32 -lws2_32
d:\build\qt-win-opensource-src-4.3.2\lib\libQtGui.a(qcompleter.o):qcompleter.cpp
:(.text$_ZN17QCompletionEngineD0Ev[QCompletionEngine::~QCompletionEngine()]+0x0)
: multiple definition of `QCompletionEngine::~QCompletionEngine()'
..\libqcodeedit.a(qcompletionengine.o):c:/qcodeedit2/lib/language/qcompletioneng
ine.cpp:50: first defined here
d:\build\qt-win-opensource-src-4.3.2\lib\libQtGui.a(qcompleter.o):qcompleter.cpp
:(.text$_ZN17QCompletionEngineD1Ev[QCompletionEngine::~QCompletionEngine()]+0x0)
: multiple definition of `QCompletionEngine::~QCompletionEngine()'
..\libqcodeedit.a(qcompletionengine.o):c:/qcodeedit2/lib/language/qcompletioneng
ine.cpp:50: first defined here
.build\main.o:main.cpp:(.text+0x51b): undefined reference to `_imp___ZN14QFormat
FactoryC1ERK7QStringP7QObject'
.build\main.o:main.cpp:(.text+0x564): undefined reference to `_imp___ZN9QDocumen
t16setFormatFactoryEP14QFormatFactory'
.build\main.o:main.cpp:(.text+0x58e): undefined reference to `_imp___ZN20QLineMa
rksInfoCenter8instanceEv'
.build\main.o:main.cpp:(.text+0x5a6): undefined reference to `_imp___ZN20QLineMa
rksInfoCenter13loadMarkTypesERK7QString'
.build\main.o:main.cpp:(.text+0x5ef): undefined reference to `_imp___ZN16QLangua
geFactoryC1EP14QFormatFactoryP7QObject'
.build\main.o:main.cpp:(.text+0x638): undefined reference to `_imp___ZN16QLangua
geFactory17addDefinitionPathERK7QString'
.build\main.o:main.cpp:(.text+0x698): undefined reference to `_imp___ZN9QCodeEdi
tC1EP7QWidget'
.build\main.o:main.cpp:(.text+0x6c4): undefined reference to `_imp___ZN14QLineMa
rkPanelC1EP7QWidget'
.build\main.o:main.cpp:(.text+0x6f9): undefined reference to `_imp___ZN9QCodeEdi
t8addPanelEP6QPanelNS_8PositionE'
.build\main.o:main.cpp:(.text+0x71c): undefined reference to `_imp___ZN16QLineNu
mberPanelC1EP7QWidget'
.build\main.o:main.cpp:(.text+0x751): undefined reference to `_imp___ZN9QCodeEdi
t8addPanelEP6QPanelNS_8PositionE'
.build\main.o:main.cpp:(.text+0x774): undefined reference to `_imp___ZN10QFoldPa
nelC1EP7QWidget'
.build\main.o:main.cpp:(.text+0x7a9): undefined reference to `_imp___ZN9QCodeEdi
t8addPanelEP6QPanelNS_8PositionE'
.build\main.o:main.cpp:(.text+0x7cc): undefined reference to `_imp___ZN12QStatus
PanelC1EP7QWidget'
.build\main.o:main.cpp:(.text+0x804): undefined reference to `_imp___ZN9QCodeEdi
t8addPanelEP6QPanelNS_8PositionE'
.build\main.o:main.cpp:(.text+0x827): undefined reference to `_imp___ZN19QSearch
ReplacePanelC1EP7QWidget'
.build\main.o:main.cpp:(.text+0x85f): undefined reference to `_imp___ZN9QCodeEdi
t8addPanelEP6QPanelNS_8PositionE'
.build\main.o:main.cpp:(.text+0x870): undefined reference to `_imp___ZNK9QCodeEd
it6editorEv'
.build\main.o:main.cpp:(.text+0x898): undefined reference to `_imp___ZNK9QCodeEd
it6editorEv'
.build\main.o:main.cpp:(.text+0x8a8): undefined reference to `_imp___ZN7QEditor7
setTextERK7QString'
.build\main.o:main.cpp:(.text+0x8d5): undefined reference to `_imp___ZNK9QCodeEd
it6editorEv'
collect2: ld returned 1 exit status
make[1]: *** [release\example.exe] Error 1
make[1]: Leaving directory `C:/qcodeedit2/example'
make: *** [release] Error 2

Please help, if you can.

fullmetalcoder
9th November 2007, 21:09
Please help, if you can.
All the linking errors (which presumably includes QtXml related ones) come from the fact that you are trying to build QCodeEdit as a static lib... The simplest way to work around this is to add the following line to your project file :


DEFINES += _QCODE_EDIT_BUILD_

Note : the use of this macro was usually intended as a way to allow direct embedding of the sources but AFAIK it should work just as well with static libs... :)

Usability
10th November 2007, 07:58
Thanks FullMetalCoder, I confirm find is working again.

allstar
10th November 2007, 11:13
All the linking errors (which presumably includes QtXml related ones) come from the fact that you are trying to build QCodeEdit as a static lib... The simplest way to work around this is to add the following line to your project file :


DEFINES += _QCODE_EDIT_BUILD_

Note : the use of this macro was usually intended as a way to allow direct embedding of the sources but AFAIK it should work just as well with static libs... :)

Thanks. Finally I added it dircetly without the lib and its working. But it was needed to comment QCompletionEngine::~QCompletionEngine() - empty destructor in qcompletionengine.cpp -there was a conflict,( see above).

Otherwise. There is a problem, that you cannot scroll with mousewheel when the cursor is on linenumberbar.

croftj
11th November 2007, 13:02
Hi,

I've been playing with this more, with version 1.0. Does this have the features your speaking of?

What version of Qt should I be compiling against. I am using 4.2.1.

How does one invoke 'column based' editing? Also, I cannot seem to get the cursor mirroring to work. I tried by clicking the document to place the curser, then point to another place and click while holding the Ctrl key. It just moved the cursor. Selecting worked like it always did.

This may sound like I'm being picky about this selection. Over the years, I have come to use it at least once a day and quite often more. I'm trapped on my editor until I find a solution. It makes moving rows of variable names or array elements . It save me a lot of typing. both of my fingers really appreciate that ;)

-joe


I just added column column-based edit which opens way for selection but I'll need advice on this to ensure that they will not alter the overall usability of the editor...

By the way I did a lot more than column based edit (though it also allows it) : I added something I called "cursor mirrors". These are cursors which mimic the actions of the "real" cursor. You can place them anywhere by holding the Control key while clicking and start typing. :)

There are some limitations and probably some polishing left to do but it works quite fine and open new perspectives for tedious and repetitive tasks...

fullmetalcoder
11th November 2007, 13:26
I've been playing with this more, with version 1.0. Does this have the features your speaking of?
Version 1.0 is an antquity... You can either fetch sources from SVN (as described above) or get the package I've just released (https://sourceforge.net/project/showfiles.php?group_id=168260&package_id=201786&release_id=553359). :)

BTW, QCodeEdit 2 has troubles with Qt 4.2 (ui files incompatibilities and some crucial bugs were fixed in Qt 4.3.x) so you'd better upgrading.

croftj
11th November 2007, 17:05
This is looking much better. The cursor mirroring does pretty much behaves like I expect. It is just cumbersome to use.

The upside is that it looks like the code is present to make rectangular selections. Can you give me hints where to look if I wanted to see where the markings for a rectangular area get set?

On another note. As pointed out by another in an earlier post, you really should change your naming scheme. It's hard to tell your class names from Trolltechs. Not to mention, if they ever create a class name you have, it will cause you no end of grief.

The 'fm' prefix is still available. So your class name would be QfmCodeEdit etc. You can learn more about the Nameing guidlines and registering a prefix here: http://trolltech.com/developer/notes/naming. Look for 'Reserved Name Prefixes'.

I know it can be a daunting task to rename your classes. I just went through this will my QcjData classes. It only gets harder as more time passes so it's best to do it sooner than later.

Keep up the good work!

-joe


Version 1.0 is an antquity... You can either fetch sources from SVN (as described above) or get the package I've just released (https://sourceforge.net/project/showfiles.php?group_id=168260&package_id=201786&release_id=553359). :)

BTW, QCodeEdit 2 has troubles with Qt 4.2 (ui files incompatibilities and some crucial bugs were fixed in Qt 4.3.x) so you'd better upgrading.

elcuco
11th November 2007, 21:33
another option might be using a separate namespace:



using namespace FullMetalCoderInc;
FullMetalCoderInc::QCodeEdit *editor; // another option

fullmetalcoder
16th November 2007, 12:24
The upside is that it looks like the code is present to make rectangular selections. Can you give me hints where to look if I wanted to see where the markings for a rectangular area get set?
what do you mean? there is no real rectangular selection but a smartly managed combination of selections actually which, drawn together make up a nice rectangle...

As for the naming I guess a namspace would be the best solution for consistency...

Usability
18th November 2007, 12:57
I think I just found a couple of bugs.
When using proportional fonts, the horizontal scroll bar appears to significantly under estimate the width of the text and will not allow scrolling to the end of the lines.
Also try this. Move the cursor to the start of a line either by clicking it there or using home. Now hold shift and press down cursor. In every other editor, this moves the cursor down to the start of the next line and selects all of the line that it left. In QCodeEdit it does this but also selects all of the line it moved to, leaving 2 lines completely selected.

fullmetalcoder
18th November 2007, 19:39
I think I just found a couple of bugs.
When using proportional fonts, the horizontal scroll bar appears to significantly under estimate the width of the text and will not allow scrolling to the end of the lines.
Also try this. Move the cursor to the start of a line either by clicking it there or using home. Now hold shift and press down cursor. In every other editor, this moves the cursor down to the start of the next line and selects all of the line that it left. In QCodeEdit it does this but also selects all of the line it moved to, leaving 2 lines completely selected.
Good news : I fixed both issues. :)
Bad news : my network connection is getting kinda weird (some apps can use it, browser for instance and others fail...) so, as svn hung during the commit I'm not quite sure the content of the repository has been updated properly...

Usability
19th November 2007, 09:52
It works now, thanks for that fix :D

I just suffered using windows again long enough to check this still compiles on MSVC6. There were just two changes needed.

qeditor.cpp line 1120, do not return a value, its a void function.
Similarly 1685.

Usability
19th November 2007, 13:24
Hi Fullmetalcoder, I am having trouble refreshing the content of the editor. I did this


QString qsFileName = pEditor->fileName();
pEditor->load(qsFileName);

and it causes a crash.

The call stack shows

QEditor::load, QEditor::setText, QDocument::setText, qDeleteAll, qDeleteAll, QDocumentLineHandle::~QDocumentLineHandle, QDocumentPrivate::emitLineDeleted, QHash<Key, T>::remove, QHash<Key, T>::detach, QHash<Key, T>::detach_helper


If I am going about this the right way, hopefully you can bind some event in one of your programs to these two lines and reproduce the crash. If it doesn't just fall out and you need a test case, let me know.

Usability
19th November 2007, 14:45
Some search related questions.

I think there is a problem with the "In selection" option on find. A concrete example. I invoke the editor like this:
example/example lib/qcodeedit.cpp
Then select lines 35 to 39
key ctrl-f
enter new as the search string, and it finds the one on line 28. Note that this is with From cursor off.

What is the second button from the left in the find bar for? I have never know it do anything and it has no tool tip.

Is there any way I can set the "From cursor" option to be the default when I create an editor? I think this is what most people would expect of a find, and I want to save them the trouble of figuring out why their first find didn't do what they wanted.

fullmetalcoder
20th November 2007, 19:50
qeditor.cpp line 1120, do not return a value, its a void function.
Similarly 1685.


I am having trouble refreshing the content of the editor. I did this


QString qsFileName = pEditor->fileName();
pEditor->load(qsFileName);

I think there is a problem with the "In selection" option on find. A concrete example. I invoke the editor like this:
example/example lib/qcodeedit.cpp
Then select lines 35 to 39
key ctrl-f
enter new as the search string, and it finds the one on line 28. Note that this is with From cursor off.

Is there any way I can set the "From cursor" option to be the default when I create an editor? I think this is what most people would expect of a find, and I want to save them the trouble of figuring out why their first find didn't do what they wanted.
I'll sort these out ASAP (which basically means next week end...)


What is the second button from the left in the find bar for? I have never know it do anything and it has no tool tip.
I'm not sure I understand which one you refer to but I think it's the one supposed to somehow "refresh" the search context.

Usability
21st November 2007, 14:09
I am having trouble writing the syntax file for a language that uses begin/end as the block start/end delimiters, like { and } in C.

I started with this:


<sequence format="keyword" parenthesis="be_block:open" indent="1" fold="1">begin</sequence>
<sequence format="keyword" parenthesis="be_block:close" indent="1" fold="1">end</sequence>

And the folding mostly worked well. Unfortunately it spotted the begin in

int beginning;

and marked it as the start of a fold-able block.
So I tried this:


<list id="keywords/blocks" format="keyword">
<word parenthesis="be_block:close" indent="1" fold="1">begin</word>
<word parenthesis="be_block:close" indent="1" fold="1">end</word>
</list>

But that doesn't fold at all. Any suggestions on the solution for this?


A couple of related but somewhat pedantic questions. There seem to be some gremlins exposed by having begin and end markers on the same line. Try running the example editor, eg

example/example

And enter this:


if (1) {;} else {


}
if {


}

then collapse the fold starting on the if. For me this produces a corrupt screen showing three if lines. I appreciate that is an ugly example, and I wont be at all surprised if you choose to ignore it.

This one is a more reasonable code style.


if (1) {


} else {


}

Here if you fold up the if statement it folds the complete program. I am not sure this is correct. I was expecting the else branch to remain expanded.

fullmetalcoder
23rd November 2007, 20:12
I am having trouble writing the syntax file for a language that uses begin/end as the block start/end delimiters, like { and } in C.
This should work AFAIK :

<word format="keyword" parenthesis="be_block:open" indent="1" fold="1">begin</word>
<word format="keyword" parenthesis="be_block:close" indent="1" fold="1">end</word>



A couple of related but somewhat pedantic questions. There seem to be some gremlins exposed by having begin and end markers on the same line. Try running the example editor, eg

example/example

And enter this:


if (1) {;} else {


}
if {


}

then collapse the fold starting on the if. For me this produces a corrupt screen showing three if lines. I appreciate that is an ugly example, and I wont be at all surprised if you choose to ignore it.

I'll look into it. I can't ignore such a bug if I want the syntax engine to trully be generic...



This one is a more reasonable code style.


if (1) {


} else {


}

Here if you fold up the if statement it folds the complete program. I am not sure this is correct. I was expecting the else branch to remain expanded.
This is correct... As I can place more than one collapse/fold marker per line I decided to fold "whole" blocks... I can try to change that behavior (and possibly make it configurable) but I'm not sure it would be worth the effort. (correct me if I'm wrong).

fullmetalcoder
24th November 2007, 16:42
I've corrected all the reported issues so far (or so I believe...)and taken the opportunity to improve the example app a bit.

I'm waiting for your feedback :)

Usability
26th November 2007, 14:19
I've corrected all the reported issues so far (or so I believe...)and taken the opportunity to improve the example app a bit.

I'm waiting for your feedback :)

Thank you, everything looks good.

Folding works as you say, thanks for the begin/end advice that fixes my problem here.
I see find in selection working, and from cursor now the default.
The crash on reload fixed.

So back to no known defects :) Cool.

Usability
26th November 2007, 15:07
Hi Fullmetalcoder.

I gave a program containing this editor to a college for comments, and got this feedback.

I'm really getting used to using this editor and growing more fond of it as the days go by, but there are a couple of minor suggestions/irritations:

1) When scrolling up when the cursor moves up from the top line of the screen it causes an extra line to appear - when scrolling down and the cursor hits the bottom of the screen the next down causes the next page to appear and the cursor is now at the top of this screen. This is extremely irritating!

2) When using find - what does the green button to the left of the string entry box do? When I click it it appears to do nothing.

3) There is a tooltip on the close button for the find toolbar, but not on the "green" button or the find forward/reverse buttons

4) When using the find forward button and then use the find reverse the first hit does not move onto the next match (the line number stays the same, but the column numbers change). The same is true when doing the reverse.

5) If you do a forward find and then move the cursor to a line above the found string, then hit find forward again it goes to the next match (I would expect that because the line with the cursor is highlighted that the previous match would be highlighted again)

Usability
26th November 2007, 15:38
Just noticed, prompted find/replace is broken. For example,
example/example lib/qcodeedit.cpp

Key ctrl-r, try and replace this with that. The settings I had were, match case, prompt on replace, from cursor.
I get a box asking "Shall it be replaced?" Clicking yes has no effect (other than to close the QMessageBox).

Usability
26th November 2007, 15:40
Following up my own post because I noticed the replacement IS made if you answer "No" to the "Shall it be replaced?" question....

Usability
27th November 2007, 20:41
I find scrolling the editor sometimes makes it lock up when using proportional fonts.

Here is a way that reproduces the problem every time on my machine at least.

Change the example to use a proportional font by adding after line 47 of example/window.cpp this line
m_editControl->editor()->document()->setFont(font());
rebuild the example, then do this

example/example lib/qeditor.cpp

Scroll to the bottom by holding down the page down key. When you get to the bottom, scroll back to the top holding down page up. When the editor returns to the top, it should have locked up.

fullmetalcoder
28th November 2007, 16:22
I gave a program containing this editor to a college for comments, and got this feedback.
Neat! :)


I'm not sure I understand this... Could you provide me with a screencast or a precise key sequence leading to this bug
It is supposed to "refresh" the search context (see the QDocumentSearch class) but I guess I could remove it and use a couple signals/slots to make sure it (the search context remains up to date)
There should be a tooltip on *all* buttons since the last commit
I'm aware of that and I'll work on a proper fix ASAP
This is a case where the "green button" should prove useful (but a proper signal/slot connection would probably be better... ;))
About the wrong replacement behavior it will be pretty easy to fix (qdocumentsearch.cpp there is only one call to QMessageBox)
I'll try to reproduce this (and fix it hopefully) ASAP

Usability
28th November 2007, 16:52
To clarify point 1. Try using the up/down cursor keys to move the cursor up and down the screen. When you use the down cursor to move to the next line, and you are already on the last line displayed, the editor jumps a complete screen full down the file.

This is different behaviour than we see with the up cursor. If you move up when you are at the top line displayed, the editor scrolls the viewport up one line to keep the line containing the cursor at the top of the screen.

We prefer the behaviour of the editor when the text cursor is moved up through the file, and hope you agree and will standardise on that. Certainly up and down should scroll in a consistant way.

allstar
28th November 2007, 18:35
Hi,
I got problems with variable width fonts - especially "Times New Roman" (I know you dont like Windows (and probably Windows Fonts), so do I, but it would be nice to be portable as much as possible).

Bug: When I set font to Times New Roman, black vertical lines are appearing between lines.

(Using svn 379)

elcuco
29th November 2007, 15:37
.. lets hijack this thread to announce a pet project of mine...

I have been working outside of QDevelop to develop another code editor control. It's not as sofisticated as the one beeing discussed here, but it has it's own ideas and strong points. If you still want to see, please visit: http://code.google.com/p/qtedit4/wiki/QsvEditorBeta

fullmetalcoder
29th November 2007, 17:49
I got problems with variable width fonts - especially "Times New Roman" (I know you dont like Windows (and probably Windows Fonts), so do I, but it would be nice to be portable as much as possible).

Bug: When I set font to Times New Roman, black vertical lines are appearing between lines.

(Using svn 379)
Unfortunately I can't test under windows so it's hard for me to find proper fixes for such graphical glitches... May you send me the font file so that I can at least try with the most problematic font? BTW does the font size affect the glitches? Try changing font size using CTRL+wheel...


.. lets hijack this thread to announce a pet project of mine...

I have been working outside of QDevelop to develop another code editor control. It's not as sofisticated as the one beeing discussed here, but it has it's own ideas and strong points. If you still want to see, please visit: http://code.google.com/p/qtedit4/wiki/QsvEditorBeta
Rather unkind of you but as the screenshot looks pretty enough and there are a couple of good ideas exposed on the homepage so I may forgive you ;).
Among the important differences that you forgot to mention : the document model used is still QTextDocument (unless you changed your mind recently) hence poor performances and the source are vast and complicated to walk through while they do not offer that much more compared to QCodeEdit or QScintilla...

allstar
29th November 2007, 19:48
Ok, I am sending a video of the bug when using Ctrl+Wheel resizing.....
It is not only Times New Roman also Arial. Some fonts are doing big mess. Others are OK.
Bug.avi (http://www.volny.cz/all.stars/dw/bug.avi)
font.zip (http://www.volny.cz/all.stars/dw/font.zip)
(I am not sure if the format used in linux fonts is the same.)

fullmetalcoder
2nd December 2007, 18:00
Fixed inconsitency of cursor moves when cursor left the displayed area
Fixed most (if not all) display glitches caused by variable width fonts
Fixed replacement prompt to work as expected
Fixed "double find" when searching forward and then backward (or the contrary)
Added "auto refresh" of search context : changing the position of the cursor while the panel is visible will now affect the start point of the next search.
Improved the speed of pageUp/pageDown by a factor 5 approximately by rewriting the related subroutines (may have fixed some bugs found when using these commands...)
That's all for now (until you report more bugs ;))

allstar
4th December 2007, 18:35
The new version is much better. QCodeEdit is amazing.

Unfortunately I found another bug: If you select some text and drag it, but NOT moving the mouse cursor from the selection, the text get copied right behind the selected text, when you release the mouse button. AFAIK this is not "normal" behaviour. The text shouldnt get coped when the mouse cursor is i still under the selected text.

fullmetalcoder
6th December 2007, 11:45
AFAIK this is not "normal" behaviour. The text shouldnt get coped when the mouse cursor is i still under the selected text.
True enough. I'll fix this ASAP (this week end actually)

Methedrine
8th December 2007, 18:43
Current SVN version of QCodeEdit2 will not compile with MSVC 2005. MSVC 2005 does not support the following kind of construct in DLLs:


static int a,b;

Instead, you have to write it this way:


static int a;
static int b;


Only qdocument_p.h is affected by this, though.

Also, a little question: Would it be possible to use QCodeEdit with a custom parser and not the one it is shipped with?

fullmetalcoder
8th December 2007, 20:01
AFAIK this is not "normal" behaviour. The text shouldnt get coped when the mouse cursor is i still under the selected text.
Fixed.


Current SVN version of QCodeEdit2 will not compile with MSVC 2005.
[/code]Only qdocument_p.h is affected by this, though.
Fixed. (I've not tested but applied the suggested patch which I hope will be enough...)


Also, a little question: Would it be possible to use QCodeEdit with a custom parser and not the one it is shipped with?
What do you mean? That you'd like to use your own syntax engine? Or simply add a hard-coded one? The later is really easy to do but the former is a bit trickier but still doable...

Methedrine
8th December 2007, 20:10
Fixed. (I've not tested but applied the suggested patch which I hope will be enough...)


I just checked - you missed line 331 in qdocument_p.h :-)

Also, I just spotted a problem when compiling on mac:



/Users/dominik/Documents/code/edyuk/3rdparty/qcodeedit2/lib/qeditor.cpp: In member function ‘virtual void QEditor::mousePressEvent(QMouseEvent*)’:
/Users/dominik/Documents/code/edyuk/3rdparty/qcodeedit2/lib/qeditor.cpp:1262: error: no match for ‘operator=’ in ‘((QEditor*)this)->QEditor::m_doubleClick = ((QEditor*)this)->QEditor::cursor’
/Users/dominik/Documents/code/edyuk/3rdparty/qcodeedit2/lib/document/qdocumentcursor.h:79: note: candidates are: QDocumentCursor& QDocumentCursor::operator=(const QDocumentCursor&)
/Users/dominik/Documents/code/edyuk/3rdparty/qcodeedit2/lib/qeditor.cpp: In member function ‘virtual bool QEditor::moveKeyEvent(QDocumentCursor&, QKeyEvent*, bool*)’:




What do you mean? That you'd like to use your own syntax engine? Or simply add a hard-coded one? The later is really easy to do but the former is a bit trickier but still doable...

I mean using a custom syntax engine. Already noticed that it would not be easily doable :-)

fullmetalcoder
8th December 2007, 20:20
I just checked - you missed line 331 in qdocument_p.h :-)

Also, I just spotted a problem when compiling on mac.

qeditor.cpp:1262 - you are using an undefined variable there.
Fixed both.


I mean using a custom syntax engine. Already noticed that it would not be easily doable :-)
Why don't you want to use the default syntax engine? Wouldn't it be simpler and better to extend it rather than creating another one from scratch ?
What exactly do you expect it to do and how much would its internal structure differ from the one of the default syntax engine?Answers to these would probably help me to change the syntax engine interface to make room for more than one without changing the existing one...

Methedrine
8th December 2007, 20:37
Fixed both.
Thanks again :-)

Fixed both.
Why don't you want to use the default syntax engine? Wouldn't it be simpler and better to extend it rather than creating another one from scratch ?
What exactly do you expect it do do and how much would its internal structure differ from the one of the default syntax engine?Answers to these would probably help me to change the syntax engine interface to make room for more than one without changing the existing one...

We already wrote one from scratch before you came around with this great edit control. It works like a charm, so far (thread-safe, DFA based, result caching). Qtcentre-member kaos can tell you more about it since, he wrote our parser.
I am also certain that he can give you a better answer to your second question.

allstar
9th December 2007, 09:33
New bug: Hold Ctrl and select a few lines of text with mouse.

fullmetalcoder
9th December 2007, 09:41
We already wrote one from scratch before you came around with this great edit control. It works like a charm, so far (thread-safe, DFA based, result caching). Qtcentre-member kaos can tell you more about it since, he wrote our parser.
I am also certain that he can give you a better answer to your second question.
I was thinking about turning my current engine into a DFA based one so if you have one working already it could save me that pain. :) What format do you use for language definitions? What data do you store for each line of highlighted text and how? And may I have a look at your code?


New bug: Hold Ctrl and select a few lines of text with mouse.
It's not a bug, it's a feature... ;) If you read the previous posts you'll notice we talked about "cursor mirrors" "column edit" and "column selection"...

kaos
9th December 2007, 15:33
I was thinking about turning my current engine into a DFA based one so if you have one working already it could save me that pain. :) What format do you use for language definitions? What data do you store for each line of highlighted text and how? And may I have a look at your code?


We currently use some plain text format. Creating a parser which reads xml instead of text would be quite easy. But i personally don't like xml definitions for these kind of things (escaping of <>&, simple key: values are easier to read for these kind of things).

The lexer itself only emits a list of tokens for the parsed text. The executor currently works quite much line based (and stores tokens line as well). When text gets changed in the edit control the lexer thread is notified of that change and reparses the changed line. When it reaches the end of the line it looks into a cache to see if the state at the end of line matches the state at the end of the line before the change occured. If that is the case it only reparses the changed line (works quite well, i haven't seen it parse anything more then needed yet). I saw some caching in your code as well, but that seemed to be context and not line based. In general i think one could map your xml definition to that lexer with some changes. One problem could be mapping your context to my groups.

I really like the approach of parsing the entire thing in a separate thread. This way typing always stays responsive.
So one requirement would be that the text retrieval methods should be reentrant. And replacing the highlighter would beed to be possible of course. The only thing required is a callback when text has changed i think.

Drop me a pm and i can hook you up with the source. It will be released eventually anyways, it's just not in a state where we think that we should release it.

fullmetalcoder
9th December 2007, 16:17
We currently use some plain text format. Creating a parser which reads xml instead of text would be quite easy. But i personally don't like xml definitions for these kind of things (escaping of <>&, simple key: values are easier to read for these kind of things).
XML does induce some nasty escaping and a more complex parsing (even though this may not remain always true if you use QXmlStreamReader) but on the other hand it allows an easy and extremely powerful hierarchization and plain text can not compete with XML in that area...


The lexer itself only emits a list of tokens for the parsed text.
How do you map a token with a given text format? Is that handled within the lexer which sneds the info along the token?


I saw some caching in your code as well, but that seemed to be context and not line based. In general i think one could map your xml definition to that lexer with some changes. One problem could be mapping your context to my groups.
the "caching" is line based but instead of using an additional state variable I just check the context stack. Could you define what a "group" is in your syntax engine?


I really like the approach of parsing the entire thing in a separate thread. This way typing always stays responsive.
Even with big files (about 1meg of C++ code) QCodeEdit remains responsive, unless you're nasty enough to place a multiline comment at the begining of such a big file and switch between commented and uncommented... But even this manipulation doesn't alter the responsiveness on "normal" files ( ~3-4k lines)

Some people thing that threads make things faster but they actually make them way slower... The only advantage is responsiveness but what if responsiveness can be preserved without threading? The first version of Edyuk completion engine was threaded and it was SLOW (a couple of secs to display results). As soon as I dropped threading and replaced QListWidget by a QListView with a custom model it fell to a couple of msecs!!! It made me think a little more about threading and now I only use it when the speed loss is irrelevant in front of the responsiveness... In the case of highlighting I don't think threading is such a good idea but maybe some benchmarks could prove me wrong...

elcuco
9th December 2007, 16:59
Can you demostrate in a small demo your claim? Yes, using another thread has it's overhead, but it should not be of another magnitude.

Another thing I wanted to ask, is what happens when you paint the document in a separate thread, and meanwhile a user modifies the document. But I think it's not a valid question anymore.

fullmetalcoder
9th December 2007, 17:15
Can you demostrate in a small demo your claim? Yes, using another thread has it's overhead, but it should not be of another magnitude.
If you fetch Edyuk 0.8.x or 0.7.x( I don't remember when actually I made the change...) you'll see a pretty slow completion and you can compare with what happens now


Another thing I wanted to ask, is what happens when you paint the document in a separate thread, and meanwhile a user modifies the document. But I think it's not a valid question anymore.
I don't know to whom you ask that question but I'd say it's never been a valid question at all... kaos and methredine clearly pointed out that their engine is thread safe and rely on signals/slots to request painting updates and QCodeEdit never relied on threading... Besides your question is a bit unclear as "painting" is impossible from a thread... The most you can do is updating formatting informations (in a thread safe way or it'll segfault).

kaos
9th December 2007, 17:33
XML does induce some nasty escaping and a more complex parsing (even though this may not remain always true if you use QXmlStreamReader) but on the other hand it allows an easy and extremely powerful hierarchization and plain text can not compete with XML in that area...

Yes, i am a big fan of xml. But i found a custom format in that case much more managable.



How do you map a token with a given text format? Is that handled within the lexer which sneds the info along the token?


Each token gets a unique id when the lexer file gets parsed. With this unique id several infos about the token are saved (the name, the language, etc)



the "caching" is line based but instead of using an additional state variable I just check the context stack. Could you define what a "group" is in your syntax engine?


as far as i can see it's quite much the same as your context. it defines a certain "block" with a start and an end and additional rules for the text in the group.



Even with big files (about 1meg of C++ code) QCodeEdit remains responsive, unless you're nasty enough to place a multiline comment at the begining of such a big file and switch between commented and uncommented... But even this manipulation doesn't alter the responsiveness on "normal" files ( ~3-4k lines)


That's the part where the multithreaded model excels quite much. One other reason for me to go the threaded part were the emerging multithreaded/multicode cpus



Some people thing that threads make things faster but they actually make them way slower... The only advantage is responsiveness but what if responsiveness can be preserved without threading? The first version of Edyuk completion engine was threaded and it was SLOW (a couple of secs to display results). As soon as I dropped threading and replaced QListWidget by a QListView with a custom model it fell to a couple of msecs!!! It made me think a little more about threading and now I only use it when the speed loss is irrelevant in front of the responsiveness... In the case of highlighting I don't think threading is such a good idea but maybe some benchmarks could prove me wrong...


Well, making things threaded is of course more complicated then easy to get right. The lexer definitly doesn't need to be multi threaded, but i since the solution works really well, i saw no reason in changing that. I would not do the completer multithreaded tho, since the user usually expecting a response when he triggers auto completion. But for me personally any delay when typing is just not acceptable in an editor. And I didn't see any problem with lexing the stuff in an extra thread. I've ran my code on an p3 450 and it still worked rather smooth. I haven't benchmarked that entire thing tho, but iirc most of the time the lexer thread already was done with the line before the control went redrawing itself (on a single core/thread cpu)

kaos
9th December 2007, 17:36
Can you demostrate in a small demo your claim? Yes, using another thread has it's overhead, but it should not be of another magnitude.

Another thing I wanted to ask, is what happens when you paint the document in a separate thread, and meanwhile a user modifies the document. But I think it's not a valid question anymore.

The drawing and the user input usually happen in the same thread. But it still is a valid question since one worker thread could possibly modify the text while drawing. So if you make such a control to the thread safe all the text modification methods need to be properly protected against with a mutex, etc

fullmetalcoder
9th December 2007, 17:41
Each token gets a unique id when the lexer file gets parsed. With this unique id several infos about the token are saved (the name, the language, etc)
But then how do you handle parsing numbers for instance? It must be done with a more complex DFA than a keyword and allow for many more than one single token... I guess you meant that the id is associated with the DFA matching state or am I missing something?

kaos
9th December 2007, 17:53
But then how do you handle parsing numbers for instance? It must be done with a more complex DFA than a keyword and allow for many more than one single token... I guess you meant that the id is associated with the DFA matching state or am I missing something?

Ah, yeah.
Well, all the tokens get compiled into one big automaton per group where the final state carries information which token id to emit when the match completes at that final state.

Usability
12th December 2007, 20:53
I just noticed the license syntax selection is fooled by dots in the file name.
For example

example/example lib/qpanellayout.cpp

produces a correctly colourcoded file, while

cp lib/qpanellayout.cpp a.1.cpp
example/example a.1.cpp

Shows no colourcoding at all. I think the extension is the text after the final dot in a file name.

fullmetalcoder
14th December 2007, 13:03
I just noticed the license syntax selection is fooled by dots in the file name.
For example

example/example lib/qpanellayout.cpp

produces a correctly colourcoded file, while

cp lib/qpanellayout.cpp a.1.cpp
example/example a.1.cpp

Shows no colourcoding at all. I think the extension is the text after the final dot in a file name.
The issue must come from a use of QFileInfo::completeSuffix()... I'll correct it ASAP.

Usability
18th December 2007, 11:02
How do you feel about making ctrl-f always take you to the find box?
Currently you have to first check if the find box is open, because if it is, you need to key two ctrl-f to get there. (The first one just closes the box, the second opens it again and takes you in).

I think it would be much easier this way. Conventionally you use escape to leave a dialog, not a repeat of the key that opened it.

fullmetalcoder
19th December 2007, 16:03
How do you feel about making ctrl-f always take you to the find box?
I'll have that sorted out ASAP.

BTW, the suffix issue has been fixed in case you didn't notice. :)

travlr
26th December 2007, 15:30
Hi fmc,
A couple of issues/observations for edyuk.
First, I don't understand... Is not the trunk in SVN repo not the most recent code??? Huh? This quite unorthodox, isn't it. I've never seen this before. Quote from the website:
...and, as many people dislike (or don't even know) SVN, I ended up releasing a new package to avoid confusions with the very old one left on Sourceforg donwloads servers...

You can get it in the downloads section and enjoy all the improvements. :D
The ./build script reports a syntax error
oxbo% ./build -h
./build: 60: Syntax error: Bad substitution
Using qt-4.4, a Make error regarding QAtomic and QBasicAtomic (4.4 has QAtomicInt and QAtomicPointer, Before 4.4 there is no "QAtomic*" at all according to the class refs)
In file included from ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/qeditor.cpp:19:
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:32:19: error: QAtomic: No such file or directory
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:215: error: ‘QBasicAtomic’ does not name a type
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h: In member function ‘void QDocumentCursorHandle::ref()’:
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:202: error: ‘m_ref’ was not declared in this scope
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h: In member function ‘void QDocumentCursorHandle::deref()’:
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:203: error: ‘m_ref’ was not declared in this scope
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:203: error: ‘m_ref’ was not declared in this scope
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/qeditor.cpp: In member function ‘virtual bool QEditor::moveKeyEvent(QDocumentCursor&, QKeyEvent*, bool*)’:
../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/qeditor.cpp:1973: warning: unused variable ‘prevcol’
make[2]: *** [.build/4.4.0-tp1-unix/obj/release/qeditor.o] Error 1
make[2]: Leaving directory `/d/bld/edyuk/src/lib'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/d/bld/edyuk/src/lib'
make: *** [sub-src-lib-lib-pro-make_default] Error 2
makeobj[0]: Leaving directory `/d/bld/edyuk'
This was just a first look, before investigating reasons or fixes.

Thank you,
-travlr

Usability
28th December 2007, 14:27
Double click in the editor got broken recently. With a slightly older QCodeEdit, double clicking selects a word. In the latest svn, double click does nothing.

fullmetalcoder
29th December 2007, 16:14
@travlr :

There must be a misunderstanding somehow... SVN repo always hold the most recent code AND from time to time I package the content of the repo and put in on Sf.net dowload servers so that more people can play with it (as some are reluctant to use SVN...)
Would you be running under BSD? Or some exotic UNIX system? I must admit I'm not an expert of clean shell scripting and I'd be able if someone could help me to improve the portability of the build script...
Do you know what I need to do in order to make it compatible with Qt 4.4 then? Looks like it's just a matter of include files. Or did the QBasicAtomic class disappear completely in the utter nothingness?
Some of your comments concern Edyuk ad not QCodeEdit so it may be better to post in the appropriate thread (http://www.qtcentre.org/forum/f-qt-software-16/t-edyuk-fully-featured-highly-flexible-and-free-cross-platform-ide-page7-5025.html).
@Usability : I fixed the double click regression.

Usability
30th December 2007, 10:31
Double click working again, thanks!

fullmetalcoder
3rd January 2008, 16:40
How do you feel about making ctrl-f always take you to the find box?
Done. :)

A couple other changes have happened lately. Among which the addition of a line change panel which indicates the modified lines since last save.

fullmetalcoder
4th January 2008, 15:52
A couple more good news :

caduel has just fixed the code to work with Qt 4.4 (well actually it broke Qt 4.3 backward compat but I fixed that by now so everything is fine regarding this issue
I achieved very significant speed improvements when editing veryl arge files (especially near the end where it used to lag...)
Fixed cursor auto update mechanism in combination with cursor mirrors (typing enter when using cursor mirrors used to wreck cursor positions in a somewhat weird way.)

elcuco
4th January 2008, 15:58
What was the problem with Qt 4.4? it should compile perfectly, since 4.4 is source compatible with 4.3.

fullmetalcoder
4th January 2008, 17:42
What was the problem with Qt 4.4? it should compile perfectly, since 4.4 is source compatible with 4.3.
It's described in a previous post... Contrary to what one could expect there's been some, at least one, API changes which happened in the QBasicAtomic class (got hidden since the introduction of QAtomicInt AFAIK). This class is a low level atomic counter used in reference counting (in both text lines and cursors).

jpn
4th January 2008, 18:02
They weren't part of the public API, were they?

elcuco
4th January 2008, 18:16
It's described in a previous post... Contrary to what one could expect there's been some, at least one, API changes which happened in the QBasicAtomic class (got hidden since the introduction of QAtomicInt AFAIK). This class is a low level atomic counter used in reference counting (in both text lines and cursors).
BTW, I am getting compilation problems on 4.3. What version do you support ...? 4.4? 4.3?

fullmetalcoder
4th January 2008, 19:44
BTW, I am getting compilation problems on 4.3. What version do you support ...? 4.4? 4.3?
I'd like to support both but I can't test Qt 4.4
As for your compile troubles could provide me the following informations :
OS
Qt version
compiler
QCodeEdit version (i.e package or SVN rev)
full compile log (do a make distclean first if you are using a SVN copy)
They weren't part of the public API, were they?The QAtomic and QBasicAtomic class are not documented but they are accessible (i.e. not located somewhere in "private" headers) and as they are widely used throughout Qt and the only way to achieve atomic ref counting I assumed they would not be a source of troubles and used them...

NoobSaibot
12th January 2008, 06:59
i hope the development of QCodeEdit continues, as i have a few reports/requests ;)

Issues
==========================
- while scrolling the linenumber column changes width while scrolling (becomes wider) as the digit of current visible line grows down the file. this "dynamic" grow is quite unusual. why don't you make the width of the linenumber column "static" and change the width only if the row count changes ( e. g. from 99 to 100 or from 999 to 1000 )?

- column selection: i see that i can select columns wise. what i don't see is the actual selection.

Features
===========================
for convenience sake i declare here an entity: ( current line/lines of current selection ) = current content

- make it possible to delete current content along with the corresponding lines. ( e. g. CTRL + D in Eclipse )
- make it possible to move current content inside the editor. ( e. g. ALT + UP, ALT + DOWN )
- make it possible to duplicate current content inside the editor. ( e. g. CTRL + ALT + UP, CTRL + ALT + DOWN )
- tab ( or user defined key ) triggered snippets. ( e. g. textmate )

that's all for now :) great work so far

fullmetalcoder
12th January 2008, 11:42
i hope the development of QCodeEdit continues, as i have a few reports/requests ;)
It does, even though it's slower than it used to because I haven't got much spare time lately... Comments and requests are welcome anyway :)


the variable width of line number panel is quite nice IMO when you have some files with more than 1k lines since it avoid space waste when you are at the beginning but making it "static" won't be complicated hopefully
I don't understand this one I'm afraid...
If I understand well the content is ALWAYS a set of LINES right? Then adding a couple of actions won't be difficult
code snippets are not planned ATM. IMO such a functionnality should be handled by the application, not QCodeEdit

NoobSaibot
12th January 2008, 13:14
code snippets are not planned ATM. IMO such a functionnality should be handled by the application, not QCodeEdit

Nooo, just imagine. One xml configuration file for the whole language. folding, syntax, indentation, snippets, ... everything in one config file.

as the snippets should be context aware either, the only appropriate place for them should be in the qnfa file. so the same snippet ( say "main" ) could be defined for several languages/context.

i suggest you take a closer look at textmate (http://macromates.com/). which is unfortunatelly Mac only. the bundle system is great.

fullmetalcoder
12th January 2008, 14:33
Nooo, just imagine. One xml configuration file for the whole language. folding, syntax, indentation, snippets, ... everything in one config file.
That would be cool but unfortunately I have no time to invest in snippet support ATM... If someone is interested in creating a snippet engine that could be plugged in QCodeEdit I'd be happy to help by answering all questions but I can't do anything more...

NoobSaibot
13th January 2008, 09:46
is it possible to

- define the indentation width ( 2, 4, 8 ) in the xml config?
- find out which syntax is used at the moment ( C++, PHP, ... )?
- find out in which context the cursor is at the moment?

fullmetalcoder
13th January 2008, 11:17
Well, currently the indentation is shared by all documents (this may change in the future though) which make it impossible to add such a feature to language syntax files...

As for the used syntax it won't be difficult, just depends on where you need to get that information. The context is currently a bit trickier but I'll be working on this soon.

NoobSaibot
13th January 2008, 11:30
i'd like to show the current syntax used in the status panel

NoobSaibot
14th January 2008, 09:40
for some reason the first -- and empty -- line is always selected when i start the example.

btw. do you have a issue tracker?

fullmetalcoder
14th January 2008, 20:02
btw. do you have a issue tracker?
As QCodeEdit is developed as part of Edyuk you should use Edyuk issue tracker on Sf.net or the WebIssues (http://webissues.mimec.org)server (http://edyuk.org/webissues/ login : anonymous, pwd : anonymous)

NoobSaibot
15th January 2008, 19:46
some minor bug in the column selection:

- start column selection in the first column down to the last line of the file
- now hold shift and try to select the text to the right with the arrow key

the result is that all but the last cursor mirrors do what they should. the last -- down most -- cursor mirror does not move along with the others.

NoobSaibot
17th January 2008, 20:52
well, you gonna hate me aswell :p , however,

is it possible to enter column selection mode without the mouse?

fullmetalcoder
18th January 2008, 20:32
some minor bug in the column selection:

- start column selection in the first column down to the last line of the file
- now hold shift and try to select the text to the right with the arrow key

the result is that all but the last cursor mirrors do what they should. the last -- down most -- cursor mirror does not move along with the others.
I'm afraid I haven't been able to reproduce this one.Check that you are using last rev. Try rebuilding QCodeEdit (make clean) and send me the files with which it happens in case the problem remains.


is it possible to enter column selection mode without the mouse?
It wasn't but it now is. :) The new binding is : CTRL + ALT + up/down to add a new mirror above the first/under the last cursor mirror.

NoobSaibot
18th January 2008, 21:04
thanks a bunch! i'll recompile and attach the files to the bug report. if you care, i modified qdocument.cpp a little bit, as i find this folding rect ugly as hell :) (i borrowed some images from textmate)

/edit: well actually there's nothing to attach to the bug report, as it happens right on the start; there's no file loaded at all. hmmm, might be my system configuration.

fullmetalcoder
19th January 2008, 08:56
if you care, i modified qdocument.cpp a little bit, as i find this folding rect ugly as hell :) (i borrowed some images from textmate)
:confused: AFAIK, and I should know quite welll ;), the drawing of folding rects isn't done in qdocument.cpp but in qfoldpanel.cpp
Anyway, I think I should add a way to change the look of fold indicators.


/edit: well actually there's nothing to attach to the bug report, as it happens right on the start; there's no file loaded at all. hmmm, might be my system configuration.
This is only a small drawing bug which appears on empty lines in some case. Well, appeared actually for I just fixed it. :)

NoobSaibot
19th January 2008, 10:32
:confused: AFAIK, and I should know quite welll ;), the drawing of folding rects isn't done in qdocument.cpp but in qfoldpanel.cpp
Anyway, I think I should add a way to change the look of fold indicators.


nahh, i mean the dotted rectangle in the text document which appears when you activate the folding. and yes, the +/- rectangles are drawn in the foldpanel -- i wrote my own fold panel ( which is actually a copy of your qfoldpanel with minor modifications :p ).

thanks for fixing!! continue the great work.

if you could provide me the information where i get the current syntax used. i don't seem to be able to figure that one out :o

fullmetalcoder
19th January 2008, 10:57
nahh, i mean the dotted rectangle in the text document which appears when you activate the folding.
OK. Did you replace it with something nicer or just removed it?


and yes, the +/- rectangles are drawn in the foldpanel -- i wrote my own fold panel ( which is actually a copy of your qfoldpanel with minor modifications :p ).
Are you using images or hardcoded drawing code? Maybe we could make this configurable and keep a single fold panel class...


if you could provide me the information where i get the current syntax used. i don't seem to be able to figure that one out :o
The current design makes this a bit tricky... I got plans to improve this but I'd like to make this version as stable as possible before making API changes... Anyway you should be able to get this information using something like :

editor->highlighter()->definition()->language();where "editor" is a QEditor*
This will give you the language used as a QString as it appears in the qnfa file.
note : you'd better check for the existence of an highlighter before proceeding, unless you forced one to be set on all your editors...

NoobSaibot
19th January 2008, 11:06
OK. Did you replace it with something nicer or just removed it?
:confused: you didn't see the attached images i posted? i replaced the dotted lines with an image, which is placed right after the last nonspace character.

it'd be wonderful if there'd be a way to define own theme! it ain't that urgent though ;) snippets are my #1 feature request. did you take a look at textmate manual/screencasts?

/edit: wonderful, now i know which highlighter is used :)

NoobSaibot
19th January 2008, 11:30
if you consider to make qcodeedit themable, consider the following:

for constructions like imbedded php/ruby/java in html it should be possible to define the background color for such areas. thus -- generally speaking -- something like that should be possible:
<background ... image="" color="" id="text.html code.java" />

might be hard to implement :rolleyes: , but as you love challenges there you go! :)

fullmetalcoder
19th January 2008, 12:17
:confused: you didn't see the attached images i posted? i replaced the dotted lines with an image, which is placed right after the last nonspace character.
:o I didn't pay attention to this... The first time I viewed your attachement I only noticed the new icons in the panel.


snippets are my #1 feature request. did you take a look at textmate manual/screencasts?
I gave it a quick look but din't started writing anything... As I said already I have very little time and I'm currently focusing on bugfixing/polishing to make this version stable. As soon as I'll reach this state and have more spare time I'll start playing around with new stuff, including snippets, but this day has not come yet...


/edit: wonderful, now i know which highlighter is used :)
Good. Just curious : what do you do with this information? You display some additional text in a status panel or something like that?


for constructions like imbedded php/ruby/java in html it should be possible to define the background color for such areas. thus -- generally speaking -- something like that should be possible:
<background ... image="" color="" id="text.html code.java" />

might be hard to implement :rolleyes: , but as you love challenges there you go
The use of a background color isn't difficult in itself... The only challenge is in finding the right paradigm to make this configurable... I'll think about it.

NoobSaibot
19th January 2008, 13:23
Good. Just curious : what do you do with this information? You display some additional text in a status panel or something like that?

i plan to have a dropdown in status panel, where i/the user can switch between the languages.



The use of a background color isn't difficult in itself... The only challenge is in finding the right paradigm to make this configurable... I'll think about it.

well, again. textmate is *the* reference. take a language bundle ( c/c++ for instance ) and look at the files and the structure used there.

fullmetalcoder
19th January 2008, 15:37
well, again. textmate is *the* reference. take a language bundle ( c/c++ for instance ) and look at the files and the structure used there.
Well, I was considering the internal design, not user-configuration side...

NoobSaibot
20th January 2008, 09:15
in order to provide the information about the current highlighter, i added a signal to QEditor::setHighlighter(), highlighterChanged(). consider to make that change in your trunk.

you fixed missing lines? :thumbs up: i encountered some file corruptions as i was using edyuk. some lines got swollowed. is that what you've fixed?

fullmetalcoder
20th January 2008, 13:26
in order to provide the information about the current highlighter, i added a signal to QEditor::setHighlighter(), highlighterChanged(). consider to make that change in your trunk.
I'll see to this. Does your signal have some parameters?


you fixed missing lines? :thumbs up: i encountered some file corruptions as i was using edyuk. some lines got swollowed. is that what you've fixed?
Yes. It appears that the fix for Qt 4.4 compat (atomic counters API changes) ended up removing some crucial init code by error which caused random line deletion during document loading... Hopefully I've been able to fix it straight after Usability reported it.

NoobSaibot
20th January 2008, 15:07
I'll see to this. Does your signal have some parameters?
At the moment it doesn't have any parameters. As i rely fully on the language() String -- which is not my preferable approach. i'd rather rely on some uid or something; which would be the parameter of this signal.


Yes. It appears that the fix for Qt 4.4 compat (atomic counters API changes) ended up removing some crucial init code by error which caused random line deletion during document loading... Hopefully I've been able to fix it straight after Usability reported it.
outstanding!

an offtopic question. did you ever try eclipse c++ & mylyn? a very nice combination if you ask me :)

fullmetalcoder
20th January 2008, 15:26
an offtopic question. did you ever try eclipse c++ & mylyn? a very nice combination if you ask me :)
I tried Eclispe monthes ago and found it extremly slow and memory consuming. Besides, at that time it din't have Qt support so I did not spend more than an hour using it... What's mylyn anyway?

NoobSaibot
20th January 2008, 16:20
I tried Eclispe monthes ago and found it extremly slow and memory consuming. Besides, at that time it din't have Qt support so I did not spend more than an hour using it... What's mylyn anyway?

well, i must admit its code completion is nowhere near edyuks speed! and yes, it is a memory monster. however, mylyn is a very nice integration of bugzilla/jira/track into eclipse; which goes actually beyond the pure integration of those.

you better read it for yourself. mylyn (http://en.wikipedia.org/wiki/Mylyn)

just a hint to a possible plugin for edyuk ;)

NoobSaibot
24th January 2008, 20:42
there's no way to get the config file name/path for a certain lanuage (C++, XML, ...) from the QCodeFactory. There should be a possibility to get the language or its config file name/path by index/uid. For example:


QString languageName( int index );
QString languageConfigFile( int index );

or something along the lines.

Usability
6th February 2008, 10:04
I may be being spectacularly dense here, but I cannot see how the example modifies the context menu. Its somehow added controls to turn on/off the various panels (line numbers, fold marks etc) and I cannot see how this happens.

Can anyone tell me where this is done?

Thanks.

fullmetalcoder
6th February 2008, 11:04
Can anyone tell me where this is done?
Well, it's a bit of a trick : did you notice the boolean parameter in the addPanel() method calls used in window.cpp? They inform QCodeEdit to add the proper actions to the context menu. What's nice though is that you can add actions the exact same way through
QEditor::addAction(QAction*, QString, QString)
The two string params indicate menu and toolbar labels which are useful only when you use QCodeEdit in combination with qmdilib. To further tune the context menu you can use the two "standard methods" available with ever widgets : reimplementing the contextMenuEvent() method in a subclass or using the customContextMenuRequested signal (after having the context menu policy set properly...).

Usability
6th February 2008, 13:51
Thanks for the pointer.

I have this working now, and for the record, the first string parameter is necessary, its the menu text. Without it you get no menu.

Usability
7th February 2008, 09:54
Hi FullMetalCoder. I compiled on Windows again using VisualC 6 and got a lot of grief about your favourite coding style.

..\src\qcodeedit2\lib\qlinemarksinfocenter.cpp(508 ) : error C2562: 'cursorMoved' : 'void' function returning a value
..\src\qcodeedit2\lib\qlinemarksinfocenter.h(171) : see declaration of 'cursorMoved'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\VC98\bin\NMAKE.EXE"' : return code '0x2'
Stop.

I changed
508: return cursorMoved(e);

to
508: cursorMoved(e);
509: return;

Then did the same thing to fix all of these:

..\src\qcodeedit2\lib\widgets\qpanel.cpp(224) : error C2562: 'mouseMoveEvent' : 'void' function returning a value
..\src\qcodeedit2\lib\widgets\qpanel.h(67) : see declaration of 'mouseMoveEvent'
..\src\qcodeedit2\lib\widgets\qpanel.cpp(238) : error C2562: 'mousePressEvent' : 'void' function returning a value
..\src\qcodeedit2\lib\widgets\qpanel.h(68) : see declaration of 'mousePressEvent'
..\src\qcodeedit2\lib\widgets\qpanel.cpp(252) : error C2562: 'mouseReleaseEvent' : 'void' function returning a value
..\src\qcodeedit2\lib\widgets\qpanel.h(69) : see declaration of 'mouseReleaseEvent'
qlinenumberpanel.cpp
qlinemarkpanel.cpp
..\src\qcodeedit2\lib\widgets\qlinemarkpanel.cpp(1 65) : error C2562: 'mousePressEvent' : 'void' function returning a va
ue
..\src\qcodeedit2\lib\widgets\qlinemarkpanel.h(47) : see declaration of 'mousePressEvent'
..\src\qcodeedit2\lib\widgets\qlinemarkpanel.cpp(1 75) : error C2562: 'mouseReleaseEvent' : 'void' function returning a
alue
..\src\qcodeedit2\lib\widgets\qlinemarkpanel.h(48) : see declaration of 'mouseReleaseEvent'
..\src\qcodeedit2\lib\widgets\qlinemarkpanel.cpp(1 94) : error C2562: 'mouseReleaseEvent' : 'void' function returning a
alue
..\src\qcodeedit2\lib\widgets\qlinemarkpanel.h(48) : see declaration of 'mouseReleaseEvent'
qlinechangepanel.cpp
qfoldpanel.cpp
..\src\qcodeedit2\lib\widgets\qfoldpanel.cpp(74) : error C2562: 'mousePressEvent' : 'void' function returning a value
..\src\qcodeedit2\lib\widgets\qfoldpanel.h(43) : see declaration of 'mousePressEvent'
..\src\qcodeedit2\lib\widgets\qfoldpanel.cpp(97) : error C2562: 'mousePressEvent' : 'void' function returning a value
..\src\qcodeedit2\lib\widgets\qfoldpanel.h(43) : see declaration of 'mousePressEvent'
qstatuspanel.cpp

fullmetalcoder
7th February 2008, 17:42
Hi FullMetalCoder. I compiled on Windows again using VisualC 6 and got a lot of grief about your favourite coding style.
Jeez... When will it take return types into account before throwing such errors? all those functions where void so the error does not make any sense as far as ANSI C and ISO C++ are concerned (or did I miss something?) but I'll have this fixed by saturday anyway.

NoobSaibot
10th February 2008, 11:14
@fullmetalcoder:

Here's a minimap panel i wrote. it's not perfect yet. but you'll get the general idea. feel free to use and improve it. :)

fullmetalcoder
10th February 2008, 12:20
Here's a minimap panel i wrote. it's not perfect yet. but you'll get the general idea. feel free to use and improve it. :)
Looks great! There are a couple of details I think could be improved but even as it is now it rocks! :)
Here are my suggestions, hoping you won't find them too hard to implement :

try to synchronize the scrolling with the mouse movement (the mouse often goes out of the rectangle and the end of the scroll is a bit trickier...)
allow quick jumps through single (or double, at your option) mouse clicks
make it possible to change the width of the panel, through a splitter or a context menu As a side note I have fixed the MSVC build issues reported by Usability.

NoobSaibot
10th February 2008, 12:26
try to synchronize the scrolling with the mouse movement (the mouse often goes out of the rectangle and the end of the scroll is a bit trickier...)
allow quick jumps through single (or double, at your option) mouse clicks
make it possible to change the width of the panel, through a splitter or a context menu

1. yes, i know. this is one of the points why i said it is not perfect yet.
2. i thought about that either.
3. i didn't make up my mind yet how to do that. i'll tinker with that a bit.

further more, i'd like to have syntax highlightning and a magnifier in the panel. i hoped you'll do the syntax highlightning stuff ;)

btw, how to get the linespacing used in the editor?

fullmetalcoder
10th February 2008, 16:56
3. i didn't make up my mind yet how to do that. i'll tinker with that a bit.
I think the context menu will do. Just add one. A "change width" action would popup an input dialog asking for a width (in pixel most probably) which would be set using setFixedWidth() just like you do in the ctor already.


further more, i'd like to have syntax highlightning and a magnifier in the panel. i hoped you'll do the syntax highlightning stuff ;)


QDocumentLineHandle::draw() will do what you want provided that you fed it with proper parameters. It is part of the private API and thus requires including qdocument_p.h You can find out more about how to use it by reading the code of QDocumentPrivate::draw() in qdocument.cpp
AFAIK all you'd have to do would be to scale and translate the painter properly to achieve the minimap effect with highlighting.


btw, how to get the linespacing used in the editor?

QDocument::fontMetrics() is a static function which returns a QFontMetrics object initialized with the global font currently used. It should give you all the needed document metrics, including line spacing.

NoobSaibot
10th February 2008, 18:41
1. can't use draw function due to uncomplete struct QSmallArray :confused: qdocument_p.h is included!

/edit: nevermind, got it.

do i have to

1. create a new QDocumentLineHandle pointer
2. draw the line
3. call deref() on this pointer?

fullmetalcoder
10th February 2008, 18:46
1. can't use draw function due to uncomplete struct QSmallArray :confused: qdocument_p.h is included!
Proposed fix :
#include <QVarLengthArray>
Actually QSmallArray is just a convenience internal typedef for QVarLengthArray<int, 10>


do i have to

1. create a new QDocumentLineHandle pointer

you can obtain the QDocumentLineHandle pointer through :
QDocumentLine::handle()

NoobSaibot
10th February 2008, 20:40
there you go, version 0.2 :)

- some minor bugs fixed
- mouse synced
- syntax highlightning
- nicer look

/edit: i know there's a bug if the content of the document fits completely into the minimap panel. won't fix it today though.

Usability
12th February 2008, 10:03
I just noticed the code folding + and - buttons no longer work.
I guess this was as a result of my enhancement request to make it easy to select the start of the line... Any chance you could process the fold request, then pass the click to the editor?

Thanks.

NoobSaibot
12th February 2008, 22:13
here it is, the final -- and hopefully bugfree -- version of the minimappanel v0.4

- mouse is now synchronised no matter how big the document height is
- dynamic width of the panel reflects the width of the actual editor window, to show as much text as the actual editor shows.

have fun

fullmetalcoder
13th February 2008, 15:47
I just noticed the code folding + and - buttons no longer work.
I guess this was as a result of my enhancement request to make it easy to select the start of the line... Any chance you could process the fold request, then pass the click to the editor?
I'll sort this out by next week end.

@noobsaibot: sounds cool. I'll have a look at it.:)

fullmetalcoder
15th February 2008, 19:37
I just noticed the code folding + and - buttons no longer work.
I guess this was as a result of my enhancement request to make it easy to select the start of the line... Any chance you could process the fold request, then pass the click to the editor?
Just checked : it works perfectly for me try updating your working copy and/or rebuilding your app... If it still doesn't work please send me some more details and I'll investigate this.

@NoobSaibot: I've just tried out the last version. It wroks fine and look cool. One minor bug left : when some blocks of text are collapsed the "visible" square of the panel is "offsetted" somehow while the text displayed remain the same...

NoobSaibot
17th February 2008, 12:27
try this one

Usability
17th February 2008, 12:50
Just checked : it works perfectly for me try updating your working copy and/or rebuilding your app... If it still doesn't work please send me some more details and I'll investigate this.


It turns out I broke the folding in the fixes I made to get it to compile on MSVC6, which does not allow void functions to return data. I will have to look at this more carefully, perhaps the correct change would have been to change the declaration of the function.

Anyway, false alarm. There is no problem with the folding, sorry to waste your time on that.

fullmetalcoder
1st July 2008, 00:29
Despite the long silence QCodeEdit development has not halted. Actually those of you who tried Edyuk latest releases have seen it at work and probably spotted some of the most noticeable improvements.

Anyway I got two things to announce right now :


QCodeEdit now has a website (http://qcodeedit.edyuk.org) up and running
QCodeEdit 2.1 is available for download (http://sourceforge.net/project/showfiles.php?group_id=168260&package_id=201786&release_id=610464)

Hoping you'll like both.

fullmetalcoder
31st October 2008, 16:04
I'm still working on QCodeEdit and a new version will be available shortly but I'd like some more testing of the latest feature I've added as it was particularly hard to get it working fine and fast without breaking anything :

QCodeEdit now has dynamic line wrapping (it does not honor word boundaries but it works)

Lots of fixes and improvements have been made since last version so you are encouraged to try out the latest SVN version. If no bugs are found a new package will be released soon.

regards

lorebett
11th December 2008, 00:46
Hi

just for information.

I came across this post while trying to solve a problem with QSyntaxHighlight which does not seem to provide access to the current QTextBlock; at the moment, I'm trying to implement source-highlighting in Qt4 (and also Qt3) text editor by relying on GNU Source-highlight (http://www.gnu.org/software/src-highlite/), since I'm turning it also into a library; GNU Source-highlight uses its own syntax for language definition files (I don't like XML), which is powerful enough to deal with possible nested states.

I'll take a look at QCodeEdit since it looks like it provides a better QSyntaxHighlighter.

Do you think using GNU Source-highlight might help your editor too?

fullmetalcoder
11th December 2008, 17:59
Thanks for the information. I gave a look to GNU source highlight. While I agree that XML may not be the most appropriate language for syntax files I don't like the format used by GNU source highlight (both a matter of taste and implementation related considerations).

Theoretically it would be possible to either integrate GNU source highlight into QCE or provide support for these syntax definitions using the existing internals I am not willing to do it myself (though I would welcome any such contribution).

Now some updates about QCodeEdit :


dynamic line wrapping works fine now (apart from bugfixes it means that it DOES break at word boundaries whenever possible and that cursor movement became more intuitive within wrapped blocks of text)
Lots of API has been added after user requests (there five projects that I know of currently using QCodeEdit :))
formatting has been improved
there have been some significant speed improvements in drawing

Future plans include:


encodings support (WIP)
session management API
more configuration options (especially GUI for changing formatting)
and a couple more exciting things (but in a slightly more distant future ;))

lorebett
11th December 2008, 19:02
Thanks for the information. I gave a look to GNU source highlight. While I agree that XML may not be the most appropriate language for syntax files I don't like the format used by GNU source highlight (both a matter of taste and implementation related considerations).

could you expand on this?
any feedback is more than welcome :)

fullmetalcoder
12th December 2008, 16:47
Well, it is not very syntactically consistent (at least it does not look so). Also the syntax looks more script-ish than just descriptive (that is just a matter of taste I suppose). That's about all I can say after quickly reading the C syntax file, hope it helps.

Usability
16th December 2008, 17:07
I just pulled the latest revision of this editor and notice that it now detects external changes to the file, which is great.

Unfortunately its indicating a conflict event even if the file is not changed in qcodeedit2, so there is no conflicting changes.

In my opinion it should silently reload in this scenario, and save the nice conflict resolution queries it does for the occasions where there are unsaved edits.

fullmetalcoder
16th December 2008, 20:57
your remark make a lot of sense. I'll make the needed changes ASAP.

Usability
17th December 2008, 14:13
Another thing I noticed is some odd interaction between the horizontal scroll bars and the status line. If an editor window is opened on a wide file so that the horizontal scroll bar is needed from the moment the window is created, then the status bar is garbled. See the attached image.

If the window is then resized a modest amount the problem remains. If its resized to the point where the scroll bar is no longer needed, the status bar is drawn correctly. If the window is then shrunk again so the scroll bar reappears, this time its inserted correctly. So the problem is only there if the scroll bar is needed as the editor is opened.

The screen shot came from the example editor app invoked like this.

example/example example/window.cpp

If you need further help reproducing this let me know. I am using bulid 770 from
svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2

fullmetalcoder
17th December 2008, 16:29
This is a problem I've been struggling with for quite some time. It appears that some versions off Qt need the position of the widgets placed inside viewport margins to be offsetted when scrollbars are visible and some don't. The issue being that I have not yet managed to determine how each version (and platform?) behave so as to use some macro tricks to get rid of that annoyance.

Usability
17th December 2008, 17:02
More seriously, when I move the horizontal scroll bar with the latest version of qcodeedit2, the application freezes. Have you seen anything like this before?

It doesn't seem to affect the example editor, just my app. However when I switch back to the last bulid of qcodeedit2 I was using the problem goes away.

Usability
17th December 2008, 17:25
Contrary to my earlier post, the example application of the editor does show the scroll lockup. Try this

example/example example/window.cpp
right click in the C code, select goto line, and goto line 10.
Now try and scroll horizontally to the right and side and back again.

Kills it for me every time.

fullmetalcoder
17th December 2008, 19:09
I'm unable to reproduce this issue with SVN HEAD. It has most likely been fixed by one of the commits I made yesterday, please confirm (or infirm).

Usability
18th December 2008, 09:45
Your right, the current build (774) fixed the scroll lockup problem :-)
Thank you for that. We always want problems fixed yesterday, but its not often it actually happens!

fullmetalcoder
6th January 2009, 22:23
QCodeEdit recently gained proper encodings support and improved Bidi support (there where bugs in QTextLayout based rendering) so I am looking for people interested in stress-testing these new features : as I only use utf-8 or latin1 to type in english/french I can hardly make sure everything is working as expected.

On a completely different side, the example application has become a trimmed-down but fully functionnal text editor.

Next items on my TODO list :


improved printing support (which boils down to temporarily wrapping the text to fit in the page size and creating a custom print dialog more adapted to my use case)
session save/restore : ideally sessions would hold information about open files, cursor position(s) and the command stack so that the editor could periodically save the state of a session and recover in case of crash
documentation... it is rather lacking atm

If you have any requests, feel free to tell me, either here or on the task tracker (https://sourceforge.net/tracker2/?group_id=168260).

fullmetalcoder
3rd February 2009, 19:27
Despite my busy time table I've been able to hack a little on QCE lately and I have finally implemented a 1-year old feature request : code snippets. The UI is rough but the infrastructure works perfectly. Stay tuned.

By the way, API docs have grown lately and review/comments would be welcome.

fullmetalcoder
15th February 2009, 23:00
:)

At last... QCodeEdit 2.2 (http://qcodeedit.edyuk.org) is finally available for download (http://sourceforge.net/project/showfiles.php?group_id=168260&package_id=201786).

The docs (http://qcodeedit.edyuk.org/docs/) are now available online, comments on them (and also on QCE itself of course) would be extremely welcome.

Good night (eh, I might be able to get some sleep now ;)).

fullmetalcoder
16th February 2009, 15:09
Thanks to testers, the platform-specific regressions introduced by late fixes in QCodeEdit 2.2 have been fixed and new packages (2.2.1) are now availables.

fullmetalcoder
6th March 2009, 17:16
I am happy to announce the immediate availability of QCodeEdit (http://qcodeedit.edyuk.org/) 2.2.2 (https://sourceforge.net/project/showfiles.php?group_id=168260&package_id=201786)

This release mostly focused on bugfixes and polishing but it also brings several new features, such as configuration UI for the various formatting options, a designer plugin to make it easier to build your app around QCodeEdit and a few other niceties.

By the way, let me introduce two new open source projects using QCodeEdit :


TexMakerX (http://texmakerx.sf.net/) : LaTex editor
Xinx (http://xinx.shadoware.org/) : XSL editor (first QCE-based release due in a couple of days)

Hoping you'll like it.

-Rick-
20th May 2009, 19:33
I'd like to be able to insert some text and let it auto indent, similar as what Kate does when pasting some text.

After I got the impression that it isn't possible yet I noticed some commented code about it. Do you have any plans to finalize this somewhat soon or is this an item more below on your TODO list? Just wondering before I try to handcraft something myself :)

fullmetalcoder
21st May 2009, 11:54
It was possible at some point but the code was broken and I had little time to fix it back then so I disabled it. I'll give it a try ASAP and let you know if I come to something usable.

The main issue here is that I don't know if I should just adjust the indentation or completely reindent the block of text being pasted...

-Rick-
21st May 2009, 13:34
Thanks for your reply.

It seems kdevelop (and I assume Kate) seems to 'fix' the text pasted, so reindenting everything. Although more work I guess it has the benefit that you can automagicly convert someone else's code indenting to yours.

Something else which is somewhat related: when inserting text tabs are not replaced when QEditor::ReplaceTabs is set. The same goes for automatic indention.

Anyway hopefully soon Nixstaller will be another happy user of your widget :)

fullmetalcoder
22nd May 2009, 12:41
Thanks for the report. I've made the ReplaceTabs mode more consistent (though there are probably some corner cases remaining).

As for the indent adjustment upon paste it is now enabled in trunk but might still require a little more testing.

I'll try to release new packages soon but exams may induce delays...

fullmetalcoder
20th July 2009, 11:35
QCodeEdit (http://qcodeedit.org) 2.2.3 is out (http://sourceforge.net/projects/edyuk/files/).

It brings code snippets and session managment (and a bunch of bugfixes as well).

Feedback much welcome as always.

From now on development will focus on the 2.3 branch (2.2 is feature frozen as far as I'm concerned) which will be awesome so stay tuned.

yeaiping
21st March 2011, 10:30
Comment, but's not qt lib