Rob Oakes wrote:
> Attached you will find a patch that implements a new LyX function
> (LFUN_OUTLINE_DRAGMOVE).  It is the backend for drag and drop functionality
> that I would like to add to the existing Outline view and to the Corkboard
> view that I have been working on.

I haven't looked closely at it (and I'm not the one to give really 
straightforward comments on the Outline stuff) and neither tested it, but on a 
first glance, it looks good.

Some minor, widely stylistic things I stumbled upon:

>Index: src/Text3.cpp
>===================================================================
>--- src/Text3.cpp       (revision 30213)
>+++ src/Text3.cpp       (working copy)
>@@ -78,6 +78,7 @@
>
> #include <clocale>
> #include <sstream>
>+#include <iostream>

Why do you need this include?

> using namespace std;
> using namespace lyx::support;
>@@ -305,7 +306,70 @@
>        OutlineOut // Make this header shallower
> };
>
>+static void DragMove(Cursor & cur, int moveId, int moveToId) {

dragMove (we start camelBumps with lower case).

>+       // Create Pointers to Buffers
>+       Buffer & bufMove = *cur.buffer();

buf_move

>+       DocIterator ditMove = bufMove.getParFromID(moveId);
>+       DocIterator ditDest = bufMove.getParFromID(moveToId);
>+       pit_type & pitMove = ditMove.pit();
>+       pit_type & pitDest = ditDest.pit();

dit_move
dit_dest
pit_move
pit_dest

>+       ParagraphList & pars = ditMove.text()->paragraphs();
>+
>+       // Create References to the Paragraphs to Be Moved
>+       ParagraphList::iterator const bgn = pars.begin();
>+       ParagraphList::iterator destStart = boost::next(bgn, pitDest);

also lowercase

[snip]

> void Text::number(Cursor & cur)
> {
>        FontInfo font = ignore_font;
>@@ -2023,6 +2086,16 @@
>                cur.buffer()->updateLabels();
>                needsUpdate = true;
>                break;
>+
>+       case LFUN_OUTLINE_DRAGMOVE: {
>+               int const moveId = convert<int>(cmd.getArg(0));
>+               int const moveToId = convert<int>(cmd.getArg(1));

dito.

>+               DragMove(cur, moveId, moveToId);
>+               }
>+               setCursor(cur, cur.pit(), 0);
>+               cur.buffer()->updateLabels();
>+               needsUpdate = true;
>+               break;
>
>        default:
>                LYXERR(Debug::ACTION, "Command " << cmd << " not DISPATCHED
> by Text"); @@ -2198,6 +2271,7 @@
>        case LFUN_FLEX_INSERT: {
>                code = FLEX_CODE;
>                string s = cmd.getArg(0);
>+               string si = cmd.getArg(0);

This looks suspicious.

>                InsetLayout il =
>                       
> cur.buffer()->params().documentClass().insetLayout(from_utf8(s)); if
> (il.lyxtype() != InsetLayout::CHARSTYLE &&
>@@ -2407,6 +2481,7 @@
>        case LFUN_OUTLINE_DOWN:
>        case LFUN_OUTLINE_IN:
>        case LFUN_OUTLINE_OUT:
>+       case LFUN_OUTLINE_DRAGMOVE:
>                // FIXME: LyX is not ready for outlining within inset.
>                enable = isMainText(cur.bv().buffer())
>                        && cur.paragraph().layout().toclevel !=
> Layout::NOT_IN_TOC;


Jürgen

Reply via email to