Denis> In the mode where changing the active layer doesn't automatically
 Denis> show/hide those between the old and new active layers, ultimately one
 Denis> might want to change slightly the logic of on_viewShowLayer_activate()
 Denis> and on_viewHideLayer_activate().

I took a stab at it last night. I don't mean this code to be integrated
into xournal, but it is something that has bugged me for some time (I
wanted to be able to add annotations below the current layer).

I'll test it for few days and see how it goes and report back. I felt
that, for simple tasks (usually involving two or three layers) the
minimum needed is to move the current layer down, and to display layers
above:

See these two files:

http://turingmachine.org/~dmg/temp/test-layers-before.pdf

and using this feature, adding a layer underneath (and painting with the
highlighter on it) was fairly easy.

http://turingmachine.org/~dmg/temp/test-layers-after.pdf

With the current layer management of xournal it is very hard to do this,
since the highlighter goes on top and masks the text under, and if I
enable to layer below, I can't see the current layer.

This is what I did:

https://github.com/dmgerman/xournal/compare/layers


- Refactored the code that changes the current layer:
  xo_layer_active_set(gint layerIndex). This was mainly because the
  combo box needs to be set to an integer that is counter intuitive to
  the layer index. It also separates interface from logic.
- Added a flag ui.display_layers_above (defaults to false)
- Added an undo/redo operation ITEM_MOVE_LAYER_DOWN
- Added the page number to the undo structure (since I need to know the
  page number)
- Added a new menu function: Move Layer Down. This feature will move the
  current layer one down, and will make that layer the active one. You
  cannot move layer 1 behind the background), and of course, you cannot
  move the background.
-  make sure you move to page (if necessary) when undo/redo move_layer_down

I haven't touched on_viewShowLayer,on_viewHideLayer  yet. I'll see how
it goes.

--dmg

 Denis> (on_viewHideLayer() without change is still reasonable, because a menu
 Denis> entry called "Hide Layer" should do just that, and then the currently
 Denis> active layer should change since the active layer becomes hidden;
 Denis> moving down by 1 seems reasonable though you don't know completely for
 Denis> sure whether that layer is visible. on_viewShowLayer() is trickier
 Denis> because it first moves up by 1 layer and then makes that one visible,
 Denis> which is a bit counterintuitive, in case the new layer was already
 Denis> visible nothing new gets shown -- but since the currently active layer
 Denis> is already visible, I don't know what else "Show Layer" should be
 Denis> doing, except perhaps look harder for a hidden layer near the active
 Denis> one in case it's not the one just above that would make most sense?)

 Denis> Ultimately ultimately, there should just be something smarter, where
 Denis> one has the ability to make layers visible/invisible independently of
 Denis> each other, and also to change the order of layers or flatten several
 Denis> layers onto one. This will require more serious UI changes though.

 Denis> Best,
 Denis> Denis

 Denis> On 03/22/2014 08:32 PM, D M German wrote:
 >> 
 >> One thing I'd love to have (and I just checked and it is easy to
 >> implement) is that i can't see above layers.
 >> 
 >> Say I have two layers (plus background). I would like to add strokes
 >> behind the current one (say highlighter). the problem is that the
 >> layers above are not visible.
 >> 
 >> I suspect, Denis, that the main rational to hide upper layers is to
 >> avoid the confusion of not being able to select.
 >> 
 >> What I suggest is the following:
 >> 
 >> - Create an option: Display "above" layers. Defaults to false.
 >> 
 >> - In the following code comment the line: gnome_canvas_item_hide
 >> I don't think there is any side effect.
 >> 
 >> on_comboLayer_changed                  (GtkComboBox     *combobox,
 >> ...
 >> while (val<ui.layerno) {
 >> gnome_canvas_item_hide(GNOME_CANVAS_ITEM(ui.cur_layer->group));
 >> ui.layerno--;
 >> if (ui.layerno<0) ui.cur_layer = NULL;
 >> else ui.cur_layer = g_list_nth_data(ui.cur_page->layers, ui.layerno);
 >> }
 >> 
 >> 
 >> 
 >> --
 >> Daniel M. German                  "I'm crazy, but I'm not stupid"
 >> Jackie Chan
 >> http://turingmachine.org/
 >> http://silvernegative.com/
 >> dmg (at) uvic (dot) ca
 >> replace (at) with @ and (dot) with .
 >> 
 >> 
 >> 
 >> ------------------------------------------------------------------------------
 >> Learn Graph Databases - Download FREE O'Reilly Book
 >> "Graph Databases" is the definitive new guide to graph databases and their
 >> applications. Written by three acclaimed leaders in the field,
 >> this first edition is now available. Download your free book today!
 >> http://p.sf.net/sfu/13534_NeoTech
 >> _______________________________________________
 >> Xournal-devel mailing list
 >> Xournal-devel@lists.sourceforge.net
 >> https://lists.sourceforge.net/lists/listinfo/xournal-devel
 >> 

 Denis> -- 
 Denis> Denis Auroux                             aur...@math.berkeley.edu
 Denis> University of California, Berkeley       Tel: 510-642-4367
 Denis> Department of Mathematics                Fax: 510-642-8204
 Denis> 817 Evans Hall # 3840
 Denis> Berkeley, CA 94720-3840


--
Daniel M. German                  "For indeed who is there alive
                                   that will not be swayed by his
                                   bias and partiality to
    Jonathan Swift ->              the place of his birth?"
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Xournal-devel mailing list
Xournal-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xournal-devel

Reply via email to