1 /* Gabedit.c */
2 /**********************************************************************************************************
3 Copyright (c) 2002-2013 Abdul-Rahman Allouche. All rights reserved
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6 documentation files (the Gabedit), to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
8 and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9 
10   The above copyright notice and this permission notice shall be included in all copies or substantial portions
11   of the Software.
12 
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
14 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
16 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17 DEALINGS IN THE SOFTWARE.
18 ************************************************************************************************************/
19 
20 
21 #include "../../Config.h"
22 #include <gtk/gtk.h>
23 #include <gdk/gdk.h>
24 #include <gtk/gtkgl.h>
25 #include <glib.h>
26 #include <glib/gi18n.h>
27 #include <stdlib.h>
28 #include <unistd.h>
29 
30 #include "Global.h"
31 #include "MenuToolBar.h"
32 #include "TextEdit.h"
33 #include "../Utils/UtilsInterface.h"
34 #include "../Utils/Utils.h"
35 #include "../Utils/AtomsProp.h"
36 #include "../Geometry/GeomGlobal.h"
37 #include "SplashScreen.h"
38 #include "Install.h"
39 #include "../Files/ListeFiles.h"
40 #include "Windows.h"
41 #include "StockIcons.h"
42 
43 GtkWidget *hseparator;
44 
main(int argc,char * argv[])45 int main(int argc, char *argv[])
46 {
47 
48   GtkWidget* vboxp;
49   gchar* poDir = NULL;
50   gint ierr;
51 
52   srand((unsigned int)time(NULL));
53   /*
54   printf("%s",g_filename_from_utf8("My test\n",-1,0,0,0));
55   exit(1);
56   */
57   /*
58   g_setenv("LANG","en_US",TRUE);
59   g_setenv("GDM_LANG","en_US",TRUE);
60   */
61    /* setlocale(LC_ALL,"");*/
62    setlocale(LC_ALL,"C");
63    poDir = g_build_filename (g_get_current_dir(),"locale",NULL);
64    bindtextdomain (GETTEXT_PACKAGE, poDir);
65    /* printf("poDir = %s\n",poDir);*/
66    g_free (poDir);
67    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
68    textdomain (GETTEXT_PACKAGE);
69 
70    /*
71    if (!g_thread_supported ()){ g_thread_init (NULL); }
72    gdk_threads_init ();
73    gdk_threads_enter ();
74    */
75 
76 
77   gtk_init(&argc, &argv);
78   gtk_gl_init(&argc, &argv);
79   setlocale(LC_NUMERIC,"C");
80   gabedit_gtk_stock_init();
81 
82 /* Initialisation */
83   initialise_global_variables();
84   /* set_default_styles();*/
85 
86   Fenetre = gtk_window_new(GTK_WINDOW_TOPLEVEL);
87   gtk_window_set_title(GTK_WINDOW(Fenetre),"Gabedit");
88   gtk_widget_set_size_request (GTK_WIDGET(Fenetre), 2*ScreenWidth/5, 2*ScreenHeight/5);
89 #ifdef G_OS_WIN32
90   gtk_window_set_default_size (GTK_WINDOW(Fenetre), ScreenWidth, ScreenHeight-65);
91   gtk_window_set_position(GTK_WINDOW(Fenetre),GTK_WIN_POS_CENTER);
92 #else
93   gtk_window_set_default_size (GTK_WINDOW(Fenetre), ScreenWidth, ScreenHeight-80);
94 #endif
95   gtk_widget_set_size_request (GTK_WIDGET(Fenetre), 2*ScreenWidth/5, 2*ScreenHeight/5);
96   gtk_window_set_default_size (GTK_WINDOW(Fenetre), 2*ScreenWidth/5, 2*ScreenHeight/5);
97 
98   gtk_widget_realize(Fenetre);
99   g_signal_connect(G_OBJECT(Fenetre), "delete_event",(GCallback)exit_all,NULL);
100 
101   cree_p_vbox();
102   vboxp = vboxmain;
103 
104   add_menu_toolbar();
105 
106   cree_vboxs_list_text();
107   cree_text_notebook();
108   create_frame_windows(vboxp);
109   cree_files_out_err_notebook(vboxtexts);
110 
111   read_ressource_file();
112   /* set_default_styles();*/
113   ListeFiles(vboxlistfiles);
114   resetFontLabelErrOut();
115 
116   if(argc>1) get_doc(argv[1]);
117 
118   imodif = DATA_MOD_NO;
119   set_icon_default();
120   set_icone(Fenetre);
121 
122   user_install_verify(splash_screen);
123   set_default_styles();
124   set_path();
125   ierr = chdir(g_get_home_dir());
126 
127 #ifndef DRAWGEOMGL
128   Message(_("\n\n"
129 	    "Many tools implemented in Gabedit/OpenGL version\nare not available in Gabedit/Cairo one.\n"
130 	    "\n"),
131 	    _("Warning"),TRUE);
132 #endif
133 
134   gtk_main();
135   /* gdk_threads_leave ();*/
136 
137   return 0;
138 }
139