]> granicus.if.org Git - graphviz/commitdiff
2 new files added beacon.h beacon.c
authorarif <devnull@localhost>
Wed, 15 Oct 2008 21:39:25 +0000 (21:39 +0000)
committerarif <devnull@localhost>
Wed, 15 Oct 2008 21:39:25 +0000 (21:39 +0000)
still working on info boxes,

cmd/smyrna/draw.c
cmd/smyrna/draw.h
cmd/smyrna/glmotion.c
cmd/smyrna/gltemplate.c
cmd/smyrna/gui/Makefile.am
cmd/smyrna/gui/toolboxcallbacks.c
cmd/smyrna/gui/toolboxcallbacks.h
cmd/smyrna/smyrnadefs.h
cmd/smyrna/viewport.c

index bdf0baeaf1a88eeafbfe3d0ad122541702705335..1646e169444bbb6389087fd94e8bd4837058ac15 100755 (executable)
@@ -781,56 +781,74 @@ void drawEllipse(float xradius, float yradius,int angle1,int angle2)
  
    glEnd();
 }
-int draw_node_hintbox_gl_polygon(GLfloat x,GLfloat y,GLfloat fs,GLfloat pad,GLfloat z,GLfloat kts)
-{
-       float w;
-       kts=kts*(GLfloat)1.15;
-       w=fs*kts+2*pad;
-       glBegin(GL_POLYGON);    //big rectangle
-       glVertex3f(x-w/(GLfloat)2.0 , y+fs ,z);
-       glVertex3f(x-w/(GLfloat)2.0 ,y+2*fs+2*pad,z);
-       glVertex3f(x+w/(GLfloat)2.0,y+2*fs+2*pad,z);
-       glVertex3f(x+w/(GLfloat)2.0,y+fs,z);
-       glVertex3f(x-w/(GLfloat)2.0 , y+fs ,z);
-       glEnd();
+int draw_node_hintbox_gl_polygon(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text)
+{
 
-       glBegin(GL_POLYGON);    //litle triangle
-       glVertex3f(x,y,z);
-       glVertex3f(x-(fs/3) , y+fs ,z);
-       glVertex3f(x+fs/3,y+fs,z);
-       glVertex3f(x,y,z);
+       float X,Y,Z,pad;
+       pad=fs/5.0;
+       X=x;Y=y+fs;Z=z;
+       glBegin(GL_POLYGON);
+       //rectangle
+       glVertex3f(X,Y,Z);
+       Y=Y + 2*fs+2*pad;
+       glVertex3f(X,Y,Z);
+       X=X+2*pad+strlen(text)*fs;
+       glVertex3f(X,Y,Z);
+       Y=y+fs;
+       glVertex3f(X,Y,Z);
+       X=x;
+       glVertex3f(X,Y,Z);
+       //triangle
+       glEnd();
+       X=x;Y=y;
+       glBegin(GL_POLYGON);
+       glVertex3f(X,Y,Z);
+       Y=Y + fs;
+       glVertex3f(X,Y,Z);
+       X=X+2*pad;
+       glVertex3f(X,Y,Z);
+       X=x;Y=y;
+       glVertex3f(X,Y,Z);
        glEnd();
+
        return 1;
 
 }
-int draw_node_hintbox_gl_line(GLfloat x,GLfloat y,GLfloat fs,GLfloat pad,GLfloat z,GLfloat kts)
+int draw_node_hintbox_gl_line(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text)
 {
-       float w;
-       kts=kts*(GLfloat)1.15;
-       w=fs*kts+(GLfloat)2*pad;
 
+
+       float X,Y,Z,pad;
+       pad=fs/5.0;
+       X=x;Y=y;Z=z+0.001;
        glBegin(GL_LINE_STRIP);
-       glVertex3f(x,y,z);
-       glVertex3f(x-(fs/(GLfloat)3) , y+fs ,z);
-       glVertex3f(x-w/(GLfloat)2.0 , y+fs ,z);
-       glVertex3f(x-w/(GLfloat)2.0 ,y+2*fs+2*pad,z);
-       glVertex3f(x+w/(GLfloat)2.0,y+2*fs+2*pad,z);
-       glVertex3f(x+w/(GLfloat)2.0,y+fs,z);
-       glVertex3f(x+fs/(GLfloat)3,y+fs,z);
-       glVertex3f(x,y,z);
+       glVertex3f(X,Y,Z);
+       Y=Y + 2*fs+2*pad;
+       glVertex3f(X,Y,Z);
+       X=X+2*pad+strlen(text)*fs;
+       glVertex3f(X,Y,Z);
+       Y=y+fs;
+       glVertex3f(X,Y,Z);
+       X=x+fs;
+       glVertex3f(X,Y,Z);
+       X=x;Y=y;
+       glVertex3f(X,Y,Z);
        glEnd();
+
+
+
        return 1;
 
 }
 
 
-int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat fs,GLfloat pad,GLfloat z,GLfloat kts,GLfloat z_offset)
+int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text)
 {
        
        glColor3f(1,1,0);
-               draw_node_hintbox_gl_polygon(x,y,fs,pad,z+(GLfloat)z_offset/100,kts);
+               draw_node_hintbox_gl_polygon(x,y,z,fs,text);
        glColor3f(0,0,1);
-               draw_node_hintbox_gl_line(x,y,fs,pad,z+(GLfloat)0.001+(GLfloat)z_offset/100,kts);
+               draw_node_hintbox_gl_line(x,y,z,fs,text);
        return 1;
 
 }
index b2a883364d01b44dc96c9b0b5a84cb008914d6f1..8a0d96f7fec2eede9f2da1af0cdfe6b32386824d 100755 (executable)
@@ -43,7 +43,7 @@ extern void drawCircle(float x, float y, float radius, float zdepth);
 extern RGBColor GetRGBColor(char *color);
 extern void drawBorders(ViewInfo * view);
 void drawEllipse(float xradius, float yradius,int angle1,int angle2);
-int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat fs,GLfloat pad,GLfloat z,GLfloat kts,GLfloat z_offset);
+int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text);
 
 void draw_sphere(float x,float y,float z,float r);
 
index 05e5599330253adb6ebfd0c3a182b5b458d74412..c3c94e810e8e27f3bef76b50df73ae50614c6971 100644 (file)
@@ -13,6 +13,7 @@ int glmotion_main(ViewInfo * v,GdkEventMotion * event,GtkWidget * widget)
 {
        
        redraw = FALSE;
+       view->FontSizeConst=GetOGLDistance(14);
        /*panning */
     if ((event->state & GDK_BUTTON1_MASK)&& (v->mouse.mouse_mode == MM_PAN))
                glmotion_pan(v);
index 0c1f69feaa8dff5b074242f9603b30c6a3e7175f..b1d13af89a7600ad474c0c7ede2fa5b6a3e755f7 100755 (executable)
@@ -400,6 +400,8 @@ static gboolean motion_notify_event(GtkWidget * widget,
     if ((event->state & GDK_BUTTON1_MASK)
        && (view->mouse.mouse_mode == MM_ZOOM))
        {
+               view->FontSizeConst=GetOGLDistance(14);
+
                if (glmotion_main(view, event, widget))
                    redraw = TRUE;
        }
index 331a1f8e6cb9aa41f7ec117b4f1b06ab3816b759..cf550f073be0a79280b177f2978c7545eaf37136 100644 (file)
@@ -19,9 +19,9 @@ AM_CPPFLAGS = \
 
 if WITH_SMYRNA
 noinst_HEADERS = callbacks.h datalistcallbacks.h filterscallbacks.h gui.h \
-       menucallbacks.h toolboxcallbacks.h
+       menucallbacks.h toolboxcallbacks.h beacon.h
 noinst_LTLIBRARIES = libgui_C.la
 endif
 
 libgui_C_la_SOURCES = callbacks.c datalistcallbacks.c filterscallbacks.c \
-       gui.c menucallbacks.c toolboxcallbacks.c
+       gui.c menucallbacks.c toolboxcallbacks.c beacon.c
index 876a75ca7079320361fea4b8dc85e8085912a791..07df234ca18e63787bc48c0437b123d574cf9961 100755 (executable)
@@ -87,7 +87,8 @@ void btnToolZoomFit_clicked(GtkWidget * widget, gpointer user_data)
 {
 
        float scx,scy,gcx,gcy,z,GDX,SDX,GDY,SDY;
-
+       GtkTextBuffer *a;
+       char* test;
        (view->active_camera >=0)
                        ? (z=view->cameras[view->active_camera]->r):(z=view->zoom*-1);
 
@@ -110,8 +111,7 @@ void btnToolZoomFit_clicked(GtkWidget * widget, gpointer user_data)
 
        }
        btnToolFit_clicked(NULL,NULL);
-//    xml = glade_xml_new(SMYRNA_GLADE, NULL, NULL);
-       gtk_widget_hide (glade_xml_get_widget(xml, "consoleText"));
+       write_to_console("test entry\n");
 }
 
 void btnToolFit_clicked(GtkWidget * widget, gpointer user_data)
@@ -187,3 +187,14 @@ void btnToolDeleteEdge_clicked(GtkWidget * widget, gpointer user_data)
 void btnToolFindEdge_clicked(GtkWidget * widget, gpointer user_data)
 {
 }
+
+int write_to_console(char* text)
+{
+       //init console text
+       GtkTextIter iter;
+       if(!view->consoleText)
+               view->consoleText=gtk_text_buffer_new(NULL);
+       gtk_text_buffer_get_end_iter(view->consoleText,&iter);
+       gtk_text_buffer_insert (view->consoleText,&iter,text,-1);
+       gtk_text_view_set_buffer ((GtkTextView*)glade_xml_get_widget(xml, "consoleText"),view->consoleText);
+}
index 65a62cc71c6be1a3b87493cb37d48a9f9947c5b0..074998e1bf1bd9192eff80e4e732fea796c227f5 100755 (executable)
@@ -49,7 +49,7 @@ _BB void btnToolFindNode_clicked(GtkWidget * widget, gpointer user_data);
 _BB void btnToolAddEdge_clicked(GtkWidget * widget, gpointer user_data);
 _BB void btnToolDeleteEdge_clicked(GtkWidget * widget, gpointer user_data);
 _BB void btnToolFindEdge_clicked(GtkWidget * widget, gpointer user_data);
-
+int write_to_console(char* text);
 
 
 #endif
index 209f788beed8b3aef493d3ac6b95c78ddc764984..baa9d22016ba961fd319488dd28db28e065509e4 100644 (file)
@@ -489,6 +489,7 @@ typedef struct _ViewInfo
        viewtype_t dfltViewType;
        gvk_layout dfltEngine;
        GtkTextBuffer* consoleText;
+       int FontSizeConst;
 } ViewInfo;
 
 extern ViewInfo *view;
index be135c1d1ae6283879d0902bc42f449f83b9ed90..8bbdd6a31f2ec7dce8d4cd0c4ac6b6460bcea4f4 100755 (executable)
@@ -257,7 +257,7 @@ there i go, turn the page
        atoi(get_attribute_value ("drawedges", view, g));
     view->drawlabels=
        atoi(get_attribute_value ("drawlabels", view, g));
-
+       view->FontSizeConst=0; //this will be calculated later in topview.c while calculating optimum font size
 
 //FIXME: I don't think an openGL function can be called before it
   //     is initialized.
@@ -270,8 +270,7 @@ void init_viewport(ViewInfo * view)
 {
     char *template_file;
     FILE *input_file;
-       GtkTextBuffer *a;
-       char* test;
+
 
 
     /*loading default visual attributes */
@@ -291,14 +290,6 @@ void init_viewport(ViewInfo * view)
 #ifndef _WIN32
     free (template_file);
 #endif
-       //init console text
-    xml = glade_xml_new(smyrnaGlade, NULL, NULL);
-       gtk_widget_hide (glade_xml_get_widget(xml, "consoleText"));
-       view->consoleText=gtk_text_buffer_new(NULL);
-       gtk_text_buffer_set_text (view->consoleText,"Smyrna console is initialized:\n",-1);
-       a=gtk_text_view_get_buffer((GtkTextView*)glade_xml_get_widget(xml, "consoleText"));
-       test=gtk_text_buffer_get_text  (a,0,5,1);
-       gtk_text_view_set_buffer ((GtkTextView*)glade_xml_get_widget(xml, "consoleText"),view->consoleText);
        //init graphs
     view->g = NULL;            //no graph, gl screen should check it
     view->graphCount = 0;      //and disable interactivity if count is zero