[patch] Support D&D reordering in the GUI tab pages line

330 переглядів
Перейти до першого непрочитаного повідомлення

Ken Takata

не прочитано,
22 лист. 2013 р., 19:13:0622.11.13
Кому: vim...@googlegroups.com
Hi,

Currently the CUI tab pages line supports drag-and-drop reordering but
the GUI tab pages line doesn't.
Attached patch enables D&D reordering in the GUI tab pages line on
Windows and Linux GTK. (Tested on Windows XP/7 and Ubuntu 12.04.)
This patch is written by Masamichi Abe (Windows) and me (Linux GTK).
Please check.

Regards,
Ken Takata

tabline-dnd.patch

Ken Takata

не прочитано,
23 лист. 2013 р., 00:34:1323.11.13
Кому: vim...@googlegroups.com
Hi,

Sorry, there was a mistake.
SetCursor() should be call after the checking of drag threshold.
Please check the attached patch.

Regards,
Ken Takata

tabline-dnd.patch

Bram Moolenaar

не прочитано,
24 лист. 2013 р., 17:12:5424.11.13
Кому: Ken Takata, vim...@googlegroups.com
Thanks. I'll add it in the todo list.


--
I used to be indecisive, now I'm not sure.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Ken Takata

не прочитано,
24 лист. 2015 р., 06:48:2624.11.15
Кому: vim_dev
Hi Bram,

I'm afraid that you are missing the following patch because the todo item is
not updated:
https://groups.google.com/d/msg/vim_dev/_X0cpMreBiw/n4juz5_eBAAJ

> BTW, Below is also need to be modified, so that, Abe fixed this.
> > Patch for drag&drop reordering of GUI tab pages reordering.
> > (Ken Takata, 2013 Nov 22, second one, also by Masamichi Abe)
>
> https://gist.github.com/nocd5/165286495c782b815b94

The tabline-dnd patch needed to be updated after 7.4.709, and Masamichi Abe
did it. I confirmed that Masamichi's latest patch works fine with 7.4.936
(both on Windows and Linux).
https://gist.github.com/nocd5/165286495c782b815b94

Regards,
Ken Takata

Bram Moolenaar

не прочитано,
24 лист. 2015 р., 09:19:1324.11.15
Кому: Ken Takata, vim_dev
I'll add the github link to the todo item.

--
hundred-and-one symptoms of being an internet addict:
129. You cancel your newspaper subscription.

Ken Takata

не прочитано,
15 бер. 2016 р., 12:19:0715.03.16
Кому: vim_dev, ktakat...@gmail.com
Hi,

2015/11/24 Tue 23:19:13 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
>
> > I'm afraid that you are missing the following patch because the todo item is
> > not updated:
> > https://groups.google.com/d/msg/vim_dev/_X0cpMreBiw/n4juz5_eBAAJ
> >
> > > BTW, Below is also need to be modified, so that, Abe fixed this.
> > > > Patch for drag&drop reordering of GUI tab pages reordering.
> > > > (Ken Takata, 2013 Nov 22, second one, also by Masamichi Abe)
> > >
> > > https://gist.github.com/nocd5/165286495c782b815b94
> >
> > The tabline-dnd patch needed to be updated after 7.4.709, and Masamichi Abe
> > did it. I confirmed that Masamichi's latest patch works fine with 7.4.936
> > (both on Windows and Linux).
> > https://gist.github.com/nocd5/165286495c782b815b94
>
> I'll add the github link to the todo item.

I have updated the tabline-dnd patch to support GTK3.

tabline-dnd.patch

Ken Takata

не прочитано,
10 серп. 2016 р., 09:04:4010.08.16
Кому: vim_dev, ktakat...@gmail.com
Hi Bram,

I have updated the tabline-dnd patch. An error when using cproto has been
fixed. I'm waiting this patch to be included for a long time. I think this
patch is very useful especially for beginners.

Regards,
Ken Takata

tabline-dnd.patch

Ken Takata

не прочитано,
27 вер. 2017 р., 09:26:2727.09.17
Кому: vim_dev
Hi,

I'm waiting this patch to be merged nearly 4 years...
I feel sorry to Masamichi, because I suggested to him writing the Windows part
of this patch, and this is the first patch to Vim for him.

This patch is small enough and it won't break existing behavior.
We can already use D&D on CUI tab pages line. There's no reason to avoid
supporting D&D on GUI tab pages line.

The patch is not changed from previous one. It is also available at:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/045f9ace55f8dbfb53de2aacd1387d3e05fb36fd/tabline-dnd.patch?at=default&fileviewer=file-view-default

Regards,
Ken Takata

Steve Hall

не прочитано,
27 вер. 2017 р., 11:41:0327.09.17
Кому: vim...@googlegroups.com
Wed, Sep 27, 2017 at 9:26 AM, Ken Takata <ktakata65536 gmail com>:
>
> There's no reason to avoid supporting D&D on GUI tab pages line.

Wow, I had no idea this was available. I've been waiting for this since
tabs were introduced. ;)

-- 
Steve Hall  [ digitect dancingpaper com ]

Kazunobu Kuriyama

не прочитано,
29 вер. 2017 р., 04:39:0029.09.17
Кому: vim...@googlegroups.com
I tried the patch.  As far as the GTK+ part was concerned, I didn't run into any noticeable trouble with it at that time.

As I don't know any of the reasons why the patch hasn't been merged yet, it is quite possible that what I'm going to write below is utterly beside the point for the patch to get acknowledged successfully.  Still, I think it nicer if it would be refactored like this: 

1.  Declare some interface functions, say, gui_has_tabline_dnd(), gui_tabline_dnd_tabpage_move(), and gui_tabline_dnd_predicate_on_something(), and then implement them in gui.c like this:

bool gui_has_tabline_dnd(void) { return gui_mch_has_tabline_dnd(); }

bool gui_tabline_dnd_predicate_on_something(int index) {
  return gui_mch_tabline_dnd_predicate_on_something(index);

void gui_tabline_dnd_tabpage_move(int index) {
  if (gui_has_tabline_dnd()) {
    if (gui_tabline_dnd_predicate_on_something(index)) {
      tabpace_move(index + 1);
    } else {
      tabpage_move(index);
    }
  }
}

(I think you've already got an idea as to what gui_tabline_dnd_predicate_on_something() stands for.  Please rename it to a nice name representing the predicate better, together with its mch friend.)

2. In __every__ gui_<gui name>.c, give an implementation (or an appropriate stub in case the GUI in question doesn't support tabline-dnd) to gui_mch_has_tabline_dnd() and gui_mch_tabline_dnd_predicate_on_something(), respectively.

3. In the tabline-dnd event/signal handler, replace the logic which directly invokes tabpage_move() with that using gui_tabline_dnd_tabpage_move() instead.

Needless to say, this is an off-hand example to briefly illustrate one of the general ideas of the GUI layer.  Please go for it mutatis mutandis if you like it.  As you've already noticed, not only the GUI libraries It relies on but the GUI layer itself is written in (a kind of) OOP; since C compilers don't help us with that at all, and since we have neither our own type system nor class object, we have to manually code all the way what C++/Objective-C compilers do for us automatically behind the scene.

Good luck,
Kazunobu

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень