Page 1 of 2 12 LastLast
Results 1 to 20 of 216

Thread: QCodeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: QCodeEdit

    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!

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by croftj View Post
    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...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    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
    Qt Code:
    1. line 38 before
    2. <sequence parenthesis="curly:close" indent="1" fold="1">}</sequence>
    3. after
    4. <sequence parenthesis="curly:close" indent="1" fold="1"> </sequence>
    To copy to clipboard, switch view to plain text mode 
    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.

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    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.

    Quote Originally Posted by Usability View Post
    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?

    Quote Originally Posted by Usability View Post
    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
    Qt Code:
    1. line 38 before
    2. <sequence parenthesis="curly:close" indent="1" fold="1">}</sequence>
    3. after
    4. <sequence parenthesis="curly:close" indent="1" fold="1"> </sequence>
    To copy to clipboard, switch view to plain text mode 
    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.
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    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.

  6. #6
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    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...

    Quote Originally Posted by Usability View Post
    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.


    Quote Originally Posted by Usability View Post
    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 knew I forgot something... D'n'D does not work yet with rectangular selection...

    Quote Originally Posted by Usability View Post
    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

    Quote Originally Posted by Usability View Post
    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.
    Current Qt projects : QCodeEdit, RotiDeCode

  7. #7
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    The CTRL+drag gives you a column edit right?
    It gives me a trail of cursor mirrors. Is that the same thing?

    Quote Originally Posted by fullmetalcoder View Post
    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.

    Quote Originally Posted by fullmetalcoder View Post
    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.


  8. #8
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    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.

  9. #9
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    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...

    Quote Originally Posted by Usability View Post
    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!
    Current Qt projects : QCodeEdit, RotiDeCode

  10. #10
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    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.

  11. #11
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    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

    Quote Originally Posted by Usability View Post
    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?
    Current Qt projects : QCodeEdit, RotiDeCode

  12. The following user says thank you to fullmetalcoder for this useful post:

    Usability (5th November 2007)

  13. #12
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    We have a working column editor now.

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

  14. #13
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    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.

  15. #14
    Join Date
    Feb 2007
    Posts
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QCodeEdit

    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

    Quote Originally Posted by fullmetalcoder View Post
    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.



    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.

  16. #15
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    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.
    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...).
    Current Qt projects : QCodeEdit, RotiDeCode

  17. #16
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    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
    Qt Code:
    1. c:\Qt\4.2.2\include\QtCore\../../src\corelib\global\qglobal.h(1464) : error C2027: use of undefined type 'QMargin'
    2. src\editor\qeditor.h(34) : see declaration of 'QMargin'
    3. c:\Qt\4.2.2\include\QtCore\../../src\corelib\tools\qlist.h(327) : see reference to class template instantiation 'QTypeInfo<T>' being compiled
    4. with
    5. [
    6. T=QMargin
    7. ]
    8. 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 *)'
    9. with
    10. [
    11. T=QMargin
    12. ]
    13. D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(136) : while compiling class-template member function 'QList<T>::~QList(void)'
    14. with
    15. [
    16. T=QMargin
    17. ]
    18. src\editor\qeditor.h(134) : see reference to class template instantiation 'QList<T>' being compiled
    19. with
    20. [
    21. T=QMargin
    22. ]
    23. c:\Qt\4.2.2\include\QtCore\../../src\corelib\tools\qlist.h(329) : error C2514: 'QMargin' : class has no constructors
    24. src\editor\qeditor.h(34) : see declaration of 'QMargin'
    25. c:\Qt\4.2.2\include\QtCore\../../src\corelib\tools\qlist.h(332) : error C2514: 'QMargin' : class has no constructors
    26. src\editor\qeditor.h(34) : see declaration of 'QMargin'
    27. qplaintextedit.cpp ..... (and many more.......)
    To copy to clipboard, switch view to plain text mode 
    Any idea??
    I wonder how others are able to compile.

  18. #17
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    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.

  19. #18
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by vermarajeev View Post
    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...
    Current Qt projects : QCodeEdit, RotiDeCode

  20. #19
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by vermarajeev View Post
    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:

    Qt Code:
    1. svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2
    To copy to clipboard, switch view to plain text mode 

    We need a FAQ on this.

  21. #20
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.