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;
}
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);
{
redraw = FALSE;
+ view->FontSizeConst=GetOGLDistance(14);
/*panning */
if ((event->state & GDK_BUTTON1_MASK)&& (v->mouse.mouse_mode == MM_PAN))
glmotion_pan(v);
if ((event->state & GDK_BUTTON1_MASK)
&& (view->mouse.mouse_mode == MM_ZOOM))
{
+ view->FontSizeConst=GetOGLDistance(14);
+
if (glmotion_main(view, event, widget))
redraw = TRUE;
}
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
{
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);
}
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)
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);
+}
_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
viewtype_t dfltViewType;
gvk_layout dfltEngine;
GtkTextBuffer* consoleText;
+ int FontSizeConst;
} ViewInfo;
extern ViewInfo *view;
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.
{
char *template_file;
FILE *input_file;
- GtkTextBuffer *a;
- char* test;
+
/*loading default visual attributes */
#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