CONNECTIONS INFORMATION



Title: Mensaje
Good morning all,
 
    a previous request in earlier e-mails from me was that once the user has inserted an object into the canvas there is no difference between the connections but the visual position. For some plug-ins would be interesting that when the user places the pointer over a connection a brief description or keyword appears showing information. I have found one option for dia developers to be considered in following versions. Perhaps a different alternative would be much better. Anyway, I would like to ask you to include this feature in following versions.
 
    The following solution is based on dia0.95-pre-3 and I have tested it works. The structure ConnectionPoint in file connection.h has a field gchar* name which is not commonly used. The idea is that the plug-in fills that name and it is showed to the user in the status bar when the pointer is closed to the connection. For that purpose a few modifications should be done in file disp_callbacks.c. In function gint ddisplay_canvas_events (GtkWidget *canvas, GdkEvent  *event, DDisplay *ddisp) three new variables have to be declared:
 
  ConnectionPoint *conn;
  GtkStatusbar       *statusbar;
  guint                   context_id;
and the event for the mouse motion within this function woul be like this:
 
    case GDK_MOTION_NOTIFY:
             
        /*  get the pointer position  */
        gdk_window_get_pointer (canvas->window, &tx, &ty, &tmask);
 
        
        /******************************************************************************************
        BEGIN OF ADDED CODE
        ******************************************************************************************/
        /*Sends information to status bar if near to connection*/
        statusbar = GTK_STATUSBAR (ddisp->modified_status);
        context_id = gtk_statusbar_get_context_id (statusbar, "CONN"); 
        ddisplay_untransform_coords(ddisp, tx, ty, &middle.x, &middle.y);
        if((conn=object_find_connectpoint_display(ddisp, &middle,NULL, FALSE))){
           gtk_statusbar_pop (statusbar, context_id);
           if (conn->name)
               gtk_statusbar_push (statusbar, context_id, conn->name);
        }else
            gtk_statusbar_pop (statusbar, context_id); 
        /******************************************************************************************
        END OF ADDED CODE
        ******************************************************************************************/
 
        mevent = (GdkEventMotion *) event;
        state = mevent->state;
 
        if (mevent->is_hint) {
          mevent->x = tx;
          mevent->y = ty;
          mevent->state = tmask;
          mevent->is_hint = FALSE;
        }
        if (transient_tool && (*transient_tool->motion_func))
          (*transient_tool->motion_func) (transient_tool, mevent, ddisp);
        else if (active_tool->motion_func)
          (*active_tool->motion_func) (active_tool, mevent, ddisp);
        break;
 
Looking forward to an answer to this proposal.
 
Best regards

________________________________________________

Saludos/Regards
Oscar Córdoba Muñoz
ITP Performance Team
Tel +34 91 2079437

Fax +34 91 6764676

________________________________________________

 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]