]> granicus.if.org Git - graphviz/commitdiff
smyrna changes
authorarif <devnull@localhost>
Thu, 8 Oct 2009 18:31:43 +0000 (18:31 +0000)
committerarif <devnull@localhost>
Thu, 8 Oct 2009 18:31:43 +0000 (18:31 +0000)
37 files changed:
cmd/smyrna/Makefile.am
cmd/smyrna/draw.c
cmd/smyrna/glexpose.c
cmd/smyrna/glmotion.c
cmd/smyrna/gltemplate.c
cmd/smyrna/gui/beacon.c
cmd/smyrna/gui/gui.c
cmd/smyrna/main.c
cmd/smyrna/smyrna.vcproj
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topfisheyeview.c
cmd/smyrna/topview.c
cmd/smyrna/viewport.c
cmd/smyrna/viewportcamera.c
cmd/smyrna/viewportcamera.h
cmd/tools/gxl2gv.vcproj
lib/common/utils.c
lib/glcomp/Makefile.am
lib/glcomp/glcomp.vcproj
lib/glcomp/glcompbutton.c
lib/glcomp/glcompbutton.h
lib/glcomp/glcompdefs.h
lib/glcomp/glcomplabel.c
lib/glcomp/glcomplabel.h
lib/glcomp/glcomppanel.c
lib/glcomp/glcomppanel.h
lib/glcomp/glcompset.c
lib/glcomp/glcompset.h
lib/glcomp/glcomptext.h
lib/glcomp/glcomptextpng.c
lib/glcomp/glcomptexture.c
lib/glcomp/glcomptexture.h
lib/glcomp/glpangofont.c
lib/glcomp/glpangofont.h
lib/glcomp/glutils.c
lib/glcomp/glutils.h
lib/gvc.def

index 6ce75eef99ad5a3daeb77bd43c8a86c093e12f34..2df32d1d3dd143285fbad000c6eadcc64f4763bd 100644 (file)
@@ -30,14 +30,14 @@ noinst_HEADERS = btree.h draw.h filter.h glexpose.h glmotion.h gltemplate.h \
        topfisheyeview.h viewportcamera.h gvprpipe.h \
        gui/callbacks.h gui/datalistcallbacks.h gui/filterscallbacks.h \
        gui/glmenu.h gui/gui.h gui/menucallbacks.h gui/toolboxcallbacks.h md5.h \
-       gui/topviewsettings.h gui/beacon.h drawxdot.h arcball.h
+       gui/topviewsettings.h gui/beacon.h drawxdot.h arcball.h gui/glcompui.h
 
 smyrna_SOURCES = btree.c draw.c filter.c glexpose.c glmotion.c gltemplate.c \
        hier.c main.c selection.c support.c template.c topview.c topviewdata.c \
        topfisheyeview.c trackball.c tvnodes.c viewport.c viewportcamera.c \
     gvprpipe.c gui/beacon.c gui/callbacks.c gui/datalistcallbacks.c \
     gui/filterscallbacks.c gui/glmenu.c gui/gui.c gui/menucallbacks.c \
-    gui/toolboxcallbacks.c gui/topviewsettings.c md5.c drawxdot.c arcball.c
+    gui/toolboxcallbacks.c gui/topviewsettings.c md5.c drawxdot.c arcball.c gui/glcompui.c
 
 smyrna_LDADD = $(top_builddir)/lib/cgraph/libcgraph_C.la \
                $(top_builddir)/lib/cdt/libcdt_C.la \
index 008ea9fd390e279937fc09b95b7f6c7145c54370..b285e066ee29a7f90c051941f8a6e9b65cdf2029 100755 (executable)
@@ -323,7 +323,6 @@ void DrawEllipse(xdot_op * op, int param)
        filled = 0;
     }
 
-    glLineWidth(view->LineWidth);
     if (!filled)
        glBegin(GL_LINE_LOOP);
     else
@@ -464,7 +463,8 @@ void InsertImage(xdot_op * op, int param)
 }
 void EmbedText(xdot_op * op, int param)
 {
-    GLfloat x;
+#ifdef UNUSED
+       GLfloat x;
 //    SelectText((sdot_op *) op);
     set_options((sdot_op *) op, param);
     if (op->u.text.align == 1)
@@ -481,6 +481,7 @@ void EmbedText(xdot_op * op, int param)
                  view->selectedNodeColor.B,1);
        glprintf(view->widgets->fontset->fonts[view->widgets->fontset->activefont], (x - dx), (GLfloat)op->u.text.y -  dy,(GLfloat)0,
                   (GLfloat)op->u.text.width, op->u.text.text);
+#endif
 }
 
 void draw_selection_box(ViewInfo * view)
@@ -745,7 +746,7 @@ static void scanXdot(xdot * xDot, void *p)
                op->obj = p;
                if (op->op.kind==xd_font)
                {
-                       add_font(view->widgets->fontset,op->op.u.font.name);//load or set active font
+//                     add_font(view->widgets->fontset,op->op.u.font.name,op->op.u.font.size);//load or set active font
                }
     }
 
index 5d73156b058258032370678637787271f2123810..0c28edddd8917133f77ec2fcbdff84aece20b654 100644 (file)
@@ -19,7 +19,6 @@
 #include "glutils.h"
 #include "topview.h"
 #include "topfisheyeview.h"
-#include "glcomptext.h"
 #include "gui/toolboxcallbacks.h"
 void drawRotatingAxis(void);
 void draw_cube()
@@ -59,6 +58,56 @@ glBegin(GL_QUADS);           // Draw The Cube Using quads
   glEnd();     
 }
 
+
+
+void drawRotatingAxis(void)
+{
+       float x,y;
+       float x1,y1,z1;
+       float x2,y2,z2;
+       float R1,R2;
+       static GLUquadricObj *quadratic=(GLUquadricObj*)0;
+       if (!quadratic)
+       {
+               quadratic=gluNewQuadric();                                                                              // Create A Pointer To The Quadric Object
+               gluQuadricNormals(quadratic, GLU_SMOOTH);                                               // Create Smooth Normals
+//             gluQuadricTexture(quadratic, GL_TRUE);                                                  // Create Texture Coords
+               gluQuadricDrawStyle (quadratic,GLU_LINE);
+
+
+       }
+
+       if ((view->mouse.mouse_mode == MM_ROTATE) && (view->active_camera >=0))
+       {
+               float AL=45;
+               glPushMatrix();
+               glLoadIdentity();
+               glMultMatrixf(view->arcball->Transform.M); /*arcball transformations , experimental*/
+               glLineWidth(3);
+               glBegin(GL_LINES);
+                       glColor3f(1,1,0);
+       
+                       glVertex3f(0,0,0);
+                       glVertex3f(0,AL,0);
+
+                       glVertex3f(0,0,0);
+                       glVertex3f(AL,0,0);
+
+                       glVertex3f(0,0,0);
+                       glVertex3f(0,0,AL);
+
+               glEnd();
+               glColor4f(0,1,0,0.3);
+               gluSphere(quadratic,AL,20,20);
+               glLineWidth(1);
+               glPopMatrix();
+
+       }
+
+}
+
+
+
 /*
        refreshes camera settings using view parameters such as pan zoom etc
        if a camera is selected viewport is switched to 3D
@@ -67,28 +116,22 @@ glBegin(GL_QUADS);         // Draw The Cube Using quads
 */
 int glupdatecamera(ViewInfo * view)
 {
-
        if (view->active_camera==-1)
-       {
-               gluLookAt(view->panx, view->pany, 20, view->panx,
-                       view->pany, 0.0, 0.0, 1.0, 0.0);
-       }
+               glTranslatef(-view->panx,-view->pany,view->panz);
 
 
        /*toggle to active camera*/
        else
        {
                glMultMatrixf(view->arcball->Transform.M); /*arcball transformations , experimental*/
-/*             gluLookAt(view->cameras[view->active_camera]->targetx, view->cameras[view->active_camera]->targety, 20, view->cameras[view->active_camera]->targetx,
-               view->cameras[view->active_camera]->targety, 0.0, 0.0, 1.0, 0.0);*/
                glTranslatef(-view->cameras[view->active_camera]->targetx,-view->cameras[view->active_camera]->targety,0);
-//             printf(" %f %f %f \n",view->panx,view->pany,view->
        }
 
        GetOGLPosRef(1, view->h - 5, &(view->clipX1), &(view->clipY1),
                 &(view->clipZ1));
     GetOGLPosRef(view->w - 1, 1, &(view->clipX2), &(view->clipY2),
                 &(view->clipZ2));
+
        if (view->active_camera==-1)
        {
                glScalef(1/view->zoom*-1,1/view->zoom*-1,1/view->zoom*-1);
@@ -96,9 +139,9 @@ int glupdatecamera(ViewInfo * view)
        else
        {
                glScalef(1/view->cameras[view->active_camera]->r,1/view->cameras[view->active_camera]->r,1/view->cameras[view->active_camera]->r);
-
        }
 
+
        return 1;
 }
 
@@ -169,13 +212,15 @@ void drawtestpoly(void)
        glEnable(GL_TEXTURE_2D);
        glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 //     glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE , GL_DECAL);
-       glBindTexture(GL_TEXTURE_2D,view->widgets->fontset->fonts[view->widgets->fontset->activefont]->texId);
-       glColor3f(1,0,0);
-       glBegin(GL_POLYGON);
+//     glBindTexture(GL_TEXTURE_2D,view->widgets->fontset->fonts[view->widgets->fontset->activefont]->texId);
+       glBindTexture(GL_TEXTURE_2D,1);
+       glColor4f(1,1,1,1);
+       glBegin(GL_QUADS);
                glTexCoord2f(0.0,0.0);glVertex3f(0.0,0.0,0.0);
                glTexCoord2f(0.0,1.0);glVertex3f(0.0,256.0,0.0);
                glTexCoord2f(1.0,1.0);glVertex3f(256.0,256.0,0.0);
                glTexCoord2f(1.0,0.0);glVertex3f(256.0,0.0,0.0);
+               glTexCoord2f(0.0,0.0);glVertex3f(0.0,0.0,0.0);
        glEnd();
        glDisable(GL_TEXTURE_2D);
 
@@ -229,52 +274,6 @@ int glexpose_drawgraph(ViewInfo * view)
        return 0;
 }
 
-void drawRotatingAxis(void)
-{
-       float x,y;
-       float x1,y1,z1;
-       float x2,y2,z2;
-       float R1,R2;
-       static GLUquadricObj *quadratic=(GLUquadricObj*)0;
-       if (!quadratic)
-       {
-               quadratic=gluNewQuadric();                                                                              // Create A Pointer To The Quadric Object
-               gluQuadricNormals(quadratic, GLU_SMOOTH);                                               // Create Smooth Normals
-//             gluQuadricTexture(quadratic, GL_TRUE);                                                  // Create Texture Coords
-               gluQuadricDrawStyle (quadratic,GLU_LINE);
-
-
-       }
-
-       if ((view->mouse.mouse_mode == MM_ROTATE) && (view->active_camera >=0))
-       {
-               float AL=45;
-               glPushMatrix();
-               glLoadIdentity();
-               glMultMatrixf(view->arcball->Transform.M); /*arcball transformations , experimental*/
-               glLineWidth(3);
-               glBegin(GL_LINES);
-                       glColor3f(1,1,0);
-       
-                       glVertex3f(0,0,0);
-                       glVertex3f(0,AL,0);
-
-                       glVertex3f(0,0,0);
-                       glVertex3f(AL,0,0);
-
-                       glVertex3f(0,0,0);
-                       glVertex3f(0,0,AL);
-
-               glEnd();
-               glColor4f(0,1,0,0.3);
-               gluSphere(quadratic,AL,20,20);
-               glLineWidth(1);
-               glPopMatrix();
-
-       }
-
-}
-
 
 void drawRotatingTools(void)
 {
index 275b964a08f95f8188c00e79623b7bbcd4e062da..cf589b46b193bcf49312b2b6a5facbdbbde5cdd6 100644 (file)
@@ -82,7 +82,7 @@ void glmotion_zoom_inc(int zoomin)
        glexpose();
 
 }
-/*real zoom in out is done here, all other functions send this one what they desired, it is not guranteed,*/
+/*real zoom in out is done here, all other functions send this one what they desire, it is not guranteed,*/
 void graph_zoom(float real_zoom)
 {
        float old_zoom;
index 0ea573cd7c4c3fede44b2d6f0c564dd3e904345e..e3aa4e2a14fa6796d2b15e66ea443ec10f1a4191 100755 (executable)
@@ -36,6 +36,20 @@ static float begin_y = 0.0;
 static float dx = 0.0;
 static float dy = 0.0;
 
+/*mouse mode mapping funvtion from gtk to glcomp*/
+static glMouseButtonType getGlCompMouseType(int n)
+{
+       switch (n)
+       {
+               case 1:
+                         return glMouseLeftButton;
+               case 3:
+                         return glMouseRightButton;
+       }
+}
+
+
+
 /*
        test opengl parameters, configuration.Run this function to see machine's open gl capabilities
        params:gtk gl config class ,gtk takes care of all these tests
@@ -134,11 +148,6 @@ static void realize(GtkWidget * widget, gpointer data)
 
     static char *smyrna_font;
 
-#ifdef WIN32
-    smyrna_font = "c:/pango_font.tga";
-#else
-    smyrna_font = smyrnaPath("arial.tga");
-#endif
 
        /*** OpenGL BEGIN ***/
     if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
@@ -257,23 +266,6 @@ gboolean expose_event(GtkWidget * widget, GdkEventExpose * event,
        return TRUE;
 }
 
-#ifdef UNUSED
-static gboolean key_release_event(GtkWidget * widget,
-                                    GdkEventButton * event, gpointer data)
-{
-       printf ("a key is released\n");
-
-}
-
-static gboolean key_press_event(GtkWidget * widget, GdkEventKey * event,
-                               gpointer data)
-{
-       printf ("a key is pressed\n");
-
-}
-#endif
-
-
 /*
        when a mouse button is clicked this function is called
        params:gtk opgn gl canvas , GdkEventButton object and custom data
@@ -282,15 +274,10 @@ static gboolean key_press_event(GtkWidget * widget, GdkEventKey * event,
 static gboolean button_press_event(GtkWidget * widget,
                                   GdkEventButton * event, gpointer data)
 {
-       if (view->graphCount)
-       {
-               if (glCompSetClick(view->widgets, (int) event->x, (int) event->y))
-           expose_event(view->drawing_area, NULL, NULL);
-    }
-
     begin_x = (float) event->x;
     begin_y = (float) event->y;
-       //update mouse coordinates of view if there is left or right click
+       view->widgets->common.functions.mousedown(view->widgets,(GLfloat)event->x,(GLfloat)event->y,getGlCompMouseType(event->button));
+
        if ((event->button == 1) || (event->button == 3))
        {
                GetOGLPosRef    ((int) begin_x, (int) begin_y, &(view->GLx), &(view->GLy),&(view->GLz));
@@ -319,7 +306,8 @@ static gboolean button_press_event(GtkWidget * widget,
                        expose_event(view->drawing_area, NULL, NULL);
                }
     }
-       /*experimental code for arcball, init first click */
+       expose_event(view->drawing_area, NULL, NULL);
+
     return FALSE;
 }
 
@@ -333,14 +321,12 @@ static gboolean button_release_event(GtkWidget * widget,
 {
        view->FontSizeConst=GetOGLDistance(14);
        view->arcball->isDragging=0;
+       view->widgets->common.functions.mouseup(view->widgets,(GLfloat)event->x,(GLfloat)event->y,getGlCompMouseType(event->button));
+
 
        if (event->button == 1) //left click release
     {
-               if (glCompSetRelease(view->widgets, (int) event->x_root,(int) event->y_root))           
-               {
-                        expose_event(view->drawing_area, NULL, NULL);  
-               }
-               view->mouse.mouse_down = 0;
+               view->mouse.mouse_down = 0;
                if ((view->mouse.mouse_mode == MM_RECTANGULAR_SELECT)
                        || (view->mouse.mouse_mode == MM_RECTANGULAR_X_SELECT)) 
                {
@@ -431,9 +417,12 @@ static gboolean motion_notify_event(GtkWidget * widget,
     /* float h = (float)widget->allocation.height; */
     float x = (float) event->x;
     float y = (float) event->y;
+    gboolean redraw = FALSE;
+
+       view->widgets->common.functions.mouseover(view->widgets,(GLfloat)x,(GLfloat)y);
+
        
 
-    gboolean redraw = FALSE;
 
        dx = x - begin_x;
     dy = y - begin_y;
index d0842775012f21479123f07192107088a832f0fb..4e7a5d81c53f43ff3dcfa679d09a1549e3a1d27e 100644 (file)
@@ -234,7 +234,7 @@ int draw_node_hint_boxes(void)
     double dx, dy, dz;
        char buf[512];  /* FIX!!! static buffer */
 
-    view->widgets->fontset->fonts[view->widgets->fontset->activefont]->fontheight=fs;
+//    view->widgets->fontset->fonts[view->widgets->fontset->activefont]->fontheight=fs;
 
 
        for (ind = 0; ind < view->Topview->picked_node_count; ind++) 
@@ -285,8 +285,8 @@ int draw_node_hint_boxes(void)
 #endif
 
     }
-       glLineWidth(5);
        glColor4f(0, 1, 0, 0.5);
+       glLineWidth(2);
        glBegin(GL_LINES);
        for (ind = 0; ind < view->Topview->picked_edge_count; ind++) 
        {
@@ -310,8 +310,7 @@ int draw_node_hint_boxes(void)
 
     }
        glEnd();
-       glLineWidth(0);
-
+       glLineWidth(1);
        for (ind = 0; ind < view->Topview->picked_edge_count; ind++) {
                float x1,x2,y1,y2,z1,z2;
                char* s;
index fd7e67e996188237e9e9fb408355ecc8e2c1069f..8d0002d63a63c5d53e16e3444d589d0ff35f141f 100755 (executable)
@@ -311,11 +311,7 @@ void load_attributes(void)
     static char* smyrna_attrs;
 
     if (!smyrna_attrs) {
-#if WIN32
-       smyrna_attrs = SMYRNA_ATTRS;
-#else
        smyrna_attrs = smyrnaPath ("attrs.txt");
-#endif
     }
 
     //loads attributes from a text file
index 0d1911682d57a5796a2b2d289aa6494bcc5201fa..2e150faa694670846502f5911cf514e1c693468a 100755 (executable)
@@ -67,18 +67,12 @@ unsigned char SmyrnaVerbose;
 char*
 smyrnaPath (char* suffix)
 {
-    char* buf;
-#ifdef _WIN32
+       static char* buf[1024];
     char* pathSep = "\\";
-#else
-
-    assert (smyrnaDir);
-    char* pathSep = "/";
-#endif
-
-    buf = N_NEW(strlen(smyrnaDir)+strlen(suffix)+2,char);
+       assert (smyrnaDir);
+       if ((strlen(smyrnaDir)+strlen(suffix)+ strlen(suffix) + 2) > 512)
+               return NULL;
     sprintf (buf, "%s%s%s", smyrnaDir, pathSep, suffix);
-
     return buf;
 }
 
@@ -154,9 +148,11 @@ int main(int argc, char *argv[])
     smyrnaDir = getenv ("SMYRNA_PATH");
     if (!smyrnaDir) {
 #ifdef _WIN32
-       int sz = GetCurrentDirectory(0, NULL);
+       int sz = GetCurrentDirectory(0, NULL)+strlen("\\share\\graphviz\\smyrna") + 1;
        smyrnaDir = N_NEW(sz, char);
        GetCurrentDirectory (sz, smyrnaDir);
+       smyrnaDir[strlen(smyrnaDir)-4]=(char)0;
+       strcat(smyrnaDir,"\\share\\graphviz\\smyrna");
 #else
        smyrnaDir = SMYRNA_PATH;
 #endif
@@ -165,12 +161,10 @@ int main(int argc, char *argv[])
     load_attributes();
 
 #ifdef G_OS_WIN32
-    package_prefix =
-       g_win32_get_package_installation_directory(NULL, NULL);
+    package_prefix =g_win32_get_package_installation_directory(NULL, NULL);
     package_data_dir = g_build_filename(package_prefix, "share", NULL);
     package_locale_dir =
        g_build_filename(package_prefix, "share", "locale", NULL);
-    add_pixmap_directory("C:/");
 #else
     package_locale_dir = g_build_filename(smyrnaDir, "locale", NULL);
 #endif /* # */
@@ -185,17 +179,8 @@ int main(int argc, char *argv[])
     gtk_set_locale();
     gtk_init(&argc, &argv);
     initFileName = parseArgs (argc, argv, view);
-
-#ifdef _WIN32
-#define GTKTOPVIEW_ICONSDIR "C:\\Projects\\ATT\\GTK\\GTKTest2\\GUI\\images\\"
-#endif
-    if (!(smyrnaGlade)) {
-#ifdef _WIN32
-       smyrnaGlade = view->glade_file;
-#else
-       smyrnaGlade = smyrnaPath ("smyrna.glade");
-#endif
-    }
+    if (!(smyrnaGlade)) 
+               smyrnaGlade = smyrnaPath ("smyrna.glade");
     xml = glade_xml_new(smyrnaGlade, NULL, NULL);
     gladewidget = glade_xml_get_widget(xml, "frmMain");
     gtk_widget_show(gladewidget);
index ed540fcd03899a364a4ceca506f4f529502de231..43b5aea83a022b872a6fb6e01ceb9a6c709f3dcd 100644 (file)
                                RelativePath=".\gui\filterscallbacks.h"
                                >
                        </File>
+                       <File
+                               RelativePath=".\gui\glcompui.h"
+                               >
+                       </File>
                        <File
                                RelativePath=".\glexpose.h"
                                >
                                RelativePath=".\gui\filterscallbacks.c"
                                >
                        </File>
+                       <File
+                               RelativePath=".\gui\glcompui.c"
+                               >
+                       </File>
                        <File
                                RelativePath=".\glexpose.c"
                                >
                                RelativePath=".\selection.c"
                                >
                        </File>
-                       <File
-                               RelativePath=".\support.c"
-                               >
-                       </File>
                        <File
                                RelativePath=".\template.c"
                                >
index 7f349f8b495163563b58b07c528eaed372e21604..0df71c37918e7b8a8fe05832a41473ff57f233ed 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef NO_WIN_HEADER
 #include "windows.h"
 #endif
-//#define       SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
-#define        SMYRNA_ATTRS "c:/graphviz-ms/graphviz2/share/gui/attrs.txt"
 #endif
 #ifdef WIN32                   //this  is needed on WIN32 to get libglade see the callback
 #define _BB  __declspec(dllexport)
index 4551124c11c09bf4beff5233c3ca0595c0d83d2e..ecf9d7f0a91293b49aa9a390e727759fb2890590 100644 (file)
@@ -14,8 +14,8 @@
 **********************************************************/
 #include "topfisheyeview.h"
 
-#include "glcomptext.h"
-#include "glcomptextpng.h"
+//#include "glcomptext.h"
+//#include "glcomptextpng.h"
 #include "math.h"
 #include "memory.h"
 #include "viewport.h"
index 4c7ecd90b5080d75000adea09ada00f1fab8b7e1..fa994668009cbde718501bf6fc1668274aebefa0 100755 (executable)
 *        Information and Software Systems Research        *
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
-#include "glcomptext.h"
-#include "glcomptextpng.h"
-#include "glcompbutton.h"
-#include "glcomppanel.h"
-#include "glcomplabel.h"
+#include "glcompui.h"
 #include "gltemplate.h"
-#include "glutils.h"
 #include "topview.h"
 #include "math.h"
 #include "memory.h"
@@ -34,6 +29,7 @@
 #include "topfisheyeview.h"
 #include "beacon.h"
 #include "pointset.h"
+#include "glpangofont.h"
 #ifdef WIN32
 #include "regex_win32.h"
 #else
@@ -47,43 +43,21 @@ static float dy = 0.0;
 static float dz = 0.0;
 
    /* Forward declarations */
-glCompSet *glcreate_gl_topview_menu(void);
 static void set_boundaries(topview * t);
 static void set_topview_options(void);
 static int draw_topview_label(topview_node * v, float zdepth);
 static int draw_topview_edge_label(topview_edge * e, float zdepth);
 static int node_visible(topview_node* n);
 static int select_topview_node(topview_node * n);
-/* static int select_topview_edge(topview_edge * e); */
-#ifdef UNUSED
-static int update_topview_node_from_cgraph(topview_node * Node);
-#endif
 static int get_color_from_edge(topview_edge * e);
-/* static int pick_node(topview_node * n); */
 static void draw_xdot_set(xdot_set* s);
 static xdot_set* init_xdot_set();
 static void free_xdotset(xdot_set* s);
 static void add_to_xdot_set(xdot_set* s, xdot *x);
 
-#ifdef UNUSED
-static void remove_recs()
-{
-       Agraph_t* g;
-    Agnode_t *v;
-       if(view->activeGraph < 0)
-               return;
-       g=view->g[view->activeGraph];
-       for (v = agfstnode(g); v; v = agnxtnode(g, v)) 
-       {
-               agdelrec(v,"temp_node_record");
-       }
-}
-#endif
 
 void cleartopview(topview * t)
 {
-       /*free attached records*/
-       /*clear nodes */
        free (t->Nodes);
        free (t->Edges);
        free_xdotset(t->xdot_list);
@@ -366,14 +340,13 @@ void update_topview(Agraph_t * g, topview * t,int init)
        info_file=agget(g,"demo_file");
        if ((info_file != NULL) && (strlen(info_file)!=0))
        {
-               int sz;
                agxbuf xbuf;
            agxbinit (&xbuf,512, xbuffer);
 
-               info_file=fopen(info_file,"r");
+               f=fopen(info_file,"r");
                if (info_file)
                {
-                               while (fgets(buf, BUFSIZ, info_file)) 
+                               while (fgets(buf, BUFSIZ, f)) 
                                        agxbput (&xbuf, buf);
                                agxbput (&xbuf, "");
                                str=agxbuse (&xbuf);
@@ -490,6 +463,7 @@ void preparetopview(Agraph_t * g, topview * t)
 
        /*hide stupid console window*/
        gtk_widget_hide(glade_xml_get_widget(xml, "vbox13"));
+       gtk_widget_hide(glade_xml_get_widget(xml, "hbox7"));
 
 
 }
@@ -1001,48 +975,6 @@ static int select_topview_edge(topview_edge * e)
 }
 #endif
 
-#ifdef UNUSED
-static int update_topview_node_from_cgraph(topview_node * Node)
-{
-    char *buf;
-    buf = agget(Node->Node, "color");
-    if (buf)
-       Node->Color = GetRGBColor(buf);
-/*     else
-       {
-               randomize_color(&(Node->Color),2);
-
-               Node->Color.R=view->penColor.R;
-               Node->Color.G=view->penColor.G;
-               Node->Color.B=view->penColor.B;
-               Node->Color.A=view->penColor.A;
-       }*/
-    Node->update_required = 0;
-    return 1;
-}
-#endif
-#ifdef UNUSED
-int update_topview_edge_from_cgraph(topview_edge * Edge)
-{
-    //for now just color , maybe i need more later
-    char buf[124];
-    strcpy(buf,
-          (agget(Edge->Edge, "color") ==
-           NULL) ? "black" : agget(Edge->Edge, "color"));
-    if (strlen(buf) > 0)
-       Edge->Color = GetRGBColor(buf);
-    else {
-       Edge->Color.R = view->penColor.R;
-       Edge->Color.G = view->penColor.G;
-       Edge->Color.B = view->penColor.B;
-       Edge->Color.A = view->penColor.A;
-    }
-    Edge->update_required = 0;
-    return 1;
-}
-#endif
-
-
 
 int set_update_required(topview * t)
 {
@@ -1271,109 +1203,6 @@ int move_TVnodes(void)
 }
 
 
-#ifdef UNUSED
-int load_host_buttons(Agraph_t * g, glCompSet * s)
-{
-    GtkLayout *layout;
-    int btncount = 0;
-    int i = 0;
-    char buf[255];
-    char *str;
-    char hostbtncaption[50];
-    char hostbtnregex[50];
-    char hostbtncolorR[50];
-    char hostbtncolorG[50];
-    char hostbtncolorB[50];
-    char hostbtncolorA[50];
-    int X = 10;
-    int Y = 25;
-    GdkColor color;
-    glCompPanel *p;
-    glCompButton *b;
-
-    layout = glade_xml_get_widget(xml, "frmHostSelectionFixed");
-    str = '\0';
-    str = agget(g, "hostbtncount");
-    if (str)
-       btncount = atoi(str);
-
-//      Graph [hostbtncaption1="AT&T",hostbtnregex1="*.ATT*",hostbtncolorR1="1",hostbtncolorG1="0",hostbtncolorB1="0",hostbtncolorA1="1"];
-
-    hostregex = N_GNEW(btncount, char **);
-    gtkhostbtn = N_GNEW(btncount, GtkButton *);
-    gtkhostcolor = N_GNEW(btncount, GtkColorButton *);
-    gtkhostbtncount = btncount;
-    if (btncount > 0) {
-       p = glCompPanelNew(25, 75, 165, 400);
-       p->data = 2;            //data panel
-       p->color.R = 0.80;
-       p->color.B = 0, 2;
-       glCompSetAddPanel(s, p);
-    }
-    for (i = 0; i < btncount; i++) {
-       sprintf(hostbtncaption, "hostbtncaption%i", i);
-       sprintf(hostbtnregex, "hostbtnregex%i", i);
-       sprintf(hostbtncolorR, "hostbtncolorR%i", i);
-       sprintf(hostbtncolorG, "hostbtncolorG%i", i);
-       sprintf(hostbtncolorB, "hostbtncolorB%i", i);
-       sprintf(hostbtncolorA, "hostbtncolorA%i", i);
-       printf("caption:%s regex:%s Color(%s,%s,%s,%s)\n",
-              agget(g, hostbtncaption),
-              agget(g, hostbtnregex),
-              agget(g, hostbtncolorR),
-              agget(g, hostbtncolorG),
-              agget(g, hostbtncolorB), agget(g, hostbtncolorA));
-       hostregex[i] = agget(g, hostbtnregex);
-
-       b = glCompButtonNew(5, 7 + (i + 1) * 36, 150, 35,
-                           agget(g, hostbtncaption), '\0', 0, 0);
-       b->color.R = atof(agget(g, hostbtncolorR));
-       b->color.G = atof(agget(g, hostbtncolorG));
-       b->color.B = atof(agget(g, hostbtncolorB));
-       b->color.A = 1;
-       b->panel = p;
-       b->groupid = -1;
-       b->callbackfunc = glhost_button_clicked_Slot;
-       b->data = i;
-       glCompSetAddButton(s, b);
-
-       gtkhostbtn[i] =
-           gtk_button_new_with_label(agget(g, hostbtncaption));
-       g_signal_connect((gpointer) gtkhostbtn[i], "clicked",
-                        G_CALLBACK(host_button_clicked_Slot), i);
-
-       color.blue = 65535 * atof(agget(g, hostbtncolorB));
-       color.red = 65535 * atof(agget(g, hostbtncolorR));
-       color.green = 65535 * atof(agget(g, hostbtncolorG));
-
-       gtkhostcolor[i] = gtk_color_button_new_with_color(&color);
-
-       gtk_color_button_set_alpha(gtkhostbtn[i],
-                                  65535 * atof(agget(g, hostbtncolorA)));
-
-
-       gtk_layout_put(layout, gtkhostbtn[i], X, Y);
-       gtk_widget_set_size_request(gtkhostbtn[i], 200, 35);
-
-       gtk_layout_put(layout, gtkhostcolor[i], X + 225, Y);
-       gtk_widget_set_size_request(gtkhostcolor[i], 40, 35);
-
-       gtk_widget_show(gtkhostbtn[i]);
-       gtk_widget_show(gtkhostcolor[i]);
-       Y = Y + 40;
-       hostactive[i] = 0;
-    }
-    p->height = 15 + (btncount + 1) * 36;
-    for (i = 0; i < btncount; i++) {
-       prepare_nodes_for_groups(i);
-    }
-}
-
-static void on_host_alpha_change(GtkWidget * widget, gpointer user_data)
-{
-    glexpose();
-}
-#endif
 
 void local_zoom(topview * t)
 {
@@ -1429,385 +1258,6 @@ void originate_distorded_coordinates(topview * t)
     }
 }
 
-#ifdef UNUSED
-void test_callback(void)
-{
-}
-#endif
-
-static void menu_click_control(void *p)
-{
-    glCompSet *s;
-    int ind = 0;
-    s = ((glCompButton *) p)->parentset;
-    for (ind = 0; ind < s->panelcount; ind++) 
-       {
-               if (s->panels[ind]->data == 1)  //control panel
-               {
-                       if (s->panels[ind]->visible)
-                       {
-                               glCompPanelHide(s->panels[ind]);
-                               glCompButtonSetText(p,"Controls");
-                       }
-                       else
-                       {
-                               glCompPanelShow(s->panels[ind]);
-                               glCompButtonSetText(p,"Hide");
-
-                       }
-
-               }
-    }
-}
-
-static void menu_click_data(void *p)
-{
-    glCompSet *s;
-    int ind = 0;
-    s = ((glCompButton *) p)->parentset;
-    for (ind = 0; ind < s->panelcount; ind++) {
-       if (s->panels[ind]->data > 0)
-           glCompPanelHide(s->panels[ind]);    //hide all panels
-       if (s->panels[ind]->data == 2)  //data panel
-       {
-           glCompPanelShow(s->panels[ind]);
-       }
-    }
-}
-
-
-static void menu_click_pan(void *p)
-{
-       switch_Mouse(NULL,MM_PAN);
-
-}
-
-static void menu_click_zoom(void *p)
-{
-
-       switch_Mouse(NULL,MM_ZOOM);
-
-}
-
-static void menu_click_fisheye_magnifier(void *p)
-{
-    view->mouse.mouse_mode = MM_FISHEYE_MAGNIFIER;
-
-}
-
-static void menu_click_zoom_minus(void *p)
-{
-}
-
-static void menu_click_zoom_plus(void *p)
-{
-}
-
-#ifdef UNUSED
-static void menu_click_alpha_plus(void *p)
-{
-    if ((view->zoom + ZOOM_STEP) < MAX_ZOOM)
-       view->zoom = view->zoom + ZOOM_STEP;
-    else
-       view->zoom = (float) MAX_ZOOM;
-
-}
-#endif
-
-
-
-static void menu_switch_to_fisheye(void *p)
-{
-       if (!view->Topview->is_top_fisheye == 1)
-       {
-               if (!view->Topview->h) 
-               {
-                       prepare_topological_fisheye(view->Topview);
-                       g_timer_start(view->timer);
-               }
-               view->Topview->is_top_fisheye = 1;
-               glCompButtonSetText(p,"Normal");
-
-       }
-       else
-       {
-               view->Topview->is_top_fisheye = 0;
-               glCompButtonSetText(p,"Fisheye");
-               g_timer_stop(view->timer);
-       }
-
-
-}
-
-static void menu_click_rotate(void *p)
-{
-       switch_Mouse(NULL,MM_ROTATE);
-       view->mouse.mouse_mode = MM_ROTATE;
-}
-
-
-static void menu_click_center(void *p)
-{
-       if (view->active_camera == -1)  /*2D mode*/
-       {       
-               btnToolZoomFit_clicked(NULL,NULL);
-       }
-       else    /*there is active camera , adjust it to look at the center*/
-       {
-               view->cameras[view->active_camera]->targetx=0;
-               view->cameras[view->active_camera]->targety=0;
-               view->cameras[view->active_camera]->r=20;
-
-       }
-}
-static glCompPanel *controlPanel;
-static glCompButton *rotatebutton;
-
-static void switch2D3D(void *p)
-{
-       if (view->active_camera == -1)
-       {
-
-               if (view->camera_count == 0)
-               {
-                       menu_click_add_camera(p);
-               }
-               else
-               {
-                       view->active_camera = 0 ;       /*set to camera*/
-               }
-               glCompButtonSetText(p,"2D");
-               controlPanel->height +=72;
-               rotatebutton->visible=1;
-
-       }
-       else /*switch to 2d*/
-       {
-                       view->active_camera = -1 ;      /*set to camera*/
-                       glCompButtonSetText(p,"3D");
-
-                       controlPanel->height -=72;
-                       rotatebutton->visible=0;
-
-
-       }
-}
-static viewMatrice(int n,int m,float* mtx)
-{
-       int i,i2;
-       printf ("Transformation Matrix\n");
-       i=i2=0;
-       for (i=0; i < n * m; i ++)
-       {
-/*                     if (i==5)
-                               printf ("tetX:%f  ",asin(mtx[i]) * RAD2DEG);    //around x , right hand notion
-                       if (i==0)
-                               printf ("tetZ:%f  ",asin(mtx[i]) * RAD2DEG);    //around x , right hand notion
-                       if (i==5)
-                               printf ("tetX:%f  ",asin(mtx[i]) * RAD2DEG);    //around x , right hand notion*/
-                       printf ("%f  ",asin(mtx[i]) * RAD2DEG); //around x , right hand notion*/
-                       i2++;
-                       if (i2 == m)
-                       {
-                               i2=0;
-                               printf ("\n");
-                       }
-       }
-}
-
-static void test_btn_callback(void* p)
-{
-//     viewMatrice (4,4,view->arcball->Transform.M);
-       viewMatrice (3,3,view->arcball->ThisRot.M);
-}
-
-static char *smyrna_icon_pan;
-static char *smyrna_icon_zoom;
-static char *smyrna_icon_zoomplus;
-static char *smyrna_icon_zoomminus;
-static char *smyrna_icon_fisheye;
-static char *smyrna_icon_rotate;
-
-
-glCompSet *glcreate_gl_topview_menu(void)
-{
-
-       glCompSet *s = glCompSetNew(view->w,view->h);
-    glCompPanel *p;
-    glCompButton *b;
-    glCompLabel *l;
-       s->fontset=fontset_init();
-       /*add a glut font*/
-       add_glut_font(s->fontset,GLUT_BITMAP_HELVETICA_12);     
-       s->fontset->activefont=0;
-
-       /* GtkRequisition requisition; *//* What??*/
-    if (!smyrna_icon_pan) {
-#ifdef _WIN32
-       smyrna_icon_pan = "pan.raw";
-       smyrna_icon_zoom = "zoom.raw";
-       smyrna_icon_zoomplus = "zoomplus.raw";
-       smyrna_icon_zoomminus = "zoomminus.raw";
-       smyrna_icon_fisheye = "fisheye.raw";
-       smyrna_icon_rotate = "rotate.raw";
-#else
-       smyrna_icon_pan = smyrnaPath("pan.raw");
-       smyrna_icon_zoom = smyrnaPath("zoom.raw");
-       smyrna_icon_zoomplus = smyrnaPath("zoomplus.raw");
-       smyrna_icon_zoomminus = smyrnaPath("zoomminus.raw");
-       smyrna_icon_fisheye = smyrnaPath("fisheye.raw");
-       smyrna_icon_rotate = smyrnaPath("rotate.raw");
-#endif
-    }
-
-    s->panelcount = 0;
-    s->panels = '\0';
-    s->buttoncount = 0;
-    s->buttons = '\0';
-    s->labels = '\0';
-    s->labelcount = 0;
-    /*panel data 
-       0 :small bottom
-       1 :control
-       2 :data
-
-
-     */
-
-    //small panel left bottom
-    p = glCompPanelNew(25, 25, 82, 40,scientific_y);
-    p->data = 0;
-    glCompSetAddPanel(s, p);
-
-
-    b = glCompButtonNew(5, 7, 72, 25, "Controls", '\0', 0, 0,scientific_y);
-    b->panel = p;
-    b->groupid = 0;
-    b->customptr = view;
-    glCompSetAddButton(s, b);
-    b->callbackfunc = menu_click_control;
-
-
-
-    p = glCompPanelNew(25, 75, 82, 305,scientific_y);
-    p->data = 1;               //control panel
-    glCompSetAddPanel(s, p);
-       controlPanel=p;
-
-
-   //rotate
-    b = glCompButtonNew(5, 302, 72, 72, "", smyrna_icon_rotate, 72, 72,scientific_y);
-    b->groupid = 3;
-    b->customptr = view;
-       b->visible=0;
-    b->panel = p;
-    b->callbackfunc = menu_click_rotate;
-       rotatebutton=b;
-    glCompSetAddButton(s, b);
-
-       //sanity button to center the drawing and fit it in the screen
-    b = glCompButtonNew(5, 5, 72, 20, "center", '\0', 0, 0,scientific_y);
-    b->customptr = view;
-    b->panel = p;
-    b->groupid = 0;
-    b->callbackfunc = menu_click_center;
-       b->color.R=0;
-       b->color.G=1;
-       b->color.B=0;
-    glCompSetAddButton(s, b);
-
-
-
-
-    //pan button
-    b = glCompButtonNew(5, 148, 72, 72, "adasasds", smyrna_icon_pan, 72,
-                       72,scientific_y);
-    b->groupid = 3;
-    b->customptr = view;
-    b->panel = p;
-    b->callbackfunc = menu_click_pan;
-    glCompSetAddButton(s, b);
-
-    //zoom
-    b = glCompButtonNew(5, 71, 72, 72, "adasasds", smyrna_icon_zoom, 72,
-                       72,scientific_y);
-    b->groupid = 3;
-    b->customptr = view;
-    b->panel = p;
-    b->callbackfunc = menu_click_zoom;
-    glCompSetAddButton(s, b);
-    //zoom +
-    b = glCompButtonNew(42, 30, 36, 36, "adasasds", smyrna_icon_zoomplus,
-                       36, 36,scientific_y);
-    b->groupid = 0;
-    b->customptr = view;
-    b->panel = p;
-    b->callbackfunc = menu_click_zoom_plus;
-    glCompSetAddButton(s, b);
-    //zoom -
-    b = glCompButtonNew(7, 30, 30, 36, "adasasds", smyrna_icon_zoomminus,
-                       36, 36,scientific_y);
-    b->groupid = 0;
-    b->panel = p;
-    b->customptr = view;
-    b->callbackfunc = menu_click_zoom_minus;
-    glCompSetAddButton(s, b);
-
-    b = glCompButtonNew(5, 225, 72, 72, "adasasds", smyrna_icon_fisheye, 72,
-                       72,scientific_y);
-    b->groupid = 3;
-    b->panel = p;
-    b->customptr = view;
-    b->callbackfunc = menu_click_fisheye_magnifier;
-    glCompSetAddButton(s, b);
-       glCompPanelHide(p);
-
-    //small panel left bottom
-    p = glCompPanelNew(5, 5, 137, 35,inverted_y);
-    p->data = 0;
-    glCompSetAddPanel(s, p);
-       
-
-
-    b = glCompButtonNew(5, 5, 50, 25, "3D", '\0', 0, 0,scientific_y);
-    b->panel = p;
-    b->groupid = 0;
-    b->customptr = view;
-    glCompSetAddButton(s, b);
-    b->callbackfunc = switch2D3D;
-
-
-    b = glCompButtonNew(57, 5, 75, 25, "Fisheye", '\0', 0, 0,scientific_y);
-    b->panel = p;
-    b->groupid = 0;
-       b->customptr = view;
-    glCompSetAddButton(s, b);
-    b->callbackfunc = menu_switch_to_fisheye;
-
-    b = glCompButtonNew(140, 5, 75, 25, "Test Btn", '\0', 0, 0,scientific_y);
-    b->panel = p;
-    b->groupid = 0;
-       b->customptr = view;
-    glCompSetAddButton(s, b);
-    b->callbackfunc = test_btn_callback;
-
-
-
-
-
-
-
-
-       
-       //3d Controls Panel
-  /*  p = glCompPanelNew(25,view->h,wid_w,wid_h);
-    p->data = 1;               
-    glCompSetAddPanel(s, p);*/
-       
-
-       return s;
-
-}
 
 #define strcaseeq(a,b)     (*(a)==*(b)&&!strcasecmp(a,b))
 
@@ -2025,20 +1475,5 @@ void setMultiedges (Agraph_t* g, char* attrname)
     freePM(map);
 }
 
-#ifdef DEBUG
-void print_xdot_set(xdot_set* s)
-{
-    xdot* x;
-    int i = 0;
-
-    fprintf (stderr, "------------------------------------------\n");
-    fprintf (stderr, "# of xdots in set:%d\n", dtsize(s->xdots));
-
-    for (x = (xdot*)dtfirst (s->xdots); x; x = (xdot*)dtnext(s->xdots, x)) {
-        fprintf (stderr, "xdot id: %d count: %d", i, x->cnt);
-        i++;
-    }
-}
-#endif
 
 
index 4ed53efeb9292b2198fd4f572673df0f6f475736..0dc014bdce1020dbbc1299149140a194a7546a09 100755 (executable)
@@ -340,9 +340,9 @@ get_data_dir()
        free(view->attr_file);
     }
 
-    view->template_file = smyrnaPath ("template.dot");
-    view->glade_file = smyrnaPath ("smyrna.glade");
-    view->attr_file = smyrnaPath ("attrs.txt");
+    view->template_file = strdup(smyrnaPath ("template.dot"));
+    view->glade_file = strdup(smyrnaPath ("smyrna.glade"));
+    view->attr_file = strdup(smyrnaPath ("attrs.txt"));
 }
 
 void init_viewport(ViewInfo * view)
index 4d0775427468013d5762aa0f72dde86d7fbfca08..73da8fd7f2f0649a0f9394998d8d4b0847a9b23f 100644 (file)
@@ -140,21 +140,13 @@ void menu_click_camera_select(void *p)
 }
 
 
-void menu_click_camera_remove(void *p)
-{
-    delete_camera_from_viewport(view,
-                               view->cameras[(int) ((glCompButton *) p)->
-                                             data]);
-    attach_camera_widget(view);
-
-}
 void menu_click_camera_edit(void *p)
 {
     show_camera_settings(view->cameras[(int) ((glCompButton *) p)->data]
        );
 }
 
-
+#ifdef UNUSED
 void attach_camera_widget(ViewInfo * view)
 {
 
@@ -269,6 +261,7 @@ void attach_camera_widget(ViewInfo * view)
                b->callbackfunc = menu_click_camera_edit;
     }
 }
+#endif
 int show_camera_settings(viewport_camera * c)
 {
 
index edc9ba556dbe89d4410fd20b44f8109c772b9ad0..0e0d947f9a9ebb792288eeac086fd7614e640669 100644 (file)
@@ -29,5 +29,6 @@ int show_camera_settings(viewport_camera* c);
 int save_camera_settings(viewport_camera* c);
 _BB void dlgcameraokbutton_clicked_cb(GtkWidget * widget, gpointer user_data);
 _BB void dlgcameracancelbutton_clicked_cb(GtkWidget * widget, gpointer user_data);
+extern void menu_click_add_camera(void *p);
 
 #endif
index 700d21f4fd52822c21e37deca31b83b0c639adee..c5cc895ef9596d72827fb2d9354abea1289578d7 100644 (file)
@@ -40,7 +40,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                AdditionalIncludeDirectories="&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;&quot;$(SolutionDir)/libltdl&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/agutil&quot;;&quot;$(SolutionDir)/windows/lib/cdt&quot;;&quot;$(SolutionDir)/&quot;;&quot;$(SolutionDir)/lib/graph&quot;;&quot;$(SolutionDir)/lib/vpsc&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/twopigen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/sfpdpgen&quot;;&quot;$(SolutionDir)/lib/rbtree&quot;;&quot;$(SolutionDir)/lib/pathplan&quot;;&quot;$(SolutionDir)/lib/patchwork&quot;;&quot;$(SolutionDir)/lib/pack&quot;;&quot;$(SolutionDir)/lib/ortho&quot;;&quot;$(SolutionDir)/lib/inkpot&quot;;&quot;$(SolutionDir)/lib/ingraphs&quot;;&quot;$(SolutionDir)/lib/gd&quot;;&quot;$(SolutionDir)/lib/filter&quot;;&quot;$(SolutionDir)/lib/fdpgen&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/dotgen&quot;;&quot;$(SolutionDir)/lib/circogen&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/agraph&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;MSWIN32;HAVE_CONFIG_H"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;MSWIN32;WIN32_DLL;HAVE_CONFIG_H"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
index 2c60b93dc9ef7e7e3ee7cfbfe5572556a22fe083..52b68ca93a751410fbffe8d4903584c56932486f 100644 (file)
@@ -1864,7 +1864,7 @@ void fix_fc(void)
     if((fp = fopen("fix-fc.exe", "r")) == NULL)
            return ;
     if (!system ("fix-fc.exe")) {
-       system ("del fc-fix.exe");
+       system ("del fix_fc.exe");
        system ("dot -c");      //run dot -c once too since we already run things :)
     }
 }
index bbc15c284d9719635f681f8b349341603604fe0d..879ace1820a4c88bcd8c2adc365cb1f41aabe4cf 100644 (file)
@@ -9,14 +9,14 @@ AM_CPPFLAGS = \
 if WITH_SMYRNA
 noinst_HEADERS = glcompbutton.h glcompdefs.h glcomplabel.h \
        glcomppanel.h glcompset.h glcomptexture.h \
-       glCompTrackBar.h glpangofont.h glcomptextpng.h\
-       glcomptext.h glutils.h
+       glpangofont.h glcomptextpng.h\
+       glcomptext.h glutils.h glcompimage.h
 
 noinst_LTLIBRARIES = libglcomp_C.la
 endif
 
 libglcomp_C_la_SOURCES = glcompbutton.c glcomplabel.c \
        glcomppanel.c glcompset.c glcomptexture.c glcomptextpng.c\
-       glCompTrackBar.c glpangofont.c glcomptext.c glutils.c 
+       glpangofont.c glcomptext.c glutils.c glcompimage
 
 EXTRA_DIST = glcomp.vcproj
index 1952792cbf401a6df138a57decb7f1a4aa272313..0d58613c74fd57635f4018e1693703a089aa6f95 100644 (file)
@@ -39,7 +39,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
+                               AdditionalIncludeDirectories="&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/xdot&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;C:\gtk\include\libglade-2.0&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/topfish&quot;;&quot;C:\gtk\lib\gtkglext-1.0\include&quot;;&quot;C:\gtk\include\gtkglext-1.0\&quot;;C:\gtk\include\cairo;&quot;C:\gtk\include\atk-1.0&quot;;&quot;C:\gtk\lib\gtk-2.0\include\cairo&quot;;&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;$(SolutionDir)/cmd/smyrna/gui&quot;;&quot;$(SolutionDir)/cmd/smyrna&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/lib/glcomp&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
                                PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="3"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="&quot;C:\graphviz-ms\graphviz2\lib\glut\glut-3.7.6-bin&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
+                               AdditionalIncludeDirectories="&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/xdot&quot;;&quot;$(SolutionDir)/lib/expr&quot;;&quot;$(SolutionDir)/lib/vmalloc&quot;;&quot;$(SolutionDir)/lib/ast&quot;;&quot;$(SolutionDir)/lib/sfio&quot;;&quot;$(SolutionDir)/lib/gvc&quot;;&quot;C:\gtk\include\libglade-2.0&quot;;&quot;$(SolutionDir)/lib/neatogen&quot;;&quot;$(SolutionDir)/lib/sparse&quot;;&quot;$(SolutionDir)/lib/topfish&quot;;&quot;C:\gtk\lib\gtkglext-1.0\include&quot;;&quot;C:\gtk\include\gtkglext-1.0\&quot;;C:\gtk\include\cairo;&quot;C:\gtk\include\atk-1.0&quot;;&quot;C:\gtk\lib\gtk-2.0\include\cairo&quot;;&quot;C:\gtk\lib\gtk-2.0\include&quot;;&quot;C:\gtk\include\gtk-2.0\&quot;;&quot;$(SolutionDir)/cmd/smyrna/gui&quot;;&quot;$(SolutionDir)/cmd/smyrna&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/lib/glcomp&quot;;&quot;C:\gtk\lib\glib-2.0\include&quot;;&quot;C:\gtk\include\glib-2.0&quot;;&quot;C:\gtk\include\pango-1.0\&quot;;C:\gtk\include;&quot;$(SolutionDir)/lib/common&quot;;&quot;$(SolutionDir)/lib/gvpr&quot;;&quot;$(SolutionDir)/lib/cdt&quot;;&quot;$(SolutionDir)/lib/cgraph&quot;;&quot;$(SolutionDir)/lib/glut/glut-3.7.6-bin&quot;;&quot;$(SolutionDir)/lib/xdot&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                                RelativePath=".\glcompbutton.h"
                                >
                        </File>
+                       <File
+                               RelativePath=".\glcompfont.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\glcompimage.h"
+                               >
+                       </File>
                        <File
                                RelativePath=".\glcomplabel.h"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcompset.h"
+                               RelativePath=".\glcomppanel.h"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomptext.h"
+                               RelativePath=".\glcompset.h"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomptexture.h"
+                               RelativePath=".\glcomptextpng.h"
                                >
                        </File>
                        <File
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomplabel.c"
+                               RelativePath=".\glcompfont.c"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomppanel.c"
+                               RelativePath=".\glcompimage.c"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcompset.c"
+                               RelativePath=".\glcomplabel.c"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomptext.c"
+                               RelativePath=".\glcompmouse.c"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomptextpng.c"
+                               RelativePath=".\glcomppanel.c"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomptexture.c"
+                               RelativePath=".\glcompset.c"
                                >
                        </File>
                        <File
-                               RelativePath=".\glcomptrackbar.c"
+                               RelativePath=".\glcomptextpng.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\glcomptexture.c"
                                >
                        </File>
                        <File
index 15f75ef0a69b871ae71e28883b7c0cbb5bd9da12..4ed6c45e22032894981c55690f516c1c0166c096 100644 (file)
 **********************************************************/
 
 #include "glcompbutton.h"
-#include "glcomptexture.h"
-#include "glcomptext.h"
+#include "glcomplabel.h"
+#include "glcompimage.h"
+#include "glCompFont.h"
 #include "glutils.h"
+#include "glcompset.h"
 #include <string.h>
 #include <GL/glut.h>
 
 
-glCompButton *glCompButtonNew(GLfloat x, GLfloat y, GLfloat w, GLfloat h,
-                             char *caption, char *glyphfile,
-                             int glyphwidth, int glyphheight,
-                             glCompOrientation orientation)
+glCompButton *glCompButtonNew(glCompObj* par,GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption)
 {
     glCompButton *p;
+       glCompCommon* parent=&par->common;
     p = malloc(sizeof(glCompButton));
-    p->color.R = GLCOMPSET_BUTTON_COLOR_R;
-    p->color.G = GLCOMPSET_BUTTON_COLOR_G;
-    p->color.B = GLCOMPSET_BUTTON_COLOR_B;
-    p->color.A = GLCOMPSET_BUTTON_COLOR_ALPHA;
-    p->bevel = GLCOMPSET_PANEL_BEVEL + GLCOMPSET_BEVEL_DIFF;
-    p->thickness = GLCOMPSET_BUTTON_THICKNESS;
-    p->caption = strdup(caption);
-    p->pos.x = x;
-    p->pos.y = y;
-    p->width = w;
-    p->height = h;
-    p->enabled = 1;
-    p->visible = 1;
-    p->status = 0;             //0 not pressed 1 pressed;
-    p->groupid = -1;
-    p->fontsize = GLCOMPSET_FONT_SIZE;
-    p->fontcolor.R = GLCOMPSET_BUTTON_FONT_COLOR_R;
-    p->fontcolor.G = GLCOMPSET_BUTTON_FONT_COLOR_G;
-    p->fontcolor.B = GLCOMPSET_BUTTON_FONT_COLOR_B;
-    p->fontcolor.A = GLCOMPSET_BUTTON_FONT_COLOR_ALPHA;
-    //load glyph
-    if (glyphfile) {
+       glCompInitCommon((glCompObj*)p,par,x,y);
+       p->objType=glButtonObj;
+       /*customize button color*/
+       p->common.color.R = GLCOMPSET_BUTTON_COLOR_R;
+    p->common.color.G = GLCOMPSET_BUTTON_COLOR_G;
+    p->common.color.B = GLCOMPSET_BUTTON_COLOR_B;
+    p->common.color.A = GLCOMPSET_BUTTON_COLOR_ALPHA;
 
-       p->glyph =
-           glCompCreateTextureFromRaw(glyphfile, glyphwidth, glyphheight,
-                                      0);
-       p->glyphwidth = glyphwidth;
-       p->glyphheight = glyphheight;
-       p->hasglyph = 1;
+       p->common.borderType=glBorderSolid;
 
-    } else {
-       p->glyphwidth = 0;
-       p->glyphheight = 0;
-       p->hasglyph = 0;
-    }
-    p->orientation = orientation;
-    p->callbackfunc = '\0';
-    p->panel = '\0';
+       p->common.borderWidth= GLCOMPSET_BUTTON_BEVEL;
+
+    p->common.width = w;
+    p->common.height = h;
+    p->status = 0;             //0 not pressed 1 pressed;
+    p->groupid = 0;
+       p->common.callbacks.click = '\0';
     p->customptr = '\0';
-    p->font = (glCompText *) 0;
+       /*set event functions*/
+
+       p->common.functions.draw=glCompButtonDraw;
+
+       p->common.functions.click=glCompButtonClick;
+       p->common.functions.doubleclick=glCompButtonDoubleClick;
+       p->common.functions.mousedown=glCompButtonMouseDown;
+       p->common.functions.mousein=glCompButtonMouseIn;
+       p->common.functions.mouseout=glCompButtonMouseOut;
+       p->common.functions.mouseover=glCompButtonMouseOver;
+       p->common.functions.mouseup=glCompButtonMouseUp;
+
+       /*caption*/
+       p->common.font =new_font_from_parent((glCompObj*)p,NULL);
+       p->label=glCompLabelNew((glCompObj*)p,0,0,caption);
+       p->label->common.font->justify.VJustify=glFontVJustifyCenter;
+       p->label->common.font->justify.HJustify=glFontHJustifyCenter;
+       p->label->common.align=glAlignParent;
+       /*image*/
+       p->image=(glCompImage*)0;
+       p->glyphPos=glButtonGlyphLeft;
     return p;
 }
 
-
-int glCompSetAddButton(glCompSet * s, glCompButton * p)
+int glCompButtonAddPngGlyph(glCompButton* b,char* fileName)
 {
-    s->buttoncount++;
-    s->buttons =
-       realloc(s->buttons, sizeof(glCompButton *) * s->buttoncount);
-    s->buttons[s->buttoncount - 1] = p;
-    p->parentset = s;
-    p->font = s->fontset->fonts[s->fontset->activefont];
-    return 1;
-}
+       int rv;
+       /*delete if there is an existing image*/
+       if (b->image)
+               glCompImageDelete(b->image);
+       /*image on left for now*/
+       b->image=glCompImageNew((glCompObj*)b,0,0);
 
-int glCompSetRemoveButton(glCompSet * s, glCompButton * p)
-{
-    int ind = 0;
-    int found = 0;
-    for (; ind < s->buttoncount; ind++) {
-       if ((s->buttons[ind] == p) && found == 0)
-           found = 1;
-       if ((found == 1) && (ind <= (s->buttoncount - 1)))
-           s->buttons[ind] = s->buttons[ind + 1];
-    }
-    if (found) {
-       free(p->caption);
-       free(p);
-       s->buttoncount--;
-       s->buttons =
-           realloc(s->buttons, sizeof(glCompButton *) * s->buttoncount);
+       rv= glCompImageLoadPng(b->image,fileName);
+       if (rv)
+       {
+               b->image->common.anchor.leftAnchor=1;
+               b->image->common.anchor.left=0;
 
-       return 1;
-    }
-    return 0;
-}
+               b->image->common.anchor.topAnchor=1;
+               b->image->common.anchor.top=0;
 
-int glCompDrawButton(glCompButton * p)
-{
-    int kts, kts2;
-    GLfloat tempX, tempY;
-    GLfloat h, h2;             /*container widget height */
-    float color_fac;
-    float thickness = p->thickness;
-    float fontx, fonty;
-    GLfloat fontwidth;
+               b->image->common.anchor.bottomAnchor=1;
+               b->image->common.anchor.bottom=0;
 
-    if (p->orientation == 1) {
-       kts = 1;
-       h = 0;
-    } else {
-       kts = -1;
-       h = ((glCompSet *) p->parentset)->h;
-    }
-    if (p->panel->orientation == 1) {
-       kts2 = 1;
-       h2 = 0;
-    } else {
-       kts2 = -1;
-       h2 = ((glCompSet *) p->panel->parentset)->h;
-    }
-    if ((!p->visible) || (!p->panel->visible))
-       return 0;
-    if (p->panel) {
-       tempX = p->pos.x;
-       tempY = p->pos.y;
-       p->pos.x = p->panel->pos.x + p->pos.x;
-       p->pos.y = p->panel->pos.y * kts2 * kts + h2 + p->pos.y - h;
-       if (p->panel->orientation == 0)
-           p->pos.y = p->pos.y - p->panel->height;
-    }
-    if (p->status == 1) {
-       color_fac = GLCOMPSET_BUTTON_BEVEL_BRIGHTNESS;
-       glColor4f(p->color.R / (GLfloat) 1.2, p->color.G / (GLfloat) 1.2,
-                 p->color.B / (GLfloat) 1.2, p->color.A);
-       p->thickness = p->thickness / (GLfloat) 1.2;
-    }
+               b->label->common.anchor.leftAnchor=1;
+               b->label->common.anchor.left=b->image->common.width;
+               b->label->common.anchor.rightAnchor=1;
+               b->label->common.anchor.right=0;
 
-    else {
-       color_fac = 1 / GLCOMPSET_BUTTON_BEVEL_BRIGHTNESS;
-       glColor4f(p->color.R, p->color.G, p->color.B, p->color.A);
-       p->thickness = p->thickness * (GLfloat) 1.2;
-    }
-    if (!p->hasglyph) {
-       glBegin(GL_POLYGON);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glVertex3f(p->pos.x + p->width - p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glVertex3f(p->pos.x + p->width - p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glEnd();
-       //buttom thickness
-       glColor4f(p->color.R * color_fac, p->color.G * color_fac,
-                 p->color.B * color_fac, p->color.A);
-       glBegin(GL_POLYGON);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glVertex3f(p->pos.x + p->width - p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glVertex3f(p->pos.x + p->width, (p->pos.y * kts + h), p->bevel);
-       glVertex3f(p->pos.x, (p->pos.y * kts + h), p->bevel);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glEnd();
-       //left thickness
-       glBegin(GL_POLYGON);
-       glVertex3f(p->pos.x + p->width,
-                  (p->pos.y * kts + h) + p->height * kts, p->bevel);
-       glVertex3f(p->pos.x + p->width - p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glVertex3f(p->pos.x + p->width - p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glVertex3f(p->pos.x + p->width, (p->pos.y * kts + h), p->bevel);
-       glVertex3f(p->pos.x + p->width,
-                  (p->pos.y * kts + h) + p->height * kts, p->bevel);
-       glEnd();
-       glColor4f(p->color.R / color_fac, p->color.G / color_fac,
-                 p->color.B / color_fac, p->color.A);
-       glBegin(GL_POLYGON);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glVertex3f(p->pos.x, (p->pos.y * kts + h) + p->height * kts,
-                  p->bevel);
-       glVertex3f(p->pos.x, (p->pos.y * kts + h), p->bevel);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->thickness, p->bevel);
-       glEnd();
-       //left thickness
-       glBegin(GL_POLYGON);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glVertex3f(p->pos.x, (p->pos.y * kts + h) + p->height * kts,
-                  p->bevel);
-       glVertex3f(p->pos.x + p->width,
-                  (p->pos.y * kts + h) + p->height * kts, p->bevel);
-       glVertex3f(p->pos.x + p->width - p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glVertex3f(p->pos.x + p->thickness,
-                  (p->pos.y * kts + h) + p->height * kts - p->thickness,
-                  p->bevel);
-       glEnd();
-       //draw caption
-       fontColor(p->font, p->fontcolor.R, p->fontcolor.G, p->fontcolor.B,
-                 p->fontcolor.A);
-       /*get the string length */
-       fontwidth =
-           (GLfloat) glutBitmapLength(GLUT_BITMAP_HELVETICA_12,
-                                      (unsigned char *) p->caption);
-       fontx =
-           (p->width - p->thickness * (GLfloat) 2 -
-            fontwidth) / (GLfloat) 2.0 + p->pos.x + p->thickness;
-       fonty =
-           (p->height * kts - p->thickness * (GLfloat) 2 -
-            p->fontsize) / (GLfloat) 2.0 + (p->pos.y * kts + h) +
-           p->thickness;
-       glprintf(p->font, fontx, fonty, p->bevel, fontwidth, p->caption);
-    }
-    //put glyph
-    else {
-       glEnable(GL_TEXTURE_2D);
-       fontx =
-           (p->width - p->thickness * (GLfloat) 2 -
-            p->glyphwidth) / (GLfloat) 2.0 + p->pos.x + p->thickness;
-       fonty =
-           (p->height * kts - p->thickness * (GLfloat) 2 -
-            p->glyphheight) / (GLfloat) 2.0 + (p->pos.y * kts + h) +
-           p->thickness;
-       glBindTexture(GL_TEXTURE_2D, p->glyph->id);
-       glColor4f(1, 1, 1, 1);
-       glBegin(GL_QUADS);
-       glTexCoord2d(0.0f, 1.0f);
-       glVertex3d(fontx, fonty, p->bevel + GLCOMPSET_BEVEL_DIFF);
-       glTexCoord2d(1.0f, 1.0f);
-       glVertex3d(fontx + p->glyph->w, fonty,
-                  p->bevel + GLCOMPSET_BEVEL_DIFF);
-       glTexCoord2d(1.0f, 0.0f);
-       glVertex3d(fontx + p->glyph->w, fonty + p->glyph->h,
-                  p->bevel + GLCOMPSET_BEVEL_DIFF);
-       glTexCoord2d(0.0f, 0.0f);
-       glVertex3d(fontx, fonty + p->glyph->h,
-                  p->bevel + GLCOMPSET_BEVEL_DIFF);
-       glTexCoord2d(fontx, fonty);
-       glVertex3d(fontx, fonty, p->bevel + GLCOMPSET_BEVEL_DIFF);
-       glEnd();
-       glDisable(GL_TEXTURE_2D);
-       if (p->status == 1) {
-           glColor4f(p->color.R * color_fac, p->color.G * color_fac,
-                     p->color.B * color_fac, p->color.A / 2);
-           glBegin(GL_POLYGON);
-           glVertex3d(fontx - p->thickness, fonty - p->thickness,
-                      p->bevel + GLCOMPSET_BEVEL_DIFF * 2);
-           glVertex3d(fontx + p->glyph->w + p->thickness,
-                      fonty - p->thickness,
-                      p->bevel + GLCOMPSET_BEVEL_DIFF * 2);
-           glVertex3d(fontx + p->glyph->w + p->thickness,
-                      fonty + p->glyph->h + p->thickness,
-                      p->bevel + GLCOMPSET_BEVEL_DIFF * 2);
-           glVertex3d(fontx - p->thickness,
-                      fonty + p->glyph->h + p->thickness,
-                      p->bevel + GLCOMPSET_BEVEL_DIFF * 2);
-           glEnd();
+               b->label->common.anchor.topAnchor=1;
+               b->label->common.anchor.top=0;
 
-       }
-    }
-    p->thickness = thickness;
+               b->label->common.anchor.bottomAnchor=1;
+               b->label->common.anchor.bottom=0;
 
-    if (p->panel) {
-       p->pos.x = tempX;
-       p->pos.y = tempY;
-    }
+               b->label->common.align=glAlignNone;
+       }
+       return rv;
+}
 
-    return 1;
+void glCompButtonHide(glCompButton * p)
+{      
+       p->common.visible=0;
+       if (p->label)
+               p->label->common.visible=0;
+       if (p->image)
+               p->image->common.visible=0;
+}
+void glCompButtonShow(glCompButton * p)
+{      
+       p->common.visible=1;
+       if (p->label)
+               p->label->common.visible=1;
+       if (p->image)
+               p->image->common.visible=1;
+}
 
+void glCompButtonDraw(glCompButton * p)
+{
 
+       glCompCommon ref;
+       ref=p->common;
+       glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
+    if (!p->common.visible)
+               return;
+       /*draw panel*/
+       glCompDrawRectPrism (&(ref.pos),ref.width,ref.height,p->common.borderWidth,0.01,&(ref.color),!p->status);
+       if (p->label)
+               p->label->common.functions.draw(p->label);
+       if(p->image)
+               p->image->common.functions.draw((glCompObj*)p->image);
+       if (p->common.callbacks.draw)
+               p->common.callbacks.draw(p);    /*user defined drawing routines are called here.*/
 }
 
-void glCompButtonClick(glCompButton * p)
+void glCompButtonClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
 {
-    int ind;
-    if (p->groupid > 0) {
-       for (ind = 0; ind < ((glCompSet *) p->parentset)->buttoncount;
-            ind++) {
-           if (((glCompSet *) p->parentset)->buttons[ind]->groupid ==
-               p->groupid)
-               ((glCompSet *) p->parentset)->buttons[ind]->status = 0;
-       }
-       p->status = 1;
-    } else {
-       if (p->groupid == -1) {
-           if (p->status == 0)
+       glCompButton* p=(glCompButton*)o;
+       glCompObj* obj;
+       glCompSet* s=o->common.compset;
+       int ind=0;
+       if (p->groupid > 0)
+       {
+               for (;ind < s->objcnt;ind ++)
+               {
+                       obj=s->obj[ind];
+                       if (obj->objType==glButtonObj)
+                       {
+                               if ( ((glCompButton*)obj)->groupid == p->groupid)
+                                       ((glCompButton*)obj)->status=0;
+                       }
+               }
                p->status = 1;
-           else
-               p->status = 0;
-       } else
-           p->status = 0;
+    } 
+       else 
+       {
+               if (p->groupid == -1) 
+               {
+                       if (p->status == 0)
+                               p->status = 1;
+                       else
+                               p->status = 0;
+               } 
+               else    p->status = 0;
     }
-    if (p->callbackfunc)
-       p->callbackfunc(p);
+       if (p->common.callbacks.click)
+               p->common.callbacks.click(p,x,y,t);     
+}
 
+void glCompButtonDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompButton*)obj)->common.callbacks.doubleclick)
+       ((glCompButton*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+}
+
+void glCompButtonMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+               /*Put your internal code here*/
 
+       ((glCompButton*)obj)->status=1;
+       if (((glCompButton*)obj)->common.callbacks.mousedown)
+               ((glCompButton*)obj)->common.callbacks.mousedown(obj,x,y,t);
 }
 
+void glCompButtonMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompButton*)obj)->common.callbacks.mousein)
+               ((glCompButton*)obj)->common.callbacks.mousein(obj,x,y);
+}
+void glCompButtonMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompButton*)obj)->common.callbacks.mouseout)
+               ((glCompButton*)obj)->common.callbacks.mouseout(obj,x,y);
+}
+void glCompButtonMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompButton*)obj)->common.callbacks.mouseover)
+               ((glCompButton*)obj)->common.callbacks.mouseover(obj,x,y);
+}
+void glCompButtonMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompButton*)obj)->common.callbacks.mouseup)
+               ((glCompButton*)obj)->common.callbacks.mouseup(obj,x,y,t);
+}
+
+
+
+
 void glCompButtonSetText(glCompButton * p, char *str)
 {
-    replacestr(str, &p->caption);
+//    replacestr(str, &p->text);
 }
index d63768002b446aa2fcc5af5d1723b49fbdadde92..7f58f91f1a2da6b1c5332be69f8b58cc6b2d5e58 100644 (file)
 #include "glcompdefs.h"
 
 
-extern glCompButton *glCompButtonNew(GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption, char *glyphfile,int glyphwidth, int glyphheight,glCompOrientation orientation);
-extern int glCompSetAddButton(glCompSet * s, glCompButton * p);
+glCompButton *glCompButtonNew(glCompObj* par,GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption);
 extern int glCompSetRemoveButton(glCompSet * s, glCompButton * p);
-extern int glCompDrawButton(glCompButton * p);
-extern void glCompButtonClick(glCompButton * p);
+extern void glCompButtonDraw(glCompButton * p);
 extern void glCompButtonSetText(glCompButton * p,char* str);
+extern int glCompButtonAddPngGlyph(glCompButton* b,char* fileName);
+extern void glCompButtonClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompButtonDoubleClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompButtonMouseDown(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompButtonMouseIn(glCompObj * o,GLfloat x,GLfloat y);
+extern void glCompButtonMouseOut(glCompObj * o,GLfloat x,GLfloat y);
+extern void glCompButtonMouseOver(glCompObj * o,GLfloat x,GLfloat y);
+extern void glCompButtonMouseUp(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompButtonHide(glCompButton * p);
+extern void glCompButtonShow(glCompButton * p);
+
 
 
 #endif
index 2151646ebcb3607fe94aa5e9c10cf96ece72af1f..19ae95cdda2dda7c0970ec23233e20a0a2e652ed 100644 (file)
 #define        GLCOMPSET_BUTTON_COLOR_ALPHA    (GLfloat)0.6
 #define        GLCOMPSET_BUTTON_THICKNESS              (GLfloat)3
 #define        GLCOMPSET_BUTTON_BEVEL_BRIGHTNESS               (GLfloat)1.7
-#define GLCOMPSET_FONT_SIZE                            (GLfloat)12
+#define GLCOMPSET_FONT_SIZE                            (GLfloat)56
+
 #define        GLCOMPSET_BUTTON_FONT_COLOR_R           (GLfloat)0
 #define        GLCOMPSET_BUTTON_FONT_COLOR_G           (GLfloat)0
 #define        GLCOMPSET_BUTTON_FONT_COLOR_B           (GLfloat)0
 #define        GLCOMPSET_BUTTON_FONT_COLOR_ALPHA       (GLfloat)1
+
 #define GLCOMPSET_FONT_SIZE_FACTOR                     (GLfloat)0.7
+
 #define        GLCOMPSET_LABEL_COLOR_R         (GLfloat)0
 #define        GLCOMPSET_LABEL_COLOR_G         (GLfloat)0
 #define        GLCOMPSET_LABEL_COLOR_B         (GLfloat)0
 #define        GLCOMPSET_LABEL_COLOR_ALPHA     (GLfloat)1
 
-#define GLCOMPSET_PANEL_BEVEL                          (GLfloat)0.1
+#define        GLCOMPSET_FONT_COLOR_R          (GLfloat)0
+#define        GLCOMPSET_FONT_COLOR_G          (GLfloat)0
+#define        GLCOMPSET_FONT_COLOR_B          (GLfloat)0
+#define        GLCOMPSET_FONT_COLOR_ALPHA      (GLfloat)1
+#define GLCOMPSET_FONT_DESC  "Times Italic"
+#define GL_FONTOPTIMIZE 1
+
+
+#define GL_FONTVJUSTIFY        0
+#define GL_FONTHJUSTIFY        0
+
+
+#define DEFAULT_GLUT_FONT GLUT_BITMAP_HELVETICA_12
+
+#define GLCOMPSET_BORDERWIDTH                          (GLfloat)2
+#define GLCOMPSET_PANEL_BORDERWIDTH                            (GLfloat)3
+#define GLCOMPSET_BUTTON_BEVEL                         (GLfloat)5
 #define        GLCOMPSET_BEVEL_DIFF                            (GLfloat)0.001
 #define GLCOMPSET_DEFAULT_PAD          (GLfloat)3
+#define        GLCOMP_DEFAULT_WIDTH    (GLfloat)10
+#define        GLCOMP_DEFAULT_HEIGHT   (GLfloat)10
+
+
 
 #define FONT_MAX_LEN                1024 /* maximum chars to draw to the screen, used for buffers also */
 #define FONT_TAB_SPACE              4    /* spaces to draw for a tab, make option? */
 #define R_DPI              16
 
 
-typedef void (*callbackfunc_t) (void *component);
+
+
+
+
+
 typedef enum { inverted_y,scientific_y} glCompOrientation;
+typedef enum {gluttext,pangotext} glCompFontType;
+typedef enum {glAlignNone,glAlignLeft,glAlignTop,glAlignBottom,glAlignRight,glAlignParent,glAlignCenter} glCompAlignment;
+
+typedef enum {glFontVJustifyNone,glFontVJustifyTop,glFontVJustifyBottom,glFontVJustifyCenter} glCompVJustify;
+typedef enum {glFontHJustifyNone,glFontHJustifyLeft,glFontHJustifyRight,glFontHJustifyCenter} glCompHJustify;
+typedef enum {glButtonGlyphLeft,glButtonGlyphRight,glButtonGlyphTop,glButtonGlyphBottom} glCompButtonGlyph;
+typedef enum {glBorderNone,glBorderSolid,glBorderBevel,glBorderCustom} glCompBorderType;
+
+typedef enum {glMouseDown,glMouseUp}glCompMouseStatus;
+typedef enum {glMouseLeftButton,glMouseRightButton,glMouseMiddleButton}        glMouseButtonType;
+
+typedef enum {glTexImage,glTexLabel} glCompTexType;
+typedef enum {glPanelObj,glButtonObj,glLabelObj,glImageObj}glObjType;
+
+
+/*call backs for widgets*/
+typedef void (*glcompdrawfunc_t) (void* obj);
+typedef void (*glcompclickfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompdoubleclickfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompmouseoverfunc_t) (void* obj,GLfloat x,GLfloat y);
+typedef void (*glcompmouseinfunc_t) (void* obj,GLfloat x,GLfloat y);
+typedef void (*glcompmouseoutfunc_t) (void* obj,GLfloat x,GLfloat y);
+typedef void (*glcompmousedownfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompmouseupfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompmousedragfunct_t) (void* obj,GLfloat dx,GLfloat dy,glMouseButtonType t);
+
+
+
+
+
+typedef struct _glCompAnchor {
+
+       int topAnchor; /*anchor booleans*/
+       int leftAnchor;
+       int rightAnchor;
+       int bottomAnchor;
+
+       GLfloat top; /*anchor values*/
+       GLfloat left;
+       GLfloat right;
+       GLfloat bottom;
+
+
+} glCompAnchor;
+
+typedef struct _glCompJustify
+{
+       glCompVJustify VJustify;
+       glCompHJustify HJustify;
+}glCompJustify;
+
 
-typedef struct _glCompPoint {
-    GLfloat x, y;
+
+
+typedef struct _glCompPoint 
+{
+    GLfloat x, y,z;
 } glCompPoint;
-typedef struct {
+
+typedef struct _glCompPointI 
+{
+    int x, y;
+} glCompPointI;
+
+
+
+
+
+
+
+
+typedef struct 
+{
     GLfloat R;
     GLfloat G;
     GLfloat B;
     GLfloat A;                 //Alpha
 } glCompColor;
-typedef struct {
-    unsigned int id;
-    float w, h;
-} glCompTexture;
 
-typedef struct 
+
+typedef struct _glCompRect
+{
+       glCompPoint pos;
+       GLfloat w;
+       GLfloat h;
+}glCompRect;
+
+typedef struct _glCompTex
 {
-       int matrix;
-       int poly[2];
-       int islightingon;
-       int isblendon;
-       int isdepthon;
-       int istextureon;
-       int blendfrom;
-       int blendto;
-}fontglcache;
+       int id;
+       char* def;
+       char* text;
+       float width;
+       float height;
+       glCompTexType type;
+       int userCount;
+       unsigned char* data;    /*data*/
+}glCompTex;
 
 
+
+/*opengl font*/
 typedef struct
 {
-       char* fontdesc; //font description
+       char* fontdesc; //font description , only used with pango fonts
        glCompColor color;
-    float fontheight;           /* size of text, default 12 */
-    float tIncX;        /* used for texture coords, x axis amount to move */
-    float tIncY;        /* used for texture coords, y axis amount to move */
-    int blockRow;       /* characters per row */
-    int blockCol;       /* characters per col */
-    GLuint texId; /* texture id */
-       float zdepth;   //third dimension , depth of fonts
-       float  bmp[257][2]; //texture bitmaps
-       fontglcache glcache;
-       int isglut;/*use glutfont*/
-       void* glutfont;
-} glCompText;
-
+       glCompFontType type;
+       void* glutfont; /*glut font pointer if used*/
+       int transparent;
+       glCompTex* tex;/* texture, if type is pangotext*/
+       int size;
+       int reference; /*if font has references to parent*/
+       glCompJustify justify;
+       int optimize;
+} glCompFont;
 
-typedef struct
+typedef struct _glCompCallBacks
 {
-       glCompText** fonts;
-       int count;
-       int activefont;
-       char* font_directory;   //location where the glfont files are stored
-}fontset_t;
+       glcompdrawfunc_t draw;
+       glcompclickfunc_t click;
+       glcompdoubleclickfunc_t doubleclick;
+       glcompmouseoverfunc_t mouseover;
+       glcompmouseinfunc_t mousein;
+       glcompmouseoutfunc_t mouseout;
+       glcompmousedownfunc_t mousedown;
+       glcompmouseupfunc_t mouseup;
+       glcompmousedragfunct_t mousedrag;
 
+}glCompCallBacks;
 
 
-typedef struct _glCompPanel {
+/*
+       common widget properties
+       also each widget has pointer to its parents common
+*/
+typedef struct _glCompCommon
+{
     glCompPoint pos;
+       glCompPoint refPos;/*calculated pos after anchors and aligns*/
     GLfloat width, height;
-    GLfloat shadowwidth;
-    GLfloat bevel;
+       GLfloat borderWidth;
+       glCompBorderType borderType;
     glCompColor color;
-    glCompColor shadowcolor;
     int enabled;
     int visible;
-    void *parentset;           //parent compset
+    void *compset;             // compset
+       void* parent;   /*parent widget*/
     int data;
-    glCompText* font;  //pointer to font to use
-       glCompOrientation orientation;
+    glCompFont* font;  //pointer to font to use
+       glCompAlignment align;
+       glCompAnchor anchor;
+       int layer;      /*keep track of object order, what to draw on top*/
+       glCompCallBacks callbacks;
+       glCompCallBacks functions;
+       glCompJustify justify;
+}glCompCommon;
+
+/*generic image*/
+typedef struct _glCompImage 
+{
+       glObjType objType;      /*always keep this here for each drawable object*/
+       glCompCommon common;
+       glCompTex* texture;
+       char* pngFile;
+       int stretch;
+}glCompImage;
+
+
+
+
+
+/*generic panel*/
+typedef struct _glCompPanel 
+{
+       glObjType objType;      /*always keep this here for each drawable object*/
+       glCompCommon common;
+       GLfloat shadowwidth;
+    glCompColor shadowcolor;
        char* text;
+       glCompImage* image;
+}glCompPanel;
+
+/*label*/
+typedef struct _glCompLabel 
+{
+       glObjType objType;      /*always keep this here for each drawable object*/
+       glCompCommon common;
+       int autosize; /*if 1 label sized is calculated from font*/
+    char *text;
+} glCompLabel;
 
-} glCompPanel;
+/*buttons*/
+typedef struct _glCompButton {
+       glObjType objType;      /*always keep this here for each drawable object*/
+       glCompCommon common;
+    GLfloat width, height;
+       glCompLabel* label;
+       int status;                     //0 not pressed 1 pressed;
+    int groupid;
+       glCompImage* image;/*glyph*/
+       glCompButtonGlyph glyphPos;
+    void *customptr;           //general purpose void pointer to pass to call back
+    int data;
+
+} glCompButton;
+
+/*texture based image*/
+
+/*track bar*/
 typedef struct _glCompTrackBar {
+       glObjType objType;      /*always keep this here for each drawable object*/
        GLfloat width,height;
        glCompPanel* outerpanel;
        glCompPanel* trackline;
@@ -163,66 +328,63 @@ typedef struct _glCompTrackBar {
     int visible;
     void *parentset;           //parent compset
     int data;
-    glCompText* font;  //pointer to font to use
+    glCompFont* font;  //pointer to font to use
        glCompOrientation orientation;
 
 }glCompTrackBar;
-typedef struct _glCompLabel {
-    glCompPoint pos;
-    GLfloat size;
-    GLfloat bevel;
-    glCompColor color;
-    int visible;
-    void *parentset;           //parent compset
-    char *text;
-    GLfloat fontsizefactor;
-    glCompPanel *panel;                //container panel
-    glCompText* font;  //pointer to font to use
-       glCompOrientation orientation;
 
-} glCompLabel;
+/*glCompFont container class*/
+typedef struct
+{
+       glCompFont** fonts;
+       int count;
+       int activefont;
+       char* font_directory;   //location where the glfont files are stored
+}fontset_t;
 
+/*object prototype*/
+typedef struct {
+       glObjType objType;
+       glCompCommon common;
+}glCompObj;
 
-typedef struct _glCompButton {
-    glCompPoint pos;
-    GLfloat width, height;
-    GLfloat bevel;
-    GLfloat thickness;
-    glCompColor color;
-    glCompColor fontcolor;
-    char *caption;
-    int enabled;
-    int visible;
-    int status;                        //0 not pressed 1 pressed;
-    int groupid;
-    void *parentset;           //parent compset
-    GLfloat fontsize;
-    int hasglyph;
-    glCompTexture *glyph;
-    int glyphwidth, glyphheight;
-    glCompPanel *panel;                //container panel
-    callbackfunc_t callbackfunc;       //call back for button click
-    void *customptr;           //general purpose void pointer to pass to call back
-    int data;
-    glCompText* font;  //pointer to font to use
-       glCompOrientation orientation;
+typedef struct _glCompMouse
+{
+       glCompMouseStatus status;
+       glMouseButtonType t;
+       glCompPoint pos;
+       GLfloat dragX,dragY;
+       glCompObj* clickedObj;
+       glCompCallBacks callbacks;
+       glCompCallBacks functions;
+       int down;
+
+
+}glCompMouse;
 
-} glCompButton;
 
+
+/*main widget set manager*/
 typedef struct {
-    glCompPanel **panels;
+       glObjType objType;      /*always keep this here for each drawable object*/
+       glCompCommon common;
+
+       glCompObj** obj;        
+       int objcnt;
+       glCompPanel **panels;
     glCompButton **buttons;
     glCompLabel **labels;
        int groupCount ; /*group id counter*/
-
-    int panelcount;
-    int buttoncount;
-    int labelcount;
     int active;                        //0 dont draw, 1 draw
     int enabled;               //0 disabled 1 enabled(allow mouse interaction)
     GLfloat clickedX, clickedY;
-       GLfloat w,h; /*parent widget width and height , needs to be updated each time window is resized*/
-       fontset_t* fontset; /*font repository*/
+
+       int textureCount;
+       glCompTex** textures;
+       glCompMouse mouse;
 } glCompSet;
 
+
+
+
 #endif
index fac60f1f82bf7c9928a2503ffab7f30ed9d819b3..ef5255bb083f5d361b907ac94fbf68256a34f60b 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 #include "glcomplabel.h"
-#include "glcomptexture.h"
-#include "glcomptext.h"
+#include "glCompFont.h"
+#include "glcompset.h"
+#include "glutils.h"
 
 
-glCompLabel *glCompLabelNew(GLfloat x, GLfloat y, GLfloat size, char *text,
-                           glCompOrientation orientation)
+glCompLabel *glCompLabelNew(glCompObj* par,GLfloat x, GLfloat y,char *text)
 {
     glCompLabel *p;
-    p = malloc(sizeof(glCompLabel));
-    p->color.R = GLCOMPSET_LABEL_COLOR_R;
-    p->color.G = GLCOMPSET_LABEL_COLOR_G;
-    p->color.B = GLCOMPSET_LABEL_COLOR_B;
-    p->color.A = GLCOMPSET_LABEL_COLOR_ALPHA;
-    p->bevel = GLCOMPSET_PANEL_BEVEL + GLCOMPSET_BEVEL_DIFF;
+       glCompCommon* parent=&par->common;
+       p = malloc(sizeof(glCompLabel));
+       glCompInitCommon((glCompObj*)p,par,x,y);
+       p->objType=glLabelObj;
+       //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
+
     p->text = strdup(text);
-    p->pos.x = x;
-    p->pos.y = y;
-    p->size = size;
-    p->visible = 1;
-    p->fontsizefactor = GLCOMPSET_FONT_SIZE_FACTOR;
-    p->panel = '\0';
-    p->font = font_init();
-    return p;
+       p->common.font =new_font_from_parent(par,text);
+       p->common.functions.draw=glCompLabelDraw;
+
+       return p;
 }
 
-int glCompSetAddLabel(glCompSet * s, glCompLabel * p)
+
+int glCompLabelDraw(glCompLabel * p)
 {
-    s->labelcount++;
-    s->labels = realloc(s->labels, sizeof(glCompLabel *) * s->labelcount);
-    s->labels[s->labelcount - 1] = p;
-    p->font = s->fontset->fonts[s->fontset->activefont];
-    p->parentset = s;
+       glCompCommon ref;
+       ref=p->common;
+       glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
+       /*draw background*/
+       glCompSetColor(&p->common.color);
+       glBegin(GL_QUADS);
+               glVertex3d(ref.refPos.x,ref.refPos.y,ref.refPos.z);
+               glVertex3d(ref.refPos.x+ref.width,ref.refPos.y,ref.refPos.z);
+               glVertex3d(ref.refPos.x+ref.width,ref.refPos.y+ref.height,ref.refPos.z);
+               glVertex3d(ref.refPos.x,ref.refPos.y+ref.height,ref.refPos.z);
+       glEnd();
+       glCompRenderText(p->common.font,(glCompObj*)p);
+       return 1;
+
+}
+int glCompLabelSetText(glCompLabel * p, char *text)
+{
+    free(p->text);
+    p->text = strdup(text);
     return 1;
 }
 
 
-int glCompSetRemoveLabel(glCompSet * s, glCompLabel * p)
+void glCompLabelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
 {
-    int ind = 0;
-    int found = 0;
-    for (; ind < s->labelcount - 1; ind++) {
-       if ((s->labels[ind] == p) && found == 0)
-           found = 1;
-       if (found == 1)
-           s->labels[ind] = s->labels[ind + 1];
-    }
-    if (found) {
-       free(p->font);
-       free(p->text);
-       free(p);
-       s->labelcount--;
-       s->labels =
-           realloc(s->labels, sizeof(glCompLabel *) * s->labelcount);
-       return 1;
-    }
-    return 0;
+       if (o->common.callbacks.click)
+               o->common.callbacks.click(o,x,y,t);     
 }
 
-int glCompDrawLabel(glCompLabel * p)
+void glCompLabelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
 {
+       /*Put your internal code here*/
+       if (((glCompLabel*)obj)->common.callbacks.doubleclick)
+       ((glCompLabel*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+}
 
-    int kts, kts2;
-    GLfloat tempX, tempY;
-    GLfloat h, h2;             /*container widget height */
-#ifdef UNUSED
-    float color_fac;
-    float fontx, fonty;
-    GLfloat fontwidth;
-#endif
-
-    if (p->orientation == 1) {
-       kts = 1;
-       h = 0;
-    } else {
-       kts = -1;
-       h = ((glCompSet *) p->parentset)->h;
-    }
-    if (p->panel->orientation == 1) {
-       kts2 = 1;
-       h2 = 0;
-    } else {
-       kts2 = -1;
-       h2 = ((glCompSet *) p->panel->parentset)->h;
-    }
-    if ((!p->visible) || (!p->panel->visible))
-       return 0;
-    if (p->panel) {
-       tempX = p->pos.x;
-       tempY = p->pos.y;
-       p->pos.x = p->panel->pos.x + p->pos.x;
-       p->pos.y = p->panel->pos.y * kts2 * kts + h2 + p->pos.y - h;
-       if (p->panel->orientation == 0)
-           p->pos.y = p->pos.y - p->panel->height;
-    }
-    printf("kts:%d h:%f kts2:%d h2:%f \n", kts, h, kts2, h2);
-
-    p->font->fontheight = p->size;
-    fontColor(p->font, p->color.R, p->color.G, p->color.B, p->color.A);
+void glCompLabelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompLabel*)obj)->common.callbacks.mousedown)
+               ((glCompLabel*)obj)->common.callbacks.mousedown(obj,x,y,t);
+}
 
-    glprintf(p->font, p->pos.x, p->pos.y, p->panel->bevel,
-            (p->size * p->fontsizefactor * strlen(p->text)), p->text);
-    if (p->panel) {
-       p->pos.x = tempX;
-       p->pos.y = tempY;
-       return 1;
-    }
-    return 0;
+void glCompLabelMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompLabel*)obj)->common.callbacks.mousein)
+               ((glCompLabel*)obj)->common.callbacks.mousein(obj,x,y);
 }
-int glCompLabelSetText(glCompLabel * p, char *text)
+void glCompLabelMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
 {
-    free(p->text);
-    p->text = strdup(text);
-    return 1;
+       /*Put your internal code here*/
+       if (((glCompLabel*)obj)->common.callbacks.mouseout)
+               ((glCompLabel*)obj)->common.callbacks.mouseout(obj,x,y);
+}
+void glCompLabelMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompLabel*)obj)->common.callbacks.mouseover)
+               ((glCompLabel*)obj)->common.callbacks.mouseover(obj,x,y);
+}
+void glCompLabelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompLabel*)obj)->common.callbacks.mouseup)
+               ((glCompLabel*)obj)->common.callbacks.mouseup(obj,x,y,t);
 }
index 3066e9fea9ce4de53115afce182a507b380148d3..49771b805be30eadbd0e689ecf18f6f810515394 100644 (file)
 
 #include "glcompdefs.h"
 
-extern glCompLabel *glCompLabelNew(GLfloat x, GLfloat y, GLfloat size, char *text,glCompOrientation orientation);
+
+glCompLabel *glCompLabelNew(glCompObj* par,GLfloat x, GLfloat y,char *text);
 extern int glCompSetAddLabel(glCompSet * s, glCompLabel * p);
 extern int glCompSetRemoveLabel(glCompSet * s, glCompLabel * p);
-extern int glCompDrawLabel(glCompLabel * p);
+
+
+/*events*/
+extern int glCompLabelDraw(glCompLabel * p);
+extern void glCompLabelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompLabelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompLabelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompLabelMouseIn(glCompObj * obj,GLfloat x,GLfloat y);
+extern void glCompLabelMouseOut(glCompObj * obj,GLfloat x,GLfloat y);
+extern void glCompLabelMouseOver(glCompObj * obj,GLfloat x,GLfloat y);
+extern void glCompLabelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
+
+
 
 
 
index f4be4e57b6dd51754e19dc7c0eb9185b69b7a44f..fa593a9e788bd8ea5300f0979c16752c5f0c66ed 100644 (file)
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
 #include "glcomppanel.h"
+#include "glCompFont.h"
+#include "glcompset.h"
 #include "glcomptexture.h"
-#include "glcomptext.h"
+#include "glutils.h"
 
 
-glCompPanel *glCompPanelNew(GLfloat x, GLfloat y, GLfloat w, GLfloat h,
-                           glCompOrientation orientation)
+glCompPanel *glCompPanelNew(glCompObj* parentObj,GLfloat x, GLfloat y, GLfloat w, GLfloat h)
 {
     glCompPanel *p;
+       glCompCommon* parent=&parentObj->common;
     p = malloc(sizeof(glCompPanel));
-    p->color.R = GLCOMPSET_PANEL_COLOR_R;
-    p->color.G = GLCOMPSET_PANEL_COLOR_G;
-    p->color.B = GLCOMPSET_PANEL_COLOR_B;
-    p->color.A = GLCOMPSET_PANEL_COLOR_ALPHA;
-    p->shadowcolor.R = GLCOMPSET_PANEL_SHADOW_COLOR_R;
+       glCompInitCommon((glCompObj*)p,parentObj,(GLfloat)x ,(GLfloat)y);
+
+       p->shadowcolor.R = GLCOMPSET_PANEL_SHADOW_COLOR_R;
     p->shadowcolor.G = GLCOMPSET_PANEL_SHADOW_COLOR_G;
     p->shadowcolor.B = GLCOMPSET_PANEL_SHADOW_COLOR_B;
     p->shadowcolor.A = GLCOMPSET_PANEL_SHADOW_COLOR_A;
     p->shadowwidth = GLCOMPSET_PANEL_SHADOW_WIDTH;
-    p->bevel = GLCOMPSET_PANEL_BEVEL;
-    p->pos.x = x;
-    p->pos.y = y;
-    p->width = w;
-    p->height = h;
-    p->orientation = orientation;
-    p->text = (char *) 0;
-    p->font = font_init();
+       p->common.borderWidth=GLCOMPSET_PANEL_BORDERWIDTH;
+
+
+       p->common.width = w;
+    p->common.height = h;
+
+       p->common.font=new_font_from_parent((glCompObj*)p,NULL);
+       p->text=(char*)0;
+       p->common.functions.draw=glCompPanelDraw;
+       p->image=(glCompImage*)0;
     return p;
 }
 void glCompSetPanelText(glCompPanel * p, char *t)
 {
-    p->text = realloc(p->text, strlen(t) + sizeof(char));
-    strcpy(p->text, t);
+       replacestr(t,&p->text);
+       glCompDeleteTexture(p->common.font->tex);
+       p->common.font->tex=glCompSetAddNewTexLabel(p->common.compset, p->common.font->fontdesc,p->common.font->size,p->text,1);
 }
 
-int glCompDrawPanel(glCompPanel * p)
+int glCompPanelDraw(glCompObj * o)
 {
-    int kts;
-    GLfloat h;                 /*container widget height */
-    if (p->orientation == 1) {
-       kts = 1;
-       h = 0;
-    } else {
-       kts = -1;
-       h = ((glCompSet *) p->parentset)->h;
-    }
-    if (!p->visible)
-       return 0;
-    glColor4f(p->color.R, p->color.G, p->color.B, p->color.A);
-    glBegin(GL_POLYGON);
-    glVertex3f(p->pos.x, (p->pos.y * kts + h), p->bevel);
-    glVertex3f(p->pos.x + p->width, (p->pos.y * kts + h), p->bevel);
-    glVertex3f(p->pos.x + p->width, (p->pos.y * kts + h) + p->height * kts,
-              p->bevel);
-    glVertex3f(p->pos.x, (p->pos.y * kts + h) + p->height * kts, p->bevel);
-    glVertex3f(p->pos.x, (p->pos.y * kts + h), p->bevel);
-    glEnd();
-    glBegin(GL_LINE_STRIP);
-    glColor4f(p->shadowcolor.R, p->shadowcolor.G, p->shadowcolor.B,
-             p->color.A);
-    glVertex3f(p->pos.x, (p->pos.y * kts + h),
-              p->bevel + (GLfloat) GLCOMPSET_BEVEL_DIFF);
-    glVertex3f(p->pos.x + p->width, (p->pos.y * kts + h),
-              p->bevel + (GLfloat) GLCOMPSET_BEVEL_DIFF);
-    glVertex3f(p->pos.x + p->width, (p->pos.y * kts + h) + p->height * kts,
-              p->bevel + (GLfloat) GLCOMPSET_BEVEL_DIFF);
-    glVertex3f(p->pos.x, (p->pos.y * kts + h) + p->height * kts,
-              p->bevel + (GLfloat) GLCOMPSET_BEVEL_DIFF);
-    glVertex3f(p->pos.x, (p->pos.y * kts + h), p->bevel);
-    glEnd();
-    glLineWidth(p->shadowwidth);
-    glBegin(GL_LINE_STRIP);
-    glColor4f((GLfloat) p->shadowcolor.R, (GLfloat) p->shadowcolor.G,
-             (GLfloat) p->shadowcolor.B, (GLfloat) p->shadowcolor.A);
-    glVertex3f(p->pos.x + p->shadowwidth / ((GLfloat) 2.0),
-              (p->pos.y * kts + h) - p->shadowwidth / ((GLfloat) 2.0),
-              p->bevel);
-    glVertex3f(p->pos.x + p->shadowwidth / (GLfloat) 2.0 + p->width,
-              (p->pos.y * kts + h) - p->shadowwidth / (GLfloat) 2.0,
-              p->bevel);
-    glVertex3f(p->pos.x + p->shadowwidth / (GLfloat) 2.0 + p->width,
-              (p->pos.y * kts + h) - p->shadowwidth / (GLfloat) 2.0 +
-              p->height * kts, p->bevel);
-    glEnd();
-    glLineWidth(1);
-    //draw text
+       glCompPanel * p;
+       glCompCommon ref;
+       glCompRect r;
+       p=(glCompPanel*)o;
+       ref=p->common;
+       glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
+       p->objType=glPanelObj;
+       //typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
+
+
+    if (!p->common.visible)
+               return 0;
+       /*draw shadow*/
+    glColor4f((GLfloat) p->shadowcolor.R, (GLfloat) p->shadowcolor.G,(GLfloat) p->shadowcolor.B, (GLfloat) p->shadowcolor.A);
+       r.h=p->shadowwidth;     r.w=ref.width;  r.pos.x=ref.pos.x+p->shadowwidth;       r.pos.y=ref.pos.y-p->shadowwidth;       r.pos.z=-0.001;
+       glCompDrawRectangle (&r);
+       r.h=ref.height; r.w=p->shadowwidth;     r.pos.x=ref.pos.x+ref.width;    r.pos.y=ref.pos.y-p->shadowwidth;       r.pos.z=-0.001;
+       glCompDrawRectangle (&r);
+       /*draw panel*/
+       glCompDrawRectPrism (&(ref.pos),ref.width,ref.height,p->common.borderWidth,0.01,&(ref.color),1);
+       /*draw image if there is*/
+       if (p->image)
+       {
+               p->image->common.callbacks.draw(p->image);
+       }
     if (p->text) {
 
 
@@ -106,41 +85,11 @@ int glCompDrawPanel(glCompPanel * p)
     return 1;
 }
 
-int glCompSetAddPanel(glCompSet * s, glCompPanel * p)
-{
-    s->panelcount++;
-    s->panels = realloc(s->panels, sizeof(glCompPanel *) * s->panelcount);
-    s->panels[s->panelcount - 1] = p;
-    p->parentset = s;
-    p->font = s->fontset->fonts[s->fontset->activefont];
-    return 1;
-}
-
-int glCompSetRemovePanel(glCompSet * s, glCompPanel * p)
-{
-    int ind = 0;
-    int found = 0;
-    for (; ind < s->panelcount; ind++) {
-       if ((s->panels[ind] == p) && found == 0)
-           found = 1;
-       if ((found == 1) && (ind < (s->panelcount - 1)))
-           s->panels[ind] = s->panels[ind + 1];
-    }
-    if (found) {
-       free(p->text);
-       free(p);
-       s->panelcount--;
-       s->panels =
-           realloc(s->panels, sizeof(glCompPanel *) * s->panelcount);
-       return 1;
-    }
-    return 0;
-}
 
 int glCompPanelHide(glCompPanel * p)
 {
     /* int ind = 0; */
-    p->visible = 0;
+    p->common.visible = 0;
     return 1;
 
 
@@ -149,7 +98,65 @@ int glCompPanelHide(glCompPanel * p)
 int glCompPanelShow(glCompPanel * p)
 {
     /* int ind = 0; */
-    p->visible = 1;
+    p->common.visible = 1;
     return 1;
 
 }
+
+void glCompPanelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       if (o->common.callbacks.click)
+               o->common.callbacks.click(o,x,y,t);     
+}
+
+void glCompPanelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompPanel*)obj)->common.callbacks.doubleclick)
+       ((glCompPanel*)obj)->common.callbacks.doubleclick(obj,x,y,t);
+}
+
+void glCompPanelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompPanel*)obj)->common.callbacks.mousedown)
+               ((glCompPanel*)obj)->common.callbacks.mousedown(obj,x,y,t);
+}
+
+void glCompPanelMouseIn(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompPanel*)obj)->common.callbacks.mousein)
+               ((glCompPanel*)obj)->common.callbacks.mousein(obj,x,y);
+}
+void glCompPanelMouseOut(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompPanel*)obj)->common.callbacks.mouseout)
+               ((glCompPanel*)obj)->common.callbacks.mouseout(obj,x,y);
+}
+void glCompPanelMouseOver(glCompObj * obj,GLfloat x,GLfloat y)
+{
+       /*Put your internal code here*/
+       if (((glCompPanel*)obj)->common.callbacks.mouseover)
+               ((glCompPanel*)obj)->common.callbacks.mouseover(obj,x,y);
+}
+void glCompPanelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       /*Put your internal code here*/
+       if (((glCompPanel*)obj)->common.callbacks.mouseup)
+               ((glCompPanel*)obj)->common.callbacks.mouseup(obj,x,y,t);
+}
+
+
+
+
+void glCompPanelSetText(glCompPanel * p, char *str)
+{
+//    replacestr(str, &p->text);
+}
+
+
+
+
+
index 96b4631e095144880c564ec82b0a3505c12931fe..ef12ad40a4b658514b5aa64cac1615f2654672e6 100644 (file)
 #include "glcompdefs.h"
 
 
-extern glCompPanel *glCompPanelNew(GLfloat x, GLfloat y, GLfloat w, GLfloat h,glCompOrientation orientation);
-extern int glCompDrawPanel(glCompPanel * p);
+glCompPanel *glCompPanelNew(glCompObj* parentObj,GLfloat x, GLfloat y, GLfloat w, GLfloat h);
 extern int glCompSetAddPanel(glCompSet * s, glCompPanel * p);
 extern int glCompSetRemovePanel(glCompSet * s, glCompPanel * p);
 extern int glCompPanelShow(glCompPanel * p);
 extern int glCompPanelHide(glCompPanel * p);
 extern void glCompSetPanelText(glCompPanel * p,char* t);
 
+/*events*/
+extern int glCompPanelDraw(glCompObj * o);
+extern void glCompPanelClick(glCompObj * o,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompPanelDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompPanelMouseDown(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
+extern void glCompPanelMouseIn(glCompObj * obj,GLfloat x,GLfloat y);
+extern void glCompPanelMouseOut(glCompObj * obj,GLfloat x,GLfloat y);
+extern void glCompPanelMouseOver(glCompObj * obj,GLfloat x,GLfloat y);
+extern void glCompPanelMouseUp(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t);
+
+
+
+
 #endif
index 2c1565ecbd1f3659100f457c778b4e3c475e739b..406d74faf9087cc68fe5cb6d8109e65826b0a47c 100644 (file)
 #include "glcomppanel.h"
 #include "glcomplabel.h"
 #include "glcompbutton.h"
+#include "glcompmouse.h"
 
-//#ifdef WIN32
-/*char *
-mystrdup(const char *string)
+#include "glutils.h"
+//typedef enum {glPanelObj,glbuttonObj,glLabelObj,glImageObj}glObjType;
+
+static GLfloat startX,startY;
+
+
+
+void glCompGetObjectType(glCompObj* p)
+{
+       switch (p->objType)
+       {
+               case glPanelObj:
+                       printf ("Panel\n");
+                       break;
+               case glButtonObj:
+                       printf ("Button\n");
+                       break;
+               case glImageObj:
+                       printf ("Image\n");
+                       break;
+               case glLabelObj:
+                       printf ("Label\n");
+                       break;
+               default:
+                       printf ("undefined object\n");
+                       break;
+
+       }
+
+}
+static int glCompPointInObject(glCompObj* p, float x, float y)
+{
+       return ((x > p->common.refPos.x) && (x < p->common.refPos.x + p->common.width) &&       (y > p->common.refPos.y) &&     (y < p->common.refPos.y + p->common.height));
+}
+glCompObj* glCompGetObjByMouse(glCompSet* s ,glCompMouse* m,int onlyClickable)
+{
+       int ind=0;
+       glCompObj* rv=NULL;
+       if (!s || !m)
+               return NULL;
+       for (ind ; ind < s->objcnt ; ind ++)
+       {
+               if ((s->obj[ind]->common.visible)&&(glCompPointInObject(s->obj[ind],m->pos.x,m->pos.y)))
+               {       
+                       if ((!rv) ||(s->obj[ind]->common.layer >= rv->common.layer))
+                       {
+                               if (((onlyClickable) && (s->obj[ind]->common.functions.click)) || (!onlyClickable))
+                                       rv=s->obj[ind];
+                       }
+               }
+       }
+
+       return rv;
+}
+
+
+static void glCompMouseMove (void* obj,GLfloat x,GLfloat y)
+{
+       ((glCompSet*)obj)->mouse.pos.x=x;
+       ((glCompSet*)obj)->mouse.pos.y=((glCompObj*)obj)->common.height - y;
+       ((glCompSet*)obj)->mouse.pos.z=0;
+       ((glCompSet*)obj)->mouse.dragY=((glCompSet*)obj)->mouse.pos.y - startY;
+       ((glCompSet*)obj)->mouse.dragX=((glCompSet*)obj)->mouse.pos.x - startX;
+       if (((glCompSet*)obj)->common.callbacks.mouseover)
+               ((glCompSet*)obj)->common.callbacks.mouseover(obj,x,y);
+/*     if (((glCompSet*)obj)->mouse.down)
+               printf ("%f %f \n",((glCompSet*)obj)->mouse.dragX,((glCompSet*)obj)->mouse.dragX);*/
+}
+
+
+
+static void glCompSetMouseClick (void* obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+       if (((glCompSet*)obj)->common.callbacks.click)
+               ((glCompSet*)obj)->common.callbacks.click(obj,x,y,t);
+
+
+}
+static void glCompSetMouseDown (void* obj,GLfloat x,GLfloat y,glMouseButtonType t)
 {
-     char       *nstr;
-     nstr = (char *) malloc(strlen(string) + 1);
-     if (nstr)
-         strcpy(nstr, (char*)string);
-     return nstr;
+       ((glCompSet*)obj)->mouse.t=t;
+       if (t==glMouseLeftButton)
+       {
+               ((glCompSet*)obj)->mouse.pos.x=x;
+               ((glCompSet*)obj)->mouse.pos.y=((glCompObj*)obj)->common.height - y;
+               ((glCompSet*)obj)->mouse.pos.z=0;
+               ((glCompSet*)obj)->mouse.clickedObj=glCompGetObjByMouse(((glCompObj*)obj)->common.compset,&((glCompSet*)(((glCompObj*)obj)->common.compset))->mouse,1);
+               if(((glCompSet*)obj)->mouse.clickedObj)
+                       if(((glCompSet*)obj)->mouse.clickedObj->common.functions.mousedown)
+                               ((glCompSet*)obj)->mouse.clickedObj->common.functions.mousedown(((glCompSet*)obj)->mouse.clickedObj,x,y,t);
+       }
+       ((glCompSet*)obj)->mouse.down=1;
+       startX=x;
+       startY=((glCompObj*)obj)->common.height - y;
+       if (((glCompSet*)obj)->common.callbacks.mousedown)
+               ((glCompSet*)obj)->common.callbacks.mousedown(obj,x,y,t);
+
+
+
+
+}
+static void glCompSetMouseUp (void* obj,GLfloat x,GLfloat y,glMouseButtonType t)
+{
+
+       static GLfloat tempX,tempY;
+       tempX=x;
+       tempY=((glCompObj*)obj)->common.height - y;
+
+       ((glCompSet*)obj)->mouse.down=0;
+       if (t==glMouseLeftButton)
+       {
+               glCompObj* o=NULL;
+               glCompObj* o_clicked=((glCompSet*)obj)->mouse.clickedObj;
+               ((glCompSet*)obj)->mouse.pos.x=tempX;
+               ((glCompSet*)obj)->mouse.pos.y=tempY;
+               ((glCompSet*)obj)->mouse.pos.z=0;
+               if (o_clicked)
+                       o=glCompGetObjByMouse((glCompSet*)obj,&((glCompSet*)obj)->mouse,1);
+               if(!o) 
+                       return;
+               if(o == o_clicked)
+                       o->common.functions.click(o,x,y,t);
+       }
+       if (((glCompSet*)obj)->common.callbacks.mouseup)
+               ((glCompSet*)obj)->common.callbacks.mouseup(obj,x,y,t);
+       /*check if mouse is clicked or dragged*/
+       if ((startX ==  (int)tempX) && (startY == tempY))
+               glCompSetMouseClick(obj,x,y,t);
+
+
+
+}
+
+
+
+extern void glCompInitCommon(glCompObj* childObj,glCompObj* parentObj,GLfloat x ,GLfloat y)
+{
+       glCompCommon* c;
+       glCompCommon* parent;
+       c=&childObj->common;
+       c->align=glAlignNone;
+       c->anchor.bottom=0;
+       c->anchor.left=0;
+       c->anchor.top=0;
+       c->anchor.right=0;
+       c->anchor.leftAnchor=0;
+       c->anchor.rightAnchor=0;
+       c->anchor.topAnchor=0;
+       c->anchor.bottomAnchor=0;
+       c->data=0;
+       c->enabled=1;
+       c->height=GLCOMP_DEFAULT_HEIGHT;;
+       c->width=GLCOMP_DEFAULT_WIDTH;
+       c->visible=1;
+       c->pos.x=x;
+       c->pos.y=y;
+       c->borderType=glBorderSolid;
+       c->borderWidth=GLCOMPSET_BORDERWIDTH;
+
+       /*NULL function pointers*/
+       childObj->common.callbacks.click=NULL;
+       childObj->common.callbacks.doubleclick=NULL;
+       childObj->common.callbacks.draw=NULL;
+       childObj->common.callbacks.mousedown=NULL;
+       childObj->common.callbacks.mousein=NULL;
+       childObj->common.callbacks.mouseout=NULL;
+       childObj->common.callbacks.mouseover=NULL;
+       childObj->common.callbacks.mouseup=NULL;
+
+       childObj->common.functions.click=NULL;
+       childObj->common.functions.doubleclick=NULL;
+       childObj->common.functions.draw=NULL;
+       childObj->common.functions.mousedown=NULL;
+       childObj->common.functions.mousein=NULL;
+       childObj->common.functions.mouseout=NULL;
+       childObj->common.functions.mouseover=NULL;
+       childObj->common.functions.mouseup=NULL;
+
+
+
+       if (parentObj)
+       {
+               c->parent=&parentObj->common;
+               parent=&parentObj->common;
+               copy_glcomp_color(&parent->color,&c->color);
+               c->layer=parent->layer + 1;
+               c->pos.z=parent->pos.z;
+               glCompSetAddObj((glCompSet*)parent->compset ,childObj);
+       }
+       else
+       {
+               c->parent=NULL;
+               c->color.R=GLCOMPSET_PANEL_COLOR_R;             c->color.G=GLCOMPSET_PANEL_COLOR_G;             c->color.B=GLCOMPSET_PANEL_COLOR_B;             c->color.A=GLCOMPSET_PANEL_COLOR_ALPHA;
+               c->layer=0;
+               c->pos.z=0;
+       }
+       c->font =new_font_from_parent(childObj,NULL);
+}
+void glCompEmptyCommon(glCompCommon* c)
+{
+       delete_font (c->font);
+}
+glCompSet *glCompSetNew(int w, int h)
+{
+
+    glCompSet *s = NEW(glCompSet);
+       glCompInitCommon((glCompObj*)s,NULL,(GLfloat)0 ,(GLfloat)0);
+       s->common.width = (GLfloat) w;
+       s->common.height = (GLfloat) h;
+    s->groupCount = 0;
+       s->objcnt=0;
+       s->obj=(glCompObj**)0;
+       s->textureCount=0;
+       s->textures=(glCompTex**)0;
+       s->common.font=new_font_from_parent((glCompObj*)s,NULL);
+       s->common.compset=(glCompSet*)s;
+       s->common.functions.mouseover=glCompMouseMove;
+       s->common.functions.mousedown=glCompSetMouseDown;
+       s->common.functions.mouseup=glCompSetMouseUp;
+       glCompMouseInit(&s->mouse);
+    return s;
+}
+
+
+
+void glCompSetAddObj(glCompSet* s ,glCompObj* obj)
+{
+       s->objcnt++;
+       s->obj=realloc(s->obj, sizeof(glCompObj*) * s->objcnt);
+    s->obj[s->objcnt - 1] = obj;
+       obj->common.compset=s;
 }
-#define strdup mystrdup
-#endif*/
 //converts screen location to opengl coordinates
 static void glCompSetGetPos(int x, int y, float *X, float *Y, float *Z)
 {
@@ -79,11 +299,10 @@ void glCompDrawBegin(void) //pushes a gl stack
     glOrtho(0, vPort[2], 0, vPort[3], -1, 1);
     glMatrixMode(GL_MODELVIEW);
     glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-//      glEnable( GL_TEXTURE_2D );
 
     glPushMatrix();
     glLoadIdentity();
+       glDisable(GL_DEPTH_TEST);
 
 }
 
@@ -93,164 +312,28 @@ void glCompDrawEnd(void)  //pops the gl stack
     glPopMatrix();
     glMatrixMode(GL_MODELVIEW);
     glPopMatrix();
-}
-
-
+       glEnable(GL_DEPTH_TEST);
 
 
-
-
-
-
-
-
-static int glCompSetDrawPanels(glCompSet * s)
-{
-    int ind = 0;
-    for (; ind < s->panelcount; ind++) {
-       glCompDrawPanel(s->panels[ind]);
-    }
-    for (ind = 0; ind < s->buttoncount; ind++) {
-       glCompDrawButton(s->buttons[ind]);
-    }
-    for (ind = 0; ind < s->labelcount; ind++) {
-       glCompDrawLabel(s->labels[ind]);
-    }
-    return 1;
-
 }
 
-int glCompSetHide(glCompSet * s)
-{
-    int ind = 0;
-    for (; ind < s->panelcount; ind++) {
-       s->panels[ind]->visible = 0;
-    }
-    for (ind = 0; ind < s->buttoncount; ind++) {
-       s->buttons[ind]->visible = 0;
-    }
-    for (ind = 0; ind < s->labelcount; ind++) {
-       s->labels[ind]->visible = 0;
-    }
-    return 1;
 
-}
 
-int glCompSetShow(glCompSet * s)
-{
-    int ind = 0;
-    for (; ind < s->panelcount; ind++) {
-       s->panels[ind]->visible = 1;
-    }
-    for (ind = 0; ind < s->buttoncount; ind++) {
-       s->buttons[ind]->visible = 1;
-    }
-    for (ind = 0; ind < s->labelcount; ind++) {
-       s->labels[ind]->visible = 1;
-    }
-    return 1;
 
-}
-static int glCompPointInButton(glCompButton * p, float x, float y)
-{
-    int kts, kts2;
-    /* GLfloat tempX,tempY; */
-    GLfloat h, h2;             /*container widget height */
-    /* float color_fac; */
-    /* float thickness = p->thickness; */
-    /* float fontx, fonty; */
-    /* GLfloat fontwidth; */
-    float button_x, button_y;
-
-    if (p->orientation == 1) {
-       kts = 1;
-       h = 0;
-    } else {
-       kts = -1;
-       h = ((glCompSet *) p->parentset)->h;
-    }
-    if (p->panel->orientation == 1) {
-       kts2 = 1;
-       h2 = 0;
-    } else {
-       kts2 = -1;
-       h2 = ((glCompSet *) p->panel->parentset)->h;
-    }
-    if (!p->visible)
-       return 0;
-    if (p->panel) {
-       button_x = p->panel->pos.x + p->pos.x;
-       button_y = p->panel->pos.y * kts2 * kts + h2 + p->pos.y - h;
-       if (p->panel->orientation == 0)
-           button_y = button_y - p->panel->height;
-    }
-
-    if ((x >= button_x) && (x <= button_x + p->width) && (y >= button_y)
-       && (y <= button_y + p->height))
-       return 1;
-    else
-       return 0;
-
-}
 
 
-int glCompSetClick(glCompSet * s, int x, int y)
-{
 
-    if (s) {
-       int ind = 0;
-       float X, Y, Z;
 
-       glCompDrawBegin();
-       glCompSetGetPos(x, y, &X, &Y, &Z);
-       glCompDrawEnd();
 
 
-       s->clickedX = X;
-       s->clickedY = Y;
-
-       for (ind = 0; ind < s->buttoncount; ind++) {
-           if ((s->buttons[ind]->visible) && (s->buttons[ind]->enabled)) {
-               if (glCompPointInButton(s->buttons[ind], X, Y)) {
-                   if (s->buttons[ind]->groupid > -1)
-                       s->buttons[ind]->status = 1;
-               }
-           }
-       }
-       return 1;
-    } else
-       return 0;
-}
-
-int glCompSetRelease(glCompSet * s, int x, int y)
-{
-
-    int ind = 0;
-    if (s) {
-       for (ind = 0; ind < s->buttoncount; ind++) {
-           if ((s->buttons[ind]->visible) && (s->buttons[ind]->enabled)) {
-               if ((glCompPointInButton
-                    (s->buttons[ind], s->clickedX, s->clickedY))) {
-                   glCompButtonClick(s->buttons[ind]);
-                   break;
-               }
-           }
-       }
-    }
-    return 1;
-}
-
 
 
 
 
 void glCompSetClear(glCompSet * s)
 {
-    int ind = 0;
+/*    int ind = 0;
     for (ind = 0; ind < s->buttoncount; ind++) {
-       /*if (s->buttons[ind]->caption)
-          free(s->buttons[ind]->caption);
-          free(s->buttons[ind]); */
        glCompSetRemoveButton(s, s->buttons[ind]);
     }
     free(s->buttons);
@@ -263,22 +346,19 @@ void glCompSetClear(glCompSet * s)
        free(s->panels[ind]);
     }
     free(s->panels);
-    free(s);
+    free(s);*/
 }
 
-glCompSet *glCompSetNew(int w, int h)
-{
-    glCompSet *s = NEW(glCompSet);
-    s->w = (GLfloat) w;
-    s->h = (GLfloat) h;
-    s->groupCount = 0;
-    return s;
-}
+
 
 int glCompSetDraw(glCompSet * s)
 {
-    glCompDrawBegin();
-    glCompSetDrawPanels(s);
+       int ind=0;
+       glCompDrawBegin();
+       for (;ind < s->objcnt;ind ++)
+       {
+               s->obj[ind]->common.functions.draw((void*)s->obj[ind]);
+       }
     glCompDrawEnd();
     return 1;
 }
@@ -286,8 +366,8 @@ int glCompSetDraw(glCompSet * s)
 void glcompsetUpdateBorder(glCompSet * s, int w, int h)
 {
     if (w > 0 && h > 0) {
-       s->w = (GLfloat) w;
-       s->h = (GLfloat) h;
+               s->common.width = (GLfloat) w;
+       s->common.height = (GLfloat) h;
     }
 }
 extern int glcompsetGetGroupId(glCompSet * s)
@@ -302,6 +382,8 @@ extern int glcompsetNextGroupId(glCompSet * s)
 }
 
 
+
+
 #if 0
 static void change_fonts(glCompSet * s, const texFont_t * sourcefont)
 {
index 140c572d3ad7f68e3e688601cd220fd006240888..0b702ce8a9cc2ad38a9be971fc93e372525d1ac0 100644 (file)
 #ifndef GLCOMPSET_H
 #define GLCOMPSET_H
 
-#include "glcomptext.h"
-#include "glcomptextpng.h"
-#include "glcomptexture.h"
+#include "glCompFont.h"
+#include "glComptextpng.h"
 
 
+extern void glCompInitCommon(glCompObj* childObj,glCompObj* parentObj,GLfloat x ,GLfloat y);
+void glCompEmptyCommon(glCompCommon* c);
 extern glCompSet* glCompSetNew( int w, int h);
 extern void glCompSetClear(glCompSet * s);
 extern int glCompSetDraw(glCompSet * s);
@@ -34,10 +35,12 @@ extern int glCompSetRelease(glCompSet * s, int x, int y);
 extern void glcompsetUpdateBorder(glCompSet * s, int w, int h);
 extern int glcompsetNextGroupId(glCompSet *s);
 extern int glcompsetGetGroupId(glCompSet *s);
-
 extern void glCompDrawBegin(void);
 extern void glCompDrawEnd(void);
-
+extern void glCompDeleteTexture(glCompTex* t);
+extern void glCompSetAddObj(glCompSet* s ,glCompObj* obj);
+glCompObj* glCompGetObjByMouse(glCompSet* s ,glCompMouse* m,int onlyClickable);
+extern  void glCompGetObjectType(glCompObj* p);
 /*
        change all components's fonts  in s 
        to sourcefont
index 785f63709eb25eb8f136fc0b7aa0ce4cd12c0361..d28b445842cd47e2c10802f2f5061764bd37c767 100644 (file)
@@ -30,16 +30,8 @@ extern "C" {
 #endif
 extern fontset_t* fontset_init(void);
 extern void free_font_set(fontset_t* fontset);
-extern void copy_font(glCompText* targetfont,const glCompText* sourcefont);
-extern glCompText* add_font(fontset_t* fontset,char* fontdesc);
-extern glCompText* add_glut_font(fontset_t* fontset,void* glutfont);
-extern void glprintf (glCompText*, GLfloat , GLfloat , GLfloat ,GLfloat, char*);
-
-extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf);
-
-extern glCompText* font_init(void);
-extern void fontColor (glCompText* font,float r, float g, float b,float a);
-extern int glCompLoadFontPNG (char *name, int id);
+//extern void glprintf (glCompText*, GLfloat , GLfloat , GLfloat ,GLfloat, char*);
+//extern       void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,char *bf);
 
 
 #ifdef __cplusplus
index 1e537ee71acac7950451c1896b5a63b2880066b4..555d02445dbc1747c50555a55c1b78a9d9610ea8 100644 (file)
 *        Information and Software Systems Research        *
 *              AT&T Research, Florham Park NJ             *
 **********************************************************/
-#include "glcomptext.h"
-
+#include "glCompFont.h"
+#include <gtk/gtk.h>
 #include <png.h>
 
+unsigned char *load_png(char *filename, int *imageWidth, int *imageHeight)
+{
+       cairo_surface_t* surface;
+       cairo_format_t format;
+       int w,h;
+       unsigned char* d;
+       surface=NULL;
+
+/*     d=create_pango_texture("Arial",14,"hello world \ n hello mars",surface,&w,&h);
+       *imageWidth=w;
+       *imageHeight=h;*/
+
+
+       surface = cairo_image_surface_create_from_png(filename);
+       w=cairo_image_surface_get_width(surface);
+       h=cairo_image_surface_get_height(surface);
+       *imageWidth=w;
+       *imageHeight=h;
+    format=cairo_image_surface_get_format(surface);
+       d=cairo_image_surface_get_data (surface);
+       return d;
+
 
 
-unsigned char *load_png_font(char *file_name, int *imageWidth,
-                            int *imageHeight)
+
+}
+
+
+unsigned char *load_raw(char *filename, int width, int height)
+{
+    unsigned char *data;
+       FILE* file;
+    // allocate buffer
+    data = malloc(width * height * 3);
+    // open and read texture data
+    file = fopen(filename, "rb");
+    fread(data, width * height * 3, 1, file);
+    return data;
+}
+
+
+
+unsigned char *load_png2(char *file_name, int *imageWidth,int *imageHeight)
 {
     unsigned char *imageData = NULL;
     unsigned char header[8];
@@ -84,26 +123,20 @@ unsigned char *load_png_font(char *file_name, int *imageWidth,
     b2 = -1;
     b3 = -1;
 
-    for (i = 0; i < (int) info_ptr->height; i++) {
-       for (ii = 0; ii < (int) png_get_rowbytes(png_ptr, info_ptr);
-            ii = ii + pixeloffset) {
-           imageData[c] = row_pointers[info_ptr->height - i - 1][ii];
-
-           if ((b0 != row_pointers[info_ptr->height - i - 1][ii])
-               || (b1 != row_pointers[info_ptr->height - i - 1][ii + 1])
-               || (b2 != row_pointers[info_ptr->height - i - 1][ii + 2])
-               || (b3 != row_pointers[info_ptr->height - i - 1][ii + 3])
-               ) {
-               b0 = row_pointers[info_ptr->height - i - 1][ii];
-               b1 = row_pointers[info_ptr->height - i - 1][ii + 1];
-               b2 = row_pointers[info_ptr->height - i - 1][ii + 2];
-               b3 = row_pointers[info_ptr->height - i - 1][ii + 3];
-
-           }
-
-
-           c++;
-       }
+    for (i = 0; i < (int) info_ptr->height; i++) 
+       {
+               for (ii = 0; ii < (int) png_get_rowbytes(png_ptr, info_ptr); ii = ii + pixeloffset) 
+               {
+                       imageData[c] = row_pointers[info_ptr->height - i - 1][ii];
+                   if ((b0 != row_pointers[info_ptr->height - i - 1][ii])|| (b1 != row_pointers[info_ptr->height - i - 1][ii + 1])|| (b2 != row_pointers[info_ptr->height - i - 1][ii + 2])|| (b3 != row_pointers[info_ptr->height - i - 1][ii + 3])) 
+                       {
+                               b0 = row_pointers[info_ptr->height - i - 1][ii];
+                               b1 = row_pointers[info_ptr->height - i - 1][ii + 1];
+                               b2 = row_pointers[info_ptr->height - i - 1][ii + 2];
+                               b3 = row_pointers[info_ptr->height - i - 1][ii + 3];
+                   }
+                   c++;
+               }
     }
     //cleaning libpng mess
     png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
@@ -122,7 +155,7 @@ int glCompLoadFontPNG(char *name, int id)
     int imageWidth, imageHeight, idx2, c;
 
 //      imageData = fontGetData (s, size, imageBits);
-    imageData = load_png_font(name, &imageWidth, &imageHeight);
+    imageData = load_png(name, &imageWidth, &imageHeight);
 
     c = 0;
     idx2 = 0;
index cbd147a080f516c2532ab6483138b57b9f835b78..6d7ced115de37d4d98f93eeb72f7912ba57eeea5 100644 (file)
 **********************************************************/
 
 #include "glcomptexture.h"
+#include "glpangofont.h"
 
-glCompTexture *glCompCreateTextureFromRaw(char *filename, int width,
-                                         int height, int wrap)
+#include "memory.h"
+
+void glCompSetRemoveTexLabel(glCompSet* s,glCompFont* t)
+{
+}
+
+
+static glCompTex* glCompSetAddNewTexture(glCompSet* s,int width,int height,unsigned char* data,int is2D)
+{
+       int Er,offset,ind;
+       glCompTex* t;
+       unsigned char* tarData;
+       unsigned char* srcData;
+
+       if (!data)
+               return NULL;
+
+       Er=0;
+       t=NEW(glCompTex);
+       if (!is2D)      /*use opengl texture*/
+       {
+               glEnable(GL_TEXTURE_2D);
+               glShadeModel(GL_FLAT);
+               glEnable(GL_DEPTH_TEST);
+               glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+               glGenTextures(1, &t->id); //get next id
+               if (t->id < 0 ) /*for some opengl based error , texture couldnt be created*/
+                       Er=1;
+               else
+               {
+                       glBindTexture(GL_TEXTURE_2D, t->id);
+                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT);
+                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_REPEAT);
+                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+                       glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,width, height,0,GL_RGBA, GL_UNSIGNED_BYTE, data );
+                       glDisable(GL_TEXTURE_2D);
+               }
+       }
+       if(is2D && !Er)
+       {
+               t->data=malloc (4 * width * height);
+               offset =4 ;//RGBA  mod,TO DO implement other modes 
+               /*data upside down because of pango gl coord system*/
+               for (ind=0;ind < height; ind ++)
+               {
+                       srcData = data + (height - 1 -ind) * offset * width;
+                       tarData = t->data+ind * offset * width;
+                       memcpy(tarData,srcData,4*width);
+               }
+       }
+
+       if(Er)
+       {
+               free (data);
+               free (t);
+               return NULL;
+       }
+       t->userCount=1;
+       t->width=(GLfloat)width;
+       t->height=(GLfloat)height;
+       s->textureCount ++ ;
+       s->textures=realloc(s->textures,s->textureCount * sizeof(glCompTex*));
+       s->textures[s->textureCount-1]=t;
+       return t;
+
+
+}
+
+glCompTex* glCompSetAddNewTexImage(glCompSet* s,int width,int height,unsigned char* data,int is2D)
 {
-    glCompTexture *t;
-#ifdef _WIN32
-    BYTE *data;
-#else
-    unsigned char *data;
-#endif
-    FILE *file;
-    t = malloc(sizeof(glCompTexture));
-    glGenTextures(1, &t->id);
-
-    // allocate buffer
-    data = malloc(width * height * 3);
-    // open and read texture data
-    file = fopen(filename, "rb");
-    fread(data, width * height * 3, 1, file);
-    fclose(file);
-
-
-// select our current texture
-    glBindTexture(GL_TEXTURE_2D, t->id);
-
-    // select modulate to mix texture with color for shading
-    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-    // when texture area is small, bilinear filter the closest mipmap
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
-                   GL_LINEAR_MIPMAP_NEAREST);
-    // when texture area is large, bilinear filter the first mipmap
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
-    // if wrap is true, the texture wraps over at the edges (repeat)
-    //       ... false, the texture ends at the edges (clamp)
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
-                   (GLfloat) wrap ? (GLfloat) GL_REPEAT : GL_CLAMP);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
-                   (GLfloat) wrap ? (GLfloat) GL_REPEAT : GL_CLAMP);
-
-/*     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT );
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
-       glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
-       
-       // build our texture mipmaps
-       glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE,data);*/
-
-    gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, width, height,
-                     GL_RGB, GL_UNSIGNED_BYTE, data);
-
-    // free buffer
-    free(data);
-    t->w = (float) width;
-    t->h = (float) height;
-    return t;
+
+       glCompTex* t;
+       if (!data)
+               return NULL;
+       t=glCompSetAddNewTexture(s,width,height,data,is2D);
+       if (!t)
+               return NULL;
+       t->type=glTexImage;
+       return t;
+
+}
+
+
+
+
+glCompTex* glCompSetAddNewTexLabel(glCompSet* s, char* def,int fs,char* text,int is2D)
+{
+       int ind,Er,width,height;
+       int ind2=0;
+       glCompTex* t;
+       cairo_surface_t *surface=NULL;
+       unsigned char* data;
+       data=(unsigned char*)0;
+       Er=0;
+       if (!def)
+               return NULL;
+       /*first check if the same label with same font def created before
+               if it was , return its id
+       */
+       for (ind =0 ; ind < s->textureCount ; ind ++)
+       {
+               if(s->textures[ind]->type==glTexLabel)
+               {
+                       if ((strcmp(def,s->textures[ind]->def)==0)&&(s->textures[ind]->type == glTexLabel)&&(strcmp(text,s->textures[ind]->text)==0) )
+                       {
+                               s->textures[ind]->userCount ++;
+                               return s->textures[ind];
+                       }
+               }
+       }
+
+
+       data=   create_pango_texture(def,fs,text,surface,&width,&height);
+       if (!data)      /*pango error , */
+               Er=1;
+       t=glCompSetAddNewTexture(s,width,height,data,is2D);
+       if (!t) Er=1;
+    cairo_surface_destroy(surface);
+
+       if(Er)
+       {
+               free (data);
+               free (t);
+               return NULL;
+       }
+
+       t->def=strdup(def);
+       t->text=strdup(text);
+       t->type=glTexLabel;
+       return t;
 }
 
-int glCompDeleteTexture(glCompTexture * t)
+void glCompDeleteTexture(glCompTex* t)
 {
-    return 0;
+       if (!t)
+               return;
+       t->userCount --;
+       if (!t->userCount)
+       {
+               if (t->data)
+                       free (t->data);
+               if (t->def)
+                       free (t->def);
+               if (t->text)
+                       free (t->text);
+               free(t); 
+       }
 }
index 91bddadbb37e8dc73228807760377f9a14aa4afe..bf9ea39f657bafe6b4c45eee60f099dd87e71793 100644 (file)
@@ -17,8 +17,8 @@
   includes glPanel,glCompButton,glCompCustomButton,clCompLabel,glCompStyle
 */
 
-#ifndef GLCOMPTEXTURE_H
-#define GLCOMPTEXTURE_H
+#ifndef glCompFontURE_H
+#define glCompFontURE_H
 
 #ifdef _WIN32
 #include "windows.h"
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include "glcompdefs.h"
-
-
-
-glCompTexture *glCompCreateTextureFromRaw(char *filename, int width,
-                                         int height, int wrap);
-int glCompDeleteTexture(glCompTexture * t);
+extern glCompTex* glCompSetAddNewTexImage(glCompSet* s,int width,int height,unsigned char* data,int is2D);
+extern glCompTex* glCompSetAddNewTexLabel(glCompSet* s, char* def,int fs,char* text,int is2D);
 #endif
index 03ea5c17ac46a92f3d22c02587ed4ee116465bf4..320d2d183de77bc259ee27aaec648381051ac8e4 100644 (file)
@@ -29,9 +29,8 @@ static int file_exists(const char *filename)
     return 0;
 }
 
-static PangoLayout *get_pango_layout(cairo_t * cr,
-                                    char *markup_text,
-                                    char *fontdescription,
+static PangoLayout *get_pango_layout( char *markup_text,
+                                    char *fontdescription,int fontsize,
                                     double *width, double *height)
 {
     PangoFontDescription *desc;
@@ -46,9 +45,9 @@ static PangoLayout *get_pango_layout(cairo_t * cr,
     context =
        pango_cairo_font_map_create_context(PANGO_CAIRO_FONT_MAP(fontmap));
     options = cairo_font_options_create();
-#ifdef ANTIALIAS
-//      cairo_font_options_set_antialias(options,CAIRO_ANTIALIAS_GRAY);
-#endif
+
+       cairo_font_options_set_antialias(options,CAIRO_ANTIALIAS_GRAY);
+
     cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_FULL);
     cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_ON);
     cairo_font_options_set_subpixel_order(options,
@@ -58,8 +57,8 @@ static PangoLayout *get_pango_layout(cairo_t * cr,
     desc = pango_font_description_from_string(fontdescription);
 //      pango_font_description_set_family(desc, "CENTAUR.TTF");
     pango_font_description_set_size(desc,
-                                   (gint) (DEFAULT_FONT_SIZE *
-                                           PANGO_SCALE / 2.0));
+                                   (gint) (fontsize * PANGO_SCALE));
+
 //      pango_font_description_set_style    (desc,PANGO_STYLE_ITALIC);
 
     if (!pango_parse_markup
@@ -94,8 +93,7 @@ writer(void *closure, const unsigned char *data, unsigned int length)
     return CAIRO_STATUS_WRITE_ERROR;
 }
 
-int create_font_file(char *fontdescription, char *fontfile, float gw,
-                    float gh)
+int create_font_file(char *fontdescription,int fs, char *fontfile, float gw,float gh)
 {
 
     char buf[] = " ";
@@ -112,43 +110,43 @@ int create_font_file(char *fontdescription, char *fontfile, float gw,
     int return_value = -1;
 
     if (file_exists(fontfile)) //checking if font file has already been created
-       return 0;
+               return 0;
     //create the right size canvas for character set
-    surface =
-       cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
-                                  (int) ((float) ncolumns * gw),
-                                  (int) (gh * (float) ncolumns));
+    surface =cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int) ((float) ncolumns * gw),(int) (gh * (float) ncolumns));
     cr = cairo_create(surface);
     //draw a rectangle with same size of canvas
-    cairo_rectangle(cr, 0, 0, (float) ncolumns * gw,
-                   gh * (float) ncolumns);
+    cairo_rectangle(cr, 0, 0, (float) ncolumns * gw, gh * (float) ncolumns);
     //fill rectangle with black
     cairo_set_source_rgb(cr, 0, 0, 0);
     cairo_fill(cr);
     //set pen color to white
     cairo_set_source_rgb(cr, 1, 1, 1);
 
-    for (c = 0; c < 256; c++) {
-       counter++;
-       if ((c != 38) && (c != 60) && (c != 128) && (c < 129))
-           buf[0] = c;
-       else
-           buf[0] = ' ';
-       cairo_move_to(cr, X, Y);
-       layout =
-           get_pango_layout(cr, buf, fontdescription, &width, &height);
-       pango_cairo_show_layout(cr, layout);
-       X = X + (int) gw;
-       if (counter == ncolumns) {
-           X = 0;
-           Y = Y + (int) gh;
-           counter = 0;
-       }
+    for (c = 0; c < 256; c++) 
+       {
+               counter++;
+               if ((c != 38) && (c != 60) && (c != 128) && (c < 129))
+                       buf[0] = c;
+               else
+                       buf[0] = ' ';
+               cairo_move_to(cr, X, Y);
+               layout =
+                       get_pango_layout(buf, fontdescription,fs, &width, &height);
+               pango_cairo_show_layout(cr, layout);
+               X = X + (int) gw;
+               if (counter == ncolumns) 
+               {
+                       X = 0;
+                       Y = Y + (int) gh;
+                       counter = 0;
+               }
     }
+
     output_file = fopen(fontfile, "wb+");
-    if (output_file) {
-       cairo_surface_write_to_png_stream(surface, writer, output_file);
-       return_value = 0;
+    if (output_file) 
+       {
+               cairo_surface_write_to_png_stream(surface, writer, output_file);
+               return_value = 0;
     }
     fclose(output_file);
     g_object_unref(layout);
@@ -156,3 +154,50 @@ int create_font_file(char *fontdescription, char *fontfile, float gw,
     cairo_surface_destroy(surface);
     return return_value;
 }
+
+
+unsigned char* create_pango_texture(char *fontdescription,int fontsize,char* txt,cairo_surface_t *surface,int* w,int* h)
+{
+
+    char buf[] = " ";
+    int ncolumns = 16;
+    int counter = 0;
+    int X = 0;
+    int Y = 0;
+    cairo_t *cr;
+    PangoLayout *layout;
+    double width, height;
+       FILE* output_file;
+
+       layout =get_pango_layout(txt, fontdescription, fontsize,&width, &height);
+       //create the right size canvas for character set
+       surface =cairo_image_surface_create(CAIRO_FORMAT_ARGB32,(int)width,(int)height);
+//     surface =cairo_image_surface_create(CAIRO_FORMAT_A8,(int)width,(int)height);
+
+    cr = cairo_create(surface);
+    //draw a rectangle with same size of canvas
+//    cairo_rectangle(cr, 5, 5, width*1.8,height*1.8);
+    //fill rectangle with black
+//    cairo_set_source_rgba(cr, 0.5, 0.5, 0.5,0.3);
+//    cairo_fill(cr);
+    //set pen color to white
+    cairo_set_source_rgba(cr, 1, 1, 1,1);
+       //draw the text
+       pango_cairo_show_layout(cr, layout);
+
+       output_file = fopen("c:/graphviz-ms/test_folder/test.png", "wb+");
+    if (output_file) 
+       {
+               cairo_surface_write_to_png_stream(surface, writer, output_file);
+
+       }
+
+
+       *w=(int)width;
+       *h=(int)height;
+    g_object_unref(layout);
+    cairo_destroy(cr);
+    fclose(output_file);
+
+       return cairo_image_surface_get_data (surface);
+}
index a99fcfdb51aadf70720c5e3906f8b5e60a7c94d8..95a40963ca4886566f1cb47e87fc96938d79f364 100644 (file)
@@ -21,7 +21,9 @@
 
 //creates a font file with given name and font description
 //returns non-zero if fails
-int create_font_file(char* fontdescription,char* fontfile,float gw,float gh);
+unsigned char* create_pango_texture(char *fontdescription,int fontsize,char* txt,cairo_surface_t *surface,int* w,int* h);
+int create_font_file(char *fontdescription,int fs, char *fontfile, float gw,float gh);
+
 
 #endif
 
index 7536ddabe72b345e5ee50078c2410c093f8d8a40..0eafbc52d0acb2afcaa1aad5dfd8303f93673ba9 100644 (file)
@@ -16,6 +16,7 @@
 #include "glutils.h"
 #include "stdlib.h"
 #include "string.h"
+#include "glcompdefs.h"
 /* #include "glexpose.h" */
 
 /* at given depth value, tranforms 2d Window location to 3d gl coords*/
@@ -176,20 +177,23 @@ void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z)
     winX = (float) x;
     winY = (float) viewport[3] - (float) y;
 
-    glReadPixels(x - WIDTH / 2.0, (int) winY - WIDTH / 2.0, WIDTH, WIDTH,
+    glReadPixels(x - WIDTH / 2, (int) winY - WIDTH / 2, WIDTH, WIDTH,
                 GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);
     comp = -9999999;
-    for (idx = 0; idx < WIDTH * WIDTH; idx++) {
-       if ((winZ[idx] > comp) && (winZ[idx] < 1))
-           comp = winZ[idx];
+    for (idx = 0; idx < WIDTH * WIDTH; idx++) 
+       {
+//             printf ("Z value:%f ",winZ[idx]);
+               if ((winZ[idx] > comp) && (winZ[idx] < 1))
+                       comp = winZ[idx];
     }
-    gluUnProject(winX, winY, comp, modelview, projection, viewport, &posX,
+//     printf ("\n");
+
+       gluUnProject(winX, winY, comp, modelview, projection, viewport, &posX,
                 &posY, &posZ);
 
     *X = (GLfloat) posX;
     *Y = (GLfloat) posY;
     *Z = (GLfloat) posZ;
-//    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     return;
 
 
@@ -301,9 +305,9 @@ static double len(point3f p)
 
 static point3f scale(double d, point3f p)
 {
-    p.x *= d;
-    p.y *= d;
-    p.z *= d;
+    p.x *= (float)d;
+    p.y *= (float)d;
+    p.z *= (float)d;
     return p;
 }
 
@@ -370,7 +374,7 @@ double point_to_lineseg_dist(point3f p, point3f a, point3f b)
     point3f ba = sub(b, a);
     point3f pa = sub(p, a);
 
-    U = dot(pa, ba) / dot(ba, ba);
+    U = (float)(dot(pa, ba) / dot(ba, ba));
 
     if (U > 1)
        q = b;
@@ -412,35 +416,229 @@ void replacestr(char *source, char **target)
 
 #define G_PI    3.1415926535897932384626433832795028841971693993751
 #define DEG2RAD  G_PI/180
-int rot_spherex(plane J, double tet, point3f P, point3f * P2)
+int rot_spherex(plane J, float tet, point3f P, point3f * P2)
 {
     if (tet > 0) {
        tet = 5;
-       tet = DEG2RAD * tet;
+       tet = (float)DEG2RAD * tet;
        P2->x =
            (float) (J.N.x * J.N.x +
-                    cos(tet) * (1 - J.N.x * J.N.x)) * P.x +
-           (J.N.x * J.N.y * (1 - cos(tet)) - J.N.z * sin(tet))
-           + (J.N.z * J.N.x * (1 - cos(tet)) + J.N.y * sin(tet)) * P.z;
+                    (float)cos(tet) * (1 - J.N.x * J.N.x)) * P.x +
+           (J.N.x * J.N.y * (1 - (float)cos(tet)) - J.N.z * (float)sin(tet))
+           + (J.N.z * J.N.x * (1 - (float)cos(tet)) + J.N.y * (float)sin(tet)) * P.z;
        P2->y =
-           (float) (J.N.x * J.N.y * (1 - cos(tet)) +
-                    J.N.z * sin(tet)) * P.x + (J.N.y * J.N.y +
-                                               cos(tet) * (1 -
+           (float) (J.N.x * J.N.y * (1 - (float)cos(tet)) +
+                    J.N.z * (float)sin(tet)) * P.x + (J.N.y * J.N.y +
+                                               (float)cos(tet) * (1 -
                                                            J.N.y *
                                                            J.N.y)) * P.y +
-           (J.N.y * J.N.z * (1 - cos(tet)) - J.N.x * sin(tet)) * P.z;
+           (J.N.y * J.N.z * (1 - (float)cos(tet)) - J.N.x * (float)sin(tet)) * P.z;
        P2->z =
-           (float) (J.N.z * J.N.x * (1 - cos(tet)) -
-                    J.N.y * sin(tet)) * P.x + (J.N.y * J.N.z * (1 -
-                                                                cos(tet))
-                                               + J.N.x * sin(tet)) * P.y +
-           (J.N.z * J.N.z + cos(tet) * (1 - J.N.z * J.N.z)) * P.z;
+           (float) (J.N.z * J.N.x * (1 - (float)cos(tet)) -
+                    J.N.y * (float)sin(tet)) * P.x + (J.N.y * J.N.z * (1 -
+                                                                (float)cos(tet))
+                                               + J.N.x * (float)sin(tet)) * P.y +
+           (J.N.z * J.N.z + (float)cos(tet) * (1 - J.N.z * J.N.z)) * P.z;
        return 1;
     } else
        return 0;
 
 }
 
+void glCompSelectionBox(glCompSet* s)
+{
+       static GLfloat x,y,w,h;
+/*     if (( h < 0)  || (w < 0))
+       {
+           glEnable(GL_LINE_STIPPLE);
+               glLineStipple(1, 15);
+       }*/
+
+       x=s->mouse.pos.x;       
+       y=s->mouse.pos.y;       
+       w=s->mouse.dragX;
+       h=s->mouse.dragY;
+       printf ("%f %f  %f  %f \n",x,y,w,h);
+       glColor4f(1,1,1,1);
+/*     glBegin(GL_POLYGON);
+               glVertex2f(x,y);
+               glVertex2f(x, y+h);
+               glVertex2f(x-w, y+h);
+               glVertex2f(x-w, y);
+               glVertex2f(x-w, y);
+
+       glEnd();*/
+
+       glBegin(GL_POLYGON);
+               glVertex2f(0,0);
+               glVertex2f(250, 0);
+               glVertex2f(250, 250);
+               glVertex2f(0, 250);
+               glVertex2f(0,0);
+
+       glEnd();
+
+
+    glDisable(GL_LINE_STIPPLE);
+
+
+
+}
+
+
+
+
+
+void glCompCalcWidget(glCompCommon* parent,glCompCommon* child,glCompCommon* ref)
+{
+       /*check alignments first , alignments overrides anchors*/
+       GLfloat borderWidth;
+       ref->height=child->height;
+       ref->width=child->width;
+       if (parent->borderType == glBorderNone)
+               borderWidth=0;
+       else
+               borderWidth=parent->borderWidth;
+       if(child->align != glAlignNone) //if alignment, make sure width and height is no greater than parent
+       {
+               if (child->width > parent->width)
+                       ref->width=parent->width-(float)2.0 * borderWidth ;
+               if (child->height > parent->height)
+                       ref->height=parent->height-(float)2.0 * borderWidth ;;
+
+       }
+
+       ref->pos.x=parent->refPos.x+ref->pos.x+borderWidth;
+       ref->pos.y=parent->refPos.y+ref->pos.y+borderWidth;
+               
+
+       switch (child->align)
+       {
+               case glAlignLeft:
+                       ref->pos.x=parent->refPos.x+borderWidth;
+                       ref->pos.y=parent->refPos.y+borderWidth;
+                       ref->height=parent->height-2*borderWidth;
+                       break;
+               case glAlignRight:
+                       ref->pos.x=parent->refPos.x+parent->width-child->width-borderWidth;
+                       ref->pos.y=parent->refPos.y+borderWidth;
+                       ref->height=parent->height-2*borderWidth;
+                       break;
+
+               case glAlignTop:
+                       ref->pos.y=parent->refPos.y+parent->height-child->height-borderWidth;
+                       ref->pos.x=parent->refPos.x;
+                       ref->width=parent->width-2*borderWidth;
+                       break;
+
+               case glAlignBottom:
+                       ref->pos.y=parent->refPos.y+borderWidth;
+                       ref->pos.x=parent->refPos.x+borderWidth;
+                       ref->width=parent->width-2*borderWidth;
+                       break;
+               case glAlignParent:
+                       ref->pos.y=parent->refPos.y+borderWidth;
+                       ref->pos.x=parent->refPos.x+borderWidth;;
+                       ref->width=parent->width-2*borderWidth;;
+                       ref->height=parent->height-2*borderWidth;
+                       break;
+       }
+       if(child->align == glAlignNone) // No alignment , chekc anchors
+       {
+               ref->pos.x=parent->refPos.x+child->pos.x+borderWidth;
+               ref->pos.y=parent->refPos.y+child->pos.y+borderWidth;
+
+               if (child->anchor.leftAnchor)
+                       ref->pos.x=parent->refPos.x+child->anchor.left+borderWidth;
+               if (child->anchor.bottomAnchor )
+                       ref->pos.y=parent->refPos.y+child->anchor.bottom+borderWidth;
+
+               if (child->anchor.topAnchor)
+                       ref->height =parent->refPos.y+parent->height-ref->pos.y-child->anchor.top-borderWidth;
+               if (child->anchor.rightAnchor)
+                       ref->width = parent->refPos.x+parent->width - ref->pos.x - child->anchor.right-borderWidth;
+       }
+       child->refPos.x=ref->pos.x;
+       child->refPos.y=ref->pos.y;
+       child->width=ref->width;
+       child->height=ref->height;
+}
+static void glCompVertex(glCompPoint* p)
+{
+       glVertex3f(p->x,p->y,p->z);
+}
+static void glCompQuadVertex(glCompPoint* p0,glCompPoint* p1,glCompPoint* p2,glCompPoint* p3)
+{
+       glVertex3f(p0->x,p0->y,p0->z);
+       glVertex3f(p1->x,p1->y,p1->z);
+       glVertex3f(p2->x,p2->y,p2->z);
+       glVertex3f(p3->x,p3->y,p3->z);
+}
+void glCompSetColor(glCompColor* c)
+{
+       glColor4f(c->R,c->G,c->B,c->A);
+}
+
+void glCompDrawRectangle (glCompRect* r)
+{
+       glBegin(GL_QUADS);
+               glVertex3f(r->pos.x,r->pos.y,r->pos.z);
+               glVertex3f(r->pos.x+r->w,r->pos.y,r->pos.z);
+               glVertex3f(r->pos.x+r->w,r->pos.y+r->h,r->pos.z);
+               glVertex3f(r->pos.x,r->pos.y+r->h,r->pos.z);
+       glEnd();
+}
+void glCompDrawRectPrism (glCompPoint* p,GLfloat w,GLfloat h,GLfloat b,GLfloat d,glCompColor* c,int bumped)
+{
+       static GLfloat color_fac;
+       static glCompPoint A,B,C,D,E,F,G,H;
+       GLfloat dim=1.00;
+       if (!bumped)
+       {
+               color_fac=(GLfloat)1.3;
+               b=b-2;
+               dim=0.5;
+       }
+       else
+               color_fac=(GLfloat)1/(GLfloat)1.3;
+
+       
+       A.x=p->x;A.y=p->y;A.z=p->z;
+       B.x=p->x+w; B.y=p->y; B.z=p->z;
+       C.x=p->x+w; C.y=p->y+h; C.z=p->z;
+       D.x=p->x; D.y=p->y+h; D.z=p->z;
+       G.x=p->x+b; G.y=p->y+b; G.z=p->z+d;
+       H.x=p->x+w-b; H.y=p->y+b; H.z=p->z+d;
+       E.x=p->x+b; E.y=p->y+h-b; E.z=p->z+d;
+       F.x=p->x+w-b; F.y=p->y+h-b; F.z=p->z+d;
+       glBegin (GL_QUADS);
+               glColor4f(c->R*dim,c->G*dim,c->B*dim,c->A);
+               glCompQuadVertex(&G,&H,&F,&E);
+
+               glColor4f(c->R*color_fac*dim,c->G*color_fac*dim,c->B*color_fac*dim,c->A);
+               glCompQuadVertex(&A,&B,&H,&G);
+               glCompQuadVertex(&B,&H,&F,&C);
+
+               glColor4f(c->R/color_fac*dim,c->G/color_fac*dim,c->B/color_fac*dim,c->A);
+               glCompQuadVertex(&A,&G,&E,&D);
+               glCompQuadVertex(&E,&F,&C,&D);
+       glEnd();
+
+}
+void copy_glcomp_color(glCompColor* source,glCompColor* target)
+{
+       target->R=source->R;
+       target->G=source->G;
+       target->B=source->B;
+       target->A=source->A;
+
+}
+
+
+
+
+
+
 #ifdef DEBUG
 void main(void)
 {
index 9275515f3beb3abf00f9229fba415c83e8962a75..8f927e25a658db33e33393b733ef3a8b2a825089 100644 (file)
@@ -20,6 +20,7 @@
 #endif
 #include <GL/gl.h>
 #include <GL/glu.h>
+#include "glcompdefs.h"
 
 
 typedef struct {
@@ -42,7 +43,14 @@ void to3D(int x, int y, GLfloat * X, GLfloat * Y,GLfloat * Z);
 void linear_interplotate (float,float,float,float,float,float*);
 double point_to_line_dist(point3f p, point3f u, point3f v);
 double point_to_lineseg_dist (point3f p, point3f a, point3f b);
-int rot_spherex(plane J,double tet,point3f P,point3f* P2);
+int rot_spherex(plane J,float tet,point3f P,point3f* P2);
 void make_plane(point3f a,point3f b,point3f c,plane* P);
 void replacestr(char *source,char **target);
+extern void glCompCalcWidget(glCompCommon* parent,glCompCommon* child,glCompCommon* ref);
+extern void glCompDrawRectangle (glCompRect* r);
+extern void glCompDrawRectPrism (glCompPoint* p,GLfloat w,GLfloat h,GLfloat b,GLfloat d,glCompColor* c,int bumped);
+extern void copy_glcomp_color(glCompColor* source,glCompColor* target);
+extern void glCompSetColor(glCompColor* c);
+
+void glCompSelectionBox(glCompSet* s);
 #endif
index 360b85b2feaf8dafc8167d7ecc94a14ef1096f8a..1e224cbe5f3f250d89cce85c58139b2635c739b0 100644 (file)
@@ -333,3 +333,4 @@ getPackModeInfo
 parsePackModeInfo
 putRects
 xdotBB
+gvFinalize