- Move to libglademm to handle GUI creation. This is experimental,

but should greatly help in reducing development times


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@727 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-05 14:37:11 +00:00
parent 3dd8403f0a
commit 41d20ba6eb
5 changed files with 44 additions and 17 deletions

View File

@ -36,11 +36,11 @@ SUBDIRS += \
plugins/pyloader \
plugins/xmlsave
# directories definition
datarootdir = @datarootdir@
sharedir = $(pkgdatadir)
policiesdir = $(sharedir)/policies
plugindir = $(sharedir)/plugins
datarootdir = @datarootdir@
gladedir = $(sharedir)/glade
localedir = @datadir@/locale
aclocaldir = @datadir@/aclocal
@ -245,8 +245,11 @@ sgpemv2_CPPFLAGS = \
-I@top_srcdir@ \
-I@top_srcdir@/src/templates \
-DLOCALEDIR="\"$(localedir)\"" \
-DSHAREDIR="\"$(sharedir)\"" \
-DGLADEDIR="\"$(gladedir)\"" \
$(CAIRO_CFLAGS) \
$(GTKMM_CFLAGS) \
$(LIBGLADEMM_CFLAGS) \
$(PYTHON_CPPFLAGS) \
$(GTHREAD_CFLAGS)
sgpemv2_CXXFLAGS = $(VISIB_HIDDEN)
@ -255,6 +258,7 @@ sgpemv2_LDADD = \
src/backend/libbackend.la \
$(CAIRO_LIBS) \
$(GTKMM_LIBS) \
$(LIBGLADEMM_LIBS) \
$(GTHREAD_LIBS)
# Please keep this in sorted order:
@ -282,6 +286,11 @@ noinst_HEADERS += \
src/start_gui.hh \
src/text_simulation.hh
# ---------- glade files -----------
glade_DATA = \
glade/main-window.glade
# ############################################################
#
# source : templates

View File

@ -56,6 +56,7 @@ AM_GNU_GETTEXT_VERSION([0.14.1])
dnl various requisites
SIGCPP_VERSION=2.0.10
GTKMM_VERSION=2.8.0
LIBGLADEMM_VERSION=2.6.2
CAIRO_VERSION=1.0.0
dnl c++ compiler and flags
@ -92,6 +93,9 @@ PKG_CHECK_MODULES([GLIBMM],
PKG_CHECK_MODULES([GTKMM],
[gtkmm-2.4 >= $GTKMM_VERSION],
:, AC_MSG_ERROR([$GTKMM_PKG_ERRORS]))
PKG_CHECK_MODULES([LIBGLADEMM],
[libglademm-2.4 >= $LIBGLADEMM_VERSION],
:, AC_MSG_ERROR([$LIBGLADEMM_PKG_ERRORS]))
dnl use DSO visibility tags for systems that supports it correctly
SGPEMV2_VISIBILITY_SUPPORT

View File

@ -24,7 +24,7 @@
#include "main.hh"
#include "parse_opts.hh"
// #include "start_gui.hh"
#include "start_gui.hh"
#include "backend/plugin_manager.hh"
@ -66,5 +66,7 @@ main(int argc, char* argv[])
// Initializes plugin system
PluginManager::get_instance();
start_gui(argc, argv);
return 0;
}

View File

@ -21,24 +21,39 @@
#include "config.h"
#include "gettext.h"
#include "graphical_terminal_io.hh"
#include "start_gui.hh"
#include "smartp.tcc"
#include <libglademm/xml.h>
#include <gtkmm/main.h>
#include <gtkmm/menuitem.h>
#include <gtkmm/window.h>
#include <cassert>
void
start_gui(int argc, char** argv, TextSimulation& txt)
start_gui(int argc, char** argv)
{
Gtk::Main gtk_main(argc, argv);
using namespace Gnome;
using namespace Gtk;
GraphicalTerminalIO* gt = new sgpem::GraphicalTerminalIO(&txt);
memory::smart_ptr<sgpem::IOManager> main_window(gt);
txt.add_io_device(main_window);
Main gtk_main(argc, argv);
//print the initial status on each iomanager
//txt.update();
Glib::RefPtr<Glade::Xml> refXml =
Glade::Xml::create(GLADEDIR "/main-window.glade");
Gtk::Main::run(*gt);
Window* main_window = NULL;
refXml->get_widget("MainWindow", main_window);
assert(main_window != NULL);
// Connect extra signals (decide where to do this...
// here -- ugly -- derive widgets and then use
// Glade::Xml::get_widget_derived -- better --)
MenuItem* file_quit = NULL;
refXml->get_widget("Menu.File.Quit", file_quit);
file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit));
main_window->show_all_children();
Main::run(*main_window);
}

View File

@ -23,13 +23,10 @@
#include "config.h"
#include "text_simulation.hh"
/** \brief This function initialize and starts the whole GUI
*/
void SG_DLLEXPORT start_gui(int argc, char** argv, TextSimulation& txt);
void SG_DLLEXPORT start_gui(int argc, char** argv);
#endif