]> granicus.if.org Git - graphviz/commitdiff
hard-coded pathnames removed for windows
authorarif <devnull@localhost>
Mon, 11 May 2009 18:30:30 +0000 (18:30 +0000)
committerarif <devnull@localhost>
Mon, 11 May 2009 18:30:30 +0000 (18:30 +0000)
cmd/smyrna/main.c
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topview.c
cmd/smyrna/viewport.c
share/gui/smyrna.glade

index 727175d66323b7a8add87219a97e9d2a654c34bb..af1fb23c87f2b81ff77fb9ceaaa35002cb5f20a9 100755 (executable)
@@ -66,6 +66,8 @@ smyrnaPath (char* suffix)
     return buf;
 }
 
+
+
 static char *useString = "Usage: smyrn [-txv?] [-K<engine>] <file>\n\
   -n         - use TopView mode\n\
   -e         - use XDOT mode\n\
@@ -162,6 +164,7 @@ int main(int argc, char *argv[])
     textdomain(GETTEXT_PACKAGE);
 #endif
     view = NEW(ViewInfo);
+
     init_viewport(view);
     gtk_set_locale();
     gtk_init(&argc, &argv);
@@ -172,7 +175,7 @@ int main(int argc, char *argv[])
 #endif
     if (!(smyrnaGlade)) {
 #ifdef _WIN32
-       smyrnaGlade = SMYRNA_GLADE;
+               smyrnaGlade = view->glade_file;
 #else
        smyrnaGlade = smyrnaPath ("smyrna.glade");
 #endif
index 574b98253a56374203320b7b57841ad06553c448..bef44a804114e8afdebb3afe626452475a8c091d 100644 (file)
 //#define       SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
 #define        SMYRNA_ATTRS "c:/graphviz-ms/graphviz2/share/gui/attrs.txt"
 #endif
-#ifdef _WIN32
-#define SMYRNA_GLADE "c:/graphviz-ms/graphviz2/share/gui/smyrna.glade"
-#define GTKTOPVIEW_ATTRS "c:/graphviz-ms/share/gui/attrs.txt"
-#define DEFAULT_ATTRIBUTES_TEMPLATE_DOT_FILE   "c:/graphviz-ms/graphviz2/share/gui/attr_template.dot"
-// #else
-// using -DGTKTOPVIEW_GLADE from Makefile.am and configure.ac
-// using -DGTKTOPVIEW_ATTRS from Makefile.am and configure.ac
-#endif
 #ifdef WIN32                   //this  is needed on WIN32 to get libglade see the callback
 #define _BB  __declspec(dllexport)
 #else
@@ -547,6 +539,10 @@ typedef struct _ViewInfo
        char* initFileName;     //file name from command line
        int initFile;
        colorschemaset* colschms;
+       char* template_file;
+       char* glade_file;
+       char* attr_file;
+
 
 
 } ViewInfo;
index 2497457a6e6c62ce2a9671d4835b29948bd54dcc..4999a9bf151f61ffed29acc5d44bc3dfc1e06f8f 100755 (executable)
@@ -1855,3 +1855,5 @@ void select_with_regex(char* exp)
 
 }
 
+
+
index 4e24e31c469ed558a0ddf8d6e3653ea97dd605ad..3b7d3dcc5c2a6b6abf333147a8a971eb6e11393f 100755 (executable)
@@ -317,36 +317,66 @@ static gboolean gl_main_expose(gpointer data) {
        }
        return 0;
 }
-
-void init_viewport(ViewInfo * view)
+void get_data_dir()
 {
-    char *template_file;
-    FILE *input_file;
+/*
+#define SMYRNA_GLADE "c:/graphviz-ms/graphviz2/share/gui/smyrna.glade"
+#define GTKTOPVIEW_ATTRS "c:/graphviz-ms/share/gui/attrs.txt"
+#define DEFAULT_ATTRIBUTES_TEMPLATE_DOT_FILE   "c:/graphviz-ms/graphviz2/share/gui/attr_template.dot"
+*/
 
 
 
-    /*loading default visual attributes */
-#ifdef _WIN32
-    template_file = DEFAULT_ATTRIBUTES_TEMPLATE_DOT_FILE;
-#else
-    template_file = smyrnaPath ("template.dot");
+#ifdef WIN32
+
+       int a=GetCurrentDirectory(0, NULL);
+       if (view->template_file)
+       {
+               free(view->template_file);
+               free(view->glade_file);
+               free(view->attr_file);
+       }
+       view->template_file=(char*)malloc(sizeof(char)*(a+13));
+       view->glade_file=(char*)malloc(sizeof(char)*(a+13));
+       view->attr_file=(char*)malloc(sizeof(char)*(a+10));
+       GetCurrentDirectory(a, view->template_file);
+       GetCurrentDirectory(a, view->glade_file);
+       GetCurrentDirectory(a, view->attr_file);
+       strcat(view->template_file,"\\template.dot");
+       strcat(view->glade_file,"\\smyrna.glade");
+       strcat(view->attr_file,"\\attrs.txt");
+
+
+/*#define SMYRNA_GLADE "c:/graphviz-ms/graphviz2/share/gui/smyrna.glade"
+#define GTKTOPVIEW_ATTRS "c:/graphviz-ms/share/gui/attrs.txt"
+#define DEFAULT_ATTRIBUTES_TEMPLATE_DOT_FILE   "c:/graphviz-ms/graphviz2/share/gui/attr_template.dot"*/
+
+
 #endif
-    input_file = fopen(template_file, "r");
-    if (!input_file) {
-       fprintf (stderr, "default attributes template graph file \"%s\" not found\n", template_file);
-       exit(-1);
-    } else if (!(view->default_attributes = agread(input_file, 0))) {
-       fprintf (stderr, "could not load default attributes template graph file \"%s\"\n", template_file);
-       exit(-1);
+}
+
+void init_viewport(ViewInfo * view)
+{
+    FILE *input_file=NULL;
+
+       
+               get_data_dir();
+
+       input_file = fopen(view->template_file, "rb");
+       if (!input_file) {
+               fprintf (stderr, "default attributes template graph file \"%s\" not found\n", "c://graphviz-ms//bin//template");
+               exit(-1);
+    } else if (!(view->default_attributes = agread(input_file, 0))) 
+       {
+               fprintf (stderr, "could not load default attributes template graph file \"%s\"\n", view->template_file);
+               exit(-1);
     }
-#ifndef _WIN32
-    free (template_file);
-#endif
+
        //init graphs
     view->g = NULL;            //no graph, gl screen should check it
     view->graphCount = 0;      //and disable interactivity if count is zero
 
-    view->bdxLeft = 0;
+       view->bdxLeft = 0;
     view->bdxRight = 500;
     view->bdyBottom = 0;
     view->bdyTop = 500;
index 08331527708166e9dde1e5ce82e6e9f6002786f5..0ca1a3af99252f87c5a1dcd61486caff026bcde1 100755 (executable)
@@ -4718,50 +4718,6 @@ topview</property>
                    </packing>
                  </child>
 
-                 <child>
-                   <widget class="GtkCheckButton" id="settingsChkBox5">
-                     <property name="visible">True</property>
-                     <property name="relief">GTK_RELIEF_NORMAL</property>
-                     <property name="focus_on_click">True</property>
-                     <property name="active">False</property>
-                     <property name="inconsistent">False</property>
-                     <property name="draw_indicator">True</property>
-
-                     <child>
-                       <placeholder/>
-                     </child>
-                   </widget>
-                   <packing>
-                     <property name="left_attach">2</property>
-                     <property name="right_attach">3</property>
-                     <property name="top_attach">4</property>
-                     <property name="bottom_attach">5</property>
-                     <property name="x_options"></property>
-                   </packing>
-                 </child>
-
-                 <child>
-                   <widget class="GtkCheckButton" id="settingsChkBox4">
-                     <property name="visible">True</property>
-                     <property name="relief">GTK_RELIEF_NORMAL</property>
-                     <property name="focus_on_click">True</property>
-                     <property name="active">False</property>
-                     <property name="inconsistent">False</property>
-                     <property name="draw_indicator">True</property>
-
-                     <child>
-                       <placeholder/>
-                     </child>
-                   </widget>
-                   <packing>
-                     <property name="left_attach">2</property>
-                     <property name="right_attach">3</property>
-                     <property name="top_attach">3</property>
-                     <property name="bottom_attach">4</property>
-                     <property name="x_options"></property>
-                   </packing>
-                 </child>
-
                  <child>
                    <widget class="GtkCheckButton" id="settingsChkBox3">
                      <property name="visible">True</property>