Re: Common/Shared properties for grouped and selected objects on a diagram
From: Hans Breuer <hans breuer org>
To: spamfrommailing freax org, discussions about usage and development of dia <dia-list gnome org>
Cc:
Subject: Re: Common/Shared properties for grouped and selected objects on a diagram
Date: Tue, 11 Jan 2005 00:16:09 +0100
On 09.01.2005 15:27, Philip Van Hoof wrote:
Hi there.
I actually got frustrated by the fact that both for grouped and selected
objects on a diagram, you cannot set their shared set or properties
using one action (you basically have to select each of them individually
to set all their properties individually).
Using this one in properties.c and a call to it in commands.c I am
trying to hack together the possibility to select multiple objects and
set their common properties using one single object-properties box.
I have noticed that grouped object-properties aren't working either.
When you group objects together, you can't set the individual
object-properties anymore.
I sense a common feature of which code can be shared by both selected
and grouped such objects.
The merging of possible options is now being done using
prop_desc_lists_intersection which i discovered while browsing the
sources of dia.
So if object a has properties 1 2 and 3 and object b has properties 3, 2
and 4 it should only show 2 and 3 since those that are shared by both
objects. And not 1 and 4 for those aren't shared. So indeed, the
intersection of the properties.
If this is a bad idea or if I am going into a totally wrong direction
here, please correct me.
There is a (working) prototype for group properties since 2003-01-19 :
* plug-ins/python/group_props.py : (new file) a prototype for
one the most requested features: Change properties of selected
objects in one step. Requires pygtk.
The basic idea is the same as descrived by you. Important stuff missing
for core inclusion is:
- undo handling, probably one wants all changes grouped
- using 'native' widgets for properties (should be simple
if running in the core)
Missing from you patch as far as I can tell from the code - the python
plug-in has it and IMO it is quite essintial for useability: select
what of the different properties you want to share the same value.
There are some further issues with the patch, most of them remaining
in the newer version, so here it goes :
#include "propinternals.h"
// yes I know this is probably a private of the library "lib".
- the coding style wont get any better by random complains about it
[clean patches reducing global variables use are gladly accepted;]
- Dia needs to compile with C89, so c++ comment are even worse
coding style than any global variable
// mind however that dia's source isn't always using the best
// codestyle known to mankind. I really dislike the usage of global
// variables in many .c files. For me, as somebody who isn't a
// core developer, it's very VERY hard to follow many paths the
// code is following cause of this. A function can manipulate
// a million things that aren't defined in the function. Many
// functions set global GUI widgets that may affect stuff thats
// totally not related to the function by itself.
The global vars are not only there because Dia developers don't
know better - they often have a puropse. Most dialogs are
modeless which especially with the properties dialog makes
some sense.
You can select an object, change its properties and doubleclick
the next object to continue changing properties. Also there will
be only one dialog of a kind.
In the early times of Dia it may additionally have been useful
to cache dialogs. IMO this isn't justified anymore nowadays,
so I've started to remove such code when changing it anyway.
// And stuff like this: create_dialog ()
// and now suddenly the global pointer dialog is set.
// Why not : GtkWidget *dialog = create_a_new_dialog (); ?
- if you need a prototype please don't decrease code quality
by randomly defining it in C files as extern, even more if
it *is* already in a header -> lib/properties.h
Also I think you want pdtpp_is_visible(), i.e. not filter
out the standard toolbox props.
void
properties_of_selected_show (Diagram *dia, GList *selected)
{
if (selected)
{