Switching shapes and tools: is it broken?

jaham at gmx.net jaham at gmx.net
Mon Jun 20 21:37:10 BST 2011


On Monday 20 June 2011 15:31:28 Dag Andersen wrote:
> Mandag 20 juni 2011 15:20:27 skrev du:
> > On 20.06.2011 13:02, Dag Andersen wrote:
> > > Mandag 20 juni 2011 11:37:13 skrev du:
> > >> On 20.06.2011 10:34, Dag Andersen wrote:
> > >>> Before the weekend I fixed a crash in ArtisticTextShape and, as Jan
> > >>> Hambrect pointed out, I unvittingly removed the functionallity to go
> > >>> direct between shapes. So I thought I'd find out how this *should* be
> > >>> implemented before I tried to put it back, but I can't!
> > >>> I can find code that afaics is supposed to do it, but it is never
> > >>> executed. It may be that it is just me being confused so I need to
> > >>> run this by somebody that is more familiar with the code than I am.
> > >>> 
> > >>> There is two "types" of switches that can occure:
> > >>> 1) Switch between shapes with different tools.
> > >>> E.g. TextTool ->   ArtisticTextTool.
> > >>> 2) Switch between shapes using the same tool.
> > >>> E.g. TextTool ->   TextTool
> > >> 
> > >> 3. Switch between shapes using a layer docker like in Karbon or Stage.
> > > 
> > > Hmm, how is this different from 2?
> > 
> > The tool itself is not involved in changing the shape selection.
> > 
> > >> This was the use case targeted in the artistic text tool. So the user
> > >> could just click on another artistic text shape from the layer docker
> > >> and have the tool use that for further editing.
> > > 
> > > I opened karbon, added an artistic text shape, added a new layer and
> > > added a new artistic text shape to that layer. Is this the case you are
> > > thinking of?
> > 
> > No, rather you have two artistic text shapes. While editing the first
> > one with the artistic text tool, you click on the second one inside the
> > layer docker. The clicked shape gets selected, the first shape gets
> > deselected. The tool gets a signal that the shape selection changed and
> > checks if the artistic text shape it is currently editing is still
> > selected. It notices that it is not selected anymore so it checks if any
> > other artistic text shape is selected. Yes there is one, so the tool
> > changes its internal state to editing of that newly selected shape.
> 
> Yes, just found out what you meant.
> I still maintain that the shape should not need to listen to the seletion
> changed signal, all switching should be handled by KoToolManager via
> activate()/deactivate().
> If this is left to the shapes *all* shapes have to implement the same
> code...

I am not sure that switching tools on each selection change is the right thing 
to do. That would mean that you are losing the tool state each time the 
selection changes.

Ciao Jan



More information about the calligra-devel mailing list