#170 move tab by drag and drop

development
open
nobody
Program (79)
5
2008-10-24
2008-10-24
Maxim Yanchenko
No

Hi, there is an update of the patch drag-move-v1_2.diff, against NEdit 5.5 release (the original patch is 920929).

The changes from the original patch are:

- If you drop a tab to the left or the right side of another tab, it will be placed to the left or to the right of this tab (in 1.2 it's always to the right)

- If you drop a tab to its neighbour, they will always swap, no matter what side did you drop it.

- Works correctly if dropped from another nedit process (will not move anything of course, but will not crash as well). The better way would be to place some unique nedit server ID (PID + X connection, maybe) to the DragWidget and read it on drop site - please feel free to implement.

Please let me know how it works. Thanks.

The original patch is here:
https://sourceforge.net/tracker/?func=detail&aid=920929&group_id=11005&atid=311005

Discussion

1 2 > >> (Page 1 of 2)
  • patch against NEdit 5.5

     
    Attachments
  • TK Soh
    TK Soh
    2008-10-24

    Glad to finally see some progress on this patch. Thanks for working on it.

     
  • What's new in patch 1.4:

    - Inter-process drops are fully fixed now.
    - Cursor changes its shape to the tab being dragged
    - When hovering the dragged tab above the tab bar, it shows the drop position
    - Drag&drop is controlled by three options (all False by default):
    - - dragDropTabs - enable drag and drop for tabs
    - - dragDropTabsCursor - enable nice cursor
    - - dragDropTabsAnimation - enable drag and drop animation

    Tested with OpenMotif 2.3.0 over Exceed on Windows only, so please test it with other Motifs, X servers, window managers, and let me know how it works (on Exceed 11.0.0.0, I see artifacts while drawing under a moving cursor).
    Thanks.
    File Added: drag-move-v1_4.diff

     
  • patch against NEdit 5.5

     
    Attachments
  • Tony Balinski
    Tony Balinski
    2008-11-20

    Looks like your 1.4 patch doesn't include files tabDragDrop.c, tabDragDrop.h, and must be applied (presumably) after applying 1.3. Is this correct? Otherwise, I'm going to give this a go: I use TK's tab d&d quite a lot!
    Thanks,
    Tony

     
  • Bert Wesarg
    Bert Wesarg
    2008-11-20

    No problem here as a first time patch applier. Builds and works fine with OM2.3.1.

     
  • I see now: my download hadn't copied the complete file... sorry for the wasted bandwidth!
    Tony

     
  • Bert Wesarg
    Bert Wesarg
    2008-12-06

    I got un-nice compiler warnings from the tabDragDrop.c file, these should be addressed:

    tabDragDrop.c: In function 'createTabDragCursor':
    tabDragDrop.c:195: warning: implicit declaration of function 'abort'
    tabDragDrop.c:195: warning: incompatible implicit declaration of built-in function 'abort'
    tabDragDrop.c:201: warning: suggest parentheses around assignment used as truth value
    tabDragDrop.c: In function 'beginTabDragAP':
    tabDragDrop.c:218: warning: implicit declaration of function 'GetPerfDragDropTabs'
    tabDragDrop.c:226: warning: implicit declaration of function 'GetPerfDragDropTabsCursor'
    tabDragDrop.c: In function 'moveTabProc':
    tabDragDrop.c:240: warning: implicit declaration of function 'GetPrefSortTabs'
    tabDragDrop.c: In function 'getClosestTab':
    tabDragDrop.c:384: warning: implicit declaration of function 'abs'
    tabDragDrop.c: In function 'redrawTabBarProc':
    tabDragDrop.c:413: warning: implicit declaration of function 'XmRedisplayWidget'
    tabDragDrop.c: In function 'tabDragProc':
    tabDragDrop.c:460: warning: missing sentinel in function call
    tabDragDrop.c:493: warning: missing initializer
    tabDragDrop.c:493: warning: (near initialization for 'gcVals.function')

    mostly missing includes. but the 'missing sentinel in function call' and 'suggest parentheses around assignment used as truth value' are IMHO real bugs.

     
  • This does not compile under solaris - with Motif 2.1
    Apparently, the solaris version of Motif does not support XmRedisplayWidget

     
  • patch against NEdit 5.5

     
    Attachments
  • Version drag-move-v1_5.diff is uploaded.
    Doesn't call Motif's XmRedisplayWidget and also addresses the warnings reported by Bert.
    Please let me know how it works.
    Thanks.
    File Added: drag-move-v1_5.diff

     
  • it seems this patch doesn't work for me. I download the source code from the nedit's CVS. I also tried to change the preferences but no better. Any idea?

    --------------------------------------------------------------------------
    NEdit release of Aug 20, 2004

    Built on: Linux, 386, Intel C++
    Built at: Apr 13 2009, 11:05:34
    With Motif: 2.2.3 [@(#)Motif Version 2.2.4]
    Running Motif: 2.2 [unknown]
    Server: The X.Org Foundation 10400090
    Visual: 24-bit TrueColor (ID 0x23, Default)
    Locale: en_US.UTF-8

     
  • Thanks for trying the patch!

    Well, it's hard to understand what's wrong just from plain "doesn't work".
    More symptoms needed (build errors, warnings, error messages, crashes etc).

    Just general considerations:
    I never tried to apply this patch to the latest CVS (I have no access), but it's supposed to work for the 5.5 release. (Btw, my NEdit 5.5 version is of Sep 30, 2004, while yours is of Aug 20, 2004 - looks a bit suspicious.)

    It's confirmed to work with Open Motif 2.3.0 and 2.3.1, not sure about the version you're using.

    Also, It may depend on X server and wrong mouse events translation: drag-n-drop in Motif uses middle button, not the left one, and some X servers don't pass middle clicks correctly (e.g. XMing 6.9 server doesn't work, it doesn't even show standard NEdit's context menu on right-click). Hummingbird Exceed confirmed to work.
    So please make sure your X server passes middle clicks correctly (you can check this in any other application that reacts to middle-clicks).
    Please also make sure that your middle-click translations are not overridden (check your .Xdefaults and related files for Translations resource, you should not have anything for Btn2)

    Also, in case of typo, here is what's in my .Xdefaults:
    nedit*dragDropTabs: True
    nedit*dragDropTabsCursor: True
    nedit*dragDropTabsAnimation: True

    Please let me know how it works.

    Thanks,
    Maxim

     
  • Now it works after I use your .Xdefault. Great! but I have a question: is this the only way to make this feature work by adding these three lines into .Xdefaults:
    nedit*dragDropTabs: True
    nedit*dragDropTabsCursor: True
    nedit*dragDropTabsAnimation: True

    Can I do something with the source code of nedit instead of setting something externally?

    Thanks!

     
  • Sure, you can always go to preferences.c (don't remember exactly) and change the defaults.

    I just decided to be on a safe side and have any new behavior disabled by default (to avoid possible crashes on bad X servers etc)
    So I think it's better to have such things in a resource file.
    You can also send these resources to nedit using -xrm command-line option.
    If you usually start nc, there is a config parameter serverCommand - you can pass these resources there as well.

    However, I'd recommend using .Xdefaults (or nedit.rc - you can also put all these options there) instead.

     
  • Thanks. One thing that might make the patch more complete is to add a entrance in "preference" such that users can enable or disable it, like the existing "hardlinks" and "remove zero sized files".

     
  • Sorry, I don't really understand what you mean.
    Could you give a specific example?

    Curerntly you can go to preferences.c and see lines like
    {"dragDropTabs", "DragDropTabs", PREF_BOOLEAN, "False",
    So you can change the defaults there.
    What's wrong with it?

     
  • sorry. I mean, for example, if I want to alway remove zero sized files, I can go to "preference->default setting->remove zero sized files" and select "always".

    The current patch works fine for me, however, if we can enable it or disable it through "preference->default setting->...", instead of modify the .Xdefaults file or nedit.rc (by the way, if I modify nedit.rc and if later I click "preference->save default" all the modification regarding to drop and move tables will be lost), it would be more complete (and better).

     
  • Ah, now I understand. I'll think about it. Thanks for the idea.

     
  • NEdit release of Jul 8, 2009

    Built on: Linux, x86-64, GNU C
    Built at: Jul 9 2009, 09:40:26
    With Motif: 2.3.0 [@(#)Motif Version 2.3.0]
    Running Motif: 2.3 [unknown]
    Server: The X.Org Foundation 10502000
    Visual: 24-bit TrueColor (ID 0x21, Default)
    Locale: en_US.UTF-8
    NEdit Shell: /bin/csh
    Default Shell: /bin/csh

    ==================================

    I've tried this patch and basically it works - the tab will be drag and drop to the desired position. However, there are still something strange that I would consider them as some bugs in the code.

    The problem can be duplicated with following steps:

    1) Open nedit by typing “nedit” and press the “enter” key.

    2) In the opened nedit window, open 2 new tabs.

    3) Click the middle button on a tab (and keep the middle button pressed). The cursor arrow will disappear and a block (rectangle, about the same size of the tab) will appear. It seems that the block is filled with a certain pattern.

    4) Drag and drop the selected tab to the desired position.

    5) Repeat step 3) - 4) or repeat 1) -4) you’ll find sometimes the fill pattern may change (different texture or color).

    I am using nedit from a developper's GIT: http://repo.or.cz/w/nedit-bw.git.

     
  • if I set nedit.dragDropTabsCursor=False, then the drag&drop behaves consistently. So maybe there is a bug regarding with this setting.

    Another problem is: if I put those settings:

    nedit.dragDropTabs: True
    nedit.dragDropTabsCursor: False
    nedit.dragDropTabsAnimation: True

    in nedit.rc, and if I change my default preference and save it in the future (preference->save defaults), they will be lost.

     
  • Regarding the last two comments:
    1) Regarding the missing nedit.rc settings.
    The settings should be put in your .Xdefaults file (or passed via -xrm command-line option). Setting/storing it inside nedit (and nedit.rc that is maintained by nedit) is not currently supported, however there is a request from 2009-04-16, and I'll take care of it when I have time.
    2) Regarding the strange cursor appearance.
    Could you try to build the released 5.5 with this patch applied as well? Just to make sure that nothing was changed in 5.5 -> 5.6 upgrade. As to the dragDropTabsCursor option, it's intentionally created to give an ability to switch off a non-working aspect of the patch behavior: in my case it's dragDropTabsAnimation (Exceed X Server), in your case it's looks like dragDropTabsCursor doesn't work correctly). Could you also check your X Server settings regarding pixmap cursors? Probably you will find a combination of options that will work.

    The cursor should look exactly as a tab, see a screenshot here:
    http://enerjazzer.livejournal.com/47957.html

     
  • 1) I tried with nedit 5.5+this patch and nothing changed.

    2)which X server might cause the problem?

    Thanks.

     
  • should be "which X server setting". sorry.

     
  • I don't know for sure, it depends on the X server you're using.
    Please try to look at any options that mention cursors.

    Could you please also share your configuration (OS and X Server version, maybe video card driver too), so other users with similar things could share their experience?
    Mine is probably irrelevant to your case as I'm using Exceed on Windows.

    However, from my experience, some things that are adjustable with Xperf affect NEdit appearance, so you can start with this.

    Could you also post your question to the NEdit mailing list? It looks like updates here don't automatically come there for some reason.

     
1 2 > >> (Page 1 of 2)