multi fields

2006-07-24 Thread lidiriel
Hello,

i try to create a new plugin for dia in C.
But I have a little problem with PropDescription.
I have two question ?

1=>
See in the end of this mail for an extract of my code.
In this code i have a table dtmf[2] of enumerate (BayMenuDtmfResponse) 
and i would use it for store parameter.
What's the method for use a table ? It is good ?

2=>
What is PROP_TYPE_DARRAY ? I don't found a simple example only with uml 
plugin and this plugin is complicated...

thanks for your help !

Lidiriel


/* Object Menu definition */
typedef struct _Menu {
   Element element;

   ConnectionPoint connections[BAY_MENU_NUM_CNX];

   /* menu genral parameter */
   BayMenuType type; /* menu type */
   gchar *name; /* menu name */

   ***

   /* menu fonctionnal parameter */
   BayMenuDtmfResponse dtmf[2];

} Menu;

***

PropEnumData menu_dtmf[] = {
{ N_("wrong"), BAY_MENU_WRONG },
{ N_("ok return dtmf"), BAY_MENU_RETURN_DTMF },
{ NULL}};

/* all property description */
static PropDescription menu_props[] = {
   ELEMENT_COMMON_PROPERTIES,
{ "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE, N_("Type"), NULL, 
menu_style },
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Name"), NULL, NULL },
{ "dtmf1", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE, N_("DTMF 1"), NULL, 
menu_dtmf },
{ "dtmf2", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE, N_("DTMF 2"), NULL, 
menu_dtmf },
   PROP_DESC_END
};

static PropDescription *
menu_describe_props(Menu *menu)
{
   if (menu_props[0].quark == 0)
 prop_desc_list_calculate_quarks(menu_props);
   return menu_props;
}

static PropOffset menu_offsets[] = {
   ELEMENT_COMMON_PROPERTIES_OFFSETS,
   { "type", PROP_TYPE_ENUM, offsetof(Menu, type) },
{ "name", PROP_TYPE_STRING, offsetof(Menu, name) },
{ "dtmf1", PROP_TYPE_ENUM, offsetof(Menu, dtmf[0]) },
{ "dtmf2", PROP_TYPE_ENUM, offsetof(Menu, dtmf[1]) },
   { NULL, 0, 0}
};
___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



create python dia plugin : need help !

2006-07-26 Thread lidiriel
I have recompiled dia 0.95 on linux.
I paste into ~/.dia/python/hello.py , the hello code found in this 
mailling list :
import dia
def hello_callback(data, flags):
   print "Hello, Dia!\n"
dia.register_callback("Hello, world",
   "/Plugins/Hello",
   hello_callback)

my dia is compiled with option --enable-debug and --with-python
But i don't find the plugin entry hello in dia. It the same thing for 
center.py whit a callback function

dia.register_callback ("Center Objects",
"/Objects/Center",
dia_objects_center_cb)

What's happended ? I have no idea ?


___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: create python dia plugin : need help !

2006-07-26 Thread lidiriel
Robert Staudinger wrote:

> 
> The API has changed as Dia has been moving from using the deprecated
> GtkItemFactory to GtkActions. Dia's existing plugins have been
> updated, check [1] for reference.
> 
> [1] 
> http://cvs.gnome.org/viewcvs/dia/plug-ins/python/debug_objects.py?rev=1.5&view=markup
> 
> HTH,
> Rob
thanks for your link but with the hello.py code if i try the 
register_action with :

dia.register_action ("Hello", "Hello",
  "/DisplayMenu/Hello",
  hello_callback)

it not work, i have in terminal : "could not import hello.py"
if i use register_callback :

dia.register_callback ("Hello",
"/Tools/Hello",
hello_callback)

it's work : there is a new hello entry in toolbar.
What is the correct register ?
my hello_callback method is :

def hello_callback(data, flags):
   print "Hello, Dia!\n"

I use the 0.95 version downloaded from http://www.gnome.org/projects/dia/

Is "dia.register_action" work with it or it's only for the last cvs source ?

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



export filter

2006-07-27 Thread lidiriel
Hello,

now i stop my python development and i began a new export filter in C.
I created fews objects in new lib and i try to generate an export file.
I use the method :
static void draw_object(DiaRenderer *self, DiaObject *object) for 
detected each object and generate a piece of export file.
it 's work but i have many warning message in terminal like :

** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
** (dia:12635): WARNING **: IvrRenderer::set_line_style not implemented!
** (dia:12635): WARNING **: IvrRenderer::set_line_join not implemented!
** (dia:12635): WARNING **: IvrRenderer::set_line_caps not implemented!
** (dia:12635): WARNING **: IvrRenderer::fill_polygon not implemented!
** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!

In my code i'm not implemented this method because i would like work 
only with my object.
How to make this normally ? (and for suppress the message)

(For information the export file is not a graphical file but a script file)

lidiriel


___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



access to custom object properties in plugin

2006-07-28 Thread lidiriel
lidiriel wrote:
> Hello,
> 
> now i stop my python development and i began a new export filter in C.
> I created fews objects in new lib and i try to generate an export file.
> I use the method :
> static void draw_object(DiaRenderer *self, DiaObject *object) for 
> detected each object and generate a piece of export file.
> it 's work but i have many warning message in terminal like :
> 
> ** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::set_line_style not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::set_line_join not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::set_line_caps not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::fill_polygon not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
> ** (dia:12635): WARNING **: IvrRenderer::draw_line not implemented!
> 
> In my code i'm not implemented this method because i would like work 
> only with my object.
> How to make this normally ? (and for suppress the message)
Ok I don't use "data_render" methode in my export plugin.
for the same use i create a new function (for no warning message :) ) 
It's work perfectly i detect the type of my object. But for the core of 
plugin i must use the property of object. Example i have an object :

dia/objects/Bay/boundary.c
...
typedef enum { BAY_BOUNDARY_BEGIN,  
 BAY_BOUNDARY_END } 
BayBoundaryValue;

/* Object Boundary definition */
typedef struct _Boundary {
   Element element;

   ConnectionPoint connections[BAY_BOUNDARY_NUM_CNX];

/* Custom inner color */
   Color fill_color;

/* boundary type */
   BayBoundaryValue value;
}
...

and in my plugin  : dia/plugin/foo/render_foo.c
I have an object DiaObject *obj with the type defined in boundary.c
it's good BUT now i would like acces to property "value" ??
My question is  : How to do that ?

Lidiriel.
___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: access to custom object properties in plugin

2006-07-28 Thread lidiriel
But for the core of
> plugin i must use the property of object. Example i have an object :
> 
> dia/objects/Bay/boundary.c
> ...
> typedef enum { BAY_BOUNDARY_BEGIN,
>  BAY_BOUNDARY_END } 
> BayBoundaryValue;
> 
> /* Object Boundary definition */
> typedef struct _Boundary {
>Element element;
> 
>ConnectionPoint connections[BAY_BOUNDARY_NUM_CNX];
> 
>   /* Custom inner color */
>Color fill_color;
> 
>   /* boundary type */
>BayBoundaryValue value;
> }
> ...
> 
> and in my plugin  : dia/plugin/foo/render_foo.c
> I have an object DiaObject *obj with the type defined in boundary.c
> it's good BUT now i would like acces to property "value" ??
> My question is  : How to do that ?
> 

Oh i'm alone here ;)
Ok for my last question i found myself the answer. P ! Dia is very 
good but the doc is very light :)
for my problem i use "object_prop_by_name" like this :

dObj = (DiaObject *)list->data;
type = object_get_type(object_get_displayname(dObj));
if(!strcmp(type->name,IVR_BAY_BOUNDARY)){
dia_assert_file(FALSE,"Boundary object found\n");
/* test boundary begin */
/*
   get propertie
   see lib/properties.h
   see lib/prop_intypes.h
   StringProperty : string_data
   EnumProperty : enum_data
*/
prop = object_prop_by_name(dObj, "value");
val = ((EnumProperty *)prop)->enum_data;
if(val == BAY_BOUNDARY_BEGIN){
/* ... */
}

It's work... that's cool ! I like dia :)
It's time for me to finish my plugin.

Thanks for you attention ;)

Hum when my lib an plugin will be ready who i contact for a possible 
addition in dia ??

lidiriel

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



line object

2006-08-01 Thread lidiriel
Hello,

for a plugin  :
I must know those 2 objects which are connected to a begin and the end 
point of a line. For information the connection point of the line is not 
use.
How I made this ?

thanks for your help !

Lidiriel.
___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: line object

2006-08-01 Thread lidiriel
Lars Clausen wrote:
> On Tue, 2006-08-01 at 17:35 +0200, lidiriel wrote:
>> Hello,
>>
>> for a plugin  :
>> I must know those 2 objects which are connected to a begin and the end 
>> point of a line. For information the connection point of the line is not 
>> use.
>> How I made this ?
> 
> You look at the endpoint_handles array defined in lib/connection.h (of
> which line is a subclass).  Each Handle object contains a
> ConnectionPoint that if non-null it is connected to, out of which you
> can grab the object.
> 
> -Lars
Thanks Lars, i look that this morning !

Lidiriel.
___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



stringlist

2006-08-04 Thread lidiriel
Hello,

for my current plugin i use dia 0.95 and i would use the property
PROP_TYPE_STRINGLIST for saving a list of string (from a GList*).
I have checked the file prop_text.c and the 2 method :
stringlistprop_load & _save are not implemented !
Are they written in cvs repository ?
If not, is complicated to write ? or how i save a GList of gchar when 
the number of char are variable (user can add or delete a text field).

thanks

Lidiriel.
___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: line object

2006-08-04 Thread lidiriel
lidiriel wrote:
> Lars Clausen wrote:
>> On Tue, 2006-08-01 at 17:35 +0200, lidiriel wrote:
>>> Hello,
>>>
>>> for a plugin  :
>>> I must know those 2 objects which are connected to a begin and the end 
>>> point of a line. For information the connection point of the line is not 
>>> use.
>>> How I made this ?
>> You look at the endpoint_handles array defined in lib/connection.h (of
>> which line is a subclass).  Each Handle object contains a
>> ConnectionPoint that if non-null it is connected to, out of which you
>> can grab the object.
>>
>> -Lars
> Thanks Lars, i look that this morning !
thanks :) It's work very well !
___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: stringlist

2006-08-09 Thread lidiriel
On Tue, 2006-08-08 at 17:36 +0200, ludovic mercier wrote:
> Le vendredi 04 août 2006 à 17:51 +0200, Lars Clausen a écrit :
> > On Fri, 2006-08-04 at 17:25 +0200, lidiriel wrote:
> 
> > They should be fairly easy.  Check out pointarrayprop_load and _save in
> > prop_geomtypes.c, which are similar.  It's just that nobody's been using
> > them yet.
> > 
> > -Lars
Hello, the next of my dia experience :)
my bug is in the free_scroll_tool() function after the call of
dia_object_default_create().
the error is : Program received signal SIGSEGV, Segmentation fault.
Hum i don't know how to resolv it... any idea ?

Lidiriel.

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



bug in stringlist ?

2006-08-09 Thread lidiriel
Hello,

I try to use stringlist (prop_text.c .h) with a new simple object.
For a attribut GList * foo, if foo has a minimum of one element a bug
appear when the object is draw (if foo is null no bug).
After analysis i think that dia failed on diagram_tree_add_object ...


...
diagram_add_object(Diagram *dia, DiaObject *obj)
{
  layer_add_object(dia->data->active_layer, obj);
  diagram_modified(dia);
  diagram_tree_add_object(diagram_tree(), dia, obj);
}
...
probably i don't use correctly this type ??
Sommeone have an example of uses for this type ?

Lidiriel.

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: bug in stringlist ?

2006-08-10 Thread lidiriel
On Thu, 2006-08-10 at 22:20 +0200, Lars Clausen wrote:

> Given that diagram_tree_add_object has no relevance to the stringlist
> properties, I'm thinking corrupted memory has happened.  As I mentioned
> earlier, stringlist is not used anywhere else -- this means there's likely
> to be bugs in there.  I can recommend using valgrind to find the first
> place where somebody does something wrong to memory.  I'll poke onto
> irc.gnome.org #dia when I have time, so if you hang around there, we can
> chat about it.
> 
> -Lars
Ok i suppress one bug in my code (bad allocation of string) but now if i
use this PropDescription :
{ "foo", PROP_TYPE_STRINGLIST, 0, NULL, NULL, NULL}, dia failed and
if i use :
{ "foo", PROP_TYPE_STRINGLIST, PROP_FLAG_DONT_SAVE, NULL, NULL, NULL},
the object is drawed.
But i would like saving the list ...
In two case the PropOffset is :
{ "foo", PROP_TYPE_STRINGLIST, offsetof(TheObject, foo) },
with the var GList * foo; 

Lidiriel

ps : Sorry if i send this mail twice...

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: Drawing GUIs

2006-08-10 Thread lidiriel
On Thu, 2006-08-10 at 14:48 -0300, Pablo Sebastián Colombo wrote:
> Ok, Lars! Thanks for your help! I think that this open source option 
> will success.
> 
> best regards!!
> 
> Pablo
> 
> Lars Clausen escribió:
> > On Thu, 2006-08-10 at 13:36 -0300, Pablo Sebastián Colombo wrote:
> >   
> >> Examples? mmm maybe something like this...
> >>
> >> http://papo.vialibre.org.ar/sshots/
> >>
> >> We have to build a system, and before that we have to design the screen, 
> >> the forms, etc  and all like this,.. we just what to create "how 
> >> they look like", where will the labels will be in the form,  and 
> >> sooo...
> >> 
> >
> > Dia definitely isn't the thing for this.  Dia does diagrams (elements
> > with connections between them) really well, but Glade or even Gimp would
> > be more useful for creating those.
> >
> > -Lars
Hello Pablo,

you can try xfig for this with the "interface library" .

Lidiriel

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



stringlist

2006-08-11 Thread lidiriel
Hello Lars,

before send you my prop_text file i try to create a widget for this
type. A table with two columns. It works for the view but when the
windows widget is close i have bug. The pointer list in the "draw
function object" is null but the list in the function :
stringlistprop_set_from_widget(...) is full.
Where i can look for this in dia code ??

Lidiriel

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



graph algo

2006-08-11 Thread lidiriel
Hello

I think it will be interresting for next dia development to create a
class object whitch implement different graph algorithm.
Like Depth-first search algorithm, and other.

what think about it ?

Lidiriel.

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: graph algo

2006-08-11 Thread lidiriel
On Fri, 2006-08-11 at 18:29 +0200, Lars Clausen wrote:
> On Fri, 2006-08-11 at 17:50 +0200, lidiriel wrote:
> > Hello
> > 
> > I think it will be interresting for next dia development to create a
> > class object whitch implement different graph algorithm.
> > Like Depth-first search algorithm, and other.
> 
> Not sure how you mean implementing graph algorithms in relation to Dia.
> Can you give an example of how this would be used?
> 
For the "depth first search algorithm" i begin one test version in my
plugin.
I defined one "start object" (or head object) the algorithm search
another dia object in the graph which is connected with the first
object. The application in this case is for diagram flow. Now I detecte
the start and the "end object" with theirs names.
I use also this algorithm for detecting the others branches along the
main path (begin obj -> end obj) which theirs have no "end obj".

This is an idea that I experiment and i hope to give you a satisfying
explanation.

Lidiriel.


 

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



PropDescription & extradata

2006-08-22 Thread lidiriel
Hi,

in the PropDescription structure can i put a gpointer as extradata ?
exemple :
GList *foo;

and in the table :
static PropDescription bar[] = {
...,
{ "fooValue", PROP_TYPE_STRINGLIST, PROP_FLAG_VISIBLE, N_("string
list"), NULL, foo},
...
} 

and the foo pointer will be modify in the update_object function.

And how i made this ?? because the now i have an error "initializer
element is not constant"
Have you any idea ?


Lidiriel.


___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia



Re: PropDescription & extradata

2006-08-24 Thread lidiriel
Ok with the adress of Glist pointer it's work.
On Wed, 2006-08-23 at 16:43 +0200, ludovic mercier wrote:
> Le mardi 22 août 2006 à 17:48 +0200, Lars Clausen a écrit :
> > On Tue, 2006-08-22 at 17:20 +0200, lidiriel wrote:
> > > Hi,
> > > 
> > > in the PropDescription structure can i put a gpointer as extradata ?
> > > exemple :
> > >   GList *foo;
> > > 
> > > and in the table :
> > > static PropDescription bar[] = {
> > > ...,
> > >   { "fooValue", PROP_TYPE_STRINGLIST, PROP_FLAG_VISIBLE, N_("string
> > > list"), NULL, foo},
> > > ...
> > > } 
> > > 
> > > and the foo pointer will be modify in the update_object function.
> > > 
> > > And how i made this ?? because the now i have an error "initializer
> > > element is not constant"
> > > Have you any idea ?
> > 
> > The initialization of bar is static, and so all its values must be
> > static, but foo is not initialized statically.  You could go in in the
> > class init section and replace the extradata value.
> > 
> > -Lars
> Ok but if i write all data static : foo, bar i have already the error
> initializer is not constant
> In fact i don't make to pass a GList pointer in the PropDescription ! It
> is possible to make it ?
> 
> Lidiriel
> 
> 
> ___
> Dia-list mailing list
> Dia-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/dia-list
> FAQ at http://www.gnome.org/projects/dia/faq.html
> Main page at http://www.gnome.org/projects/dia
> 

___
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia