summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Gui/AspectFrame.h4
-rw-r--r--src/Gui/RenderArea.cpp2
-rw-r--r--src/Gui/RenderArea.h4
-rw-r--r--src/Gui/Window.cpp16
-rw-r--r--src/Gui/Window.h4
-rw-r--r--src/Instance.cpp26
-rw-r--r--src/Instance.h4
7 files changed, 27 insertions, 33 deletions
diff --git a/src/Gui/AspectFrame.h b/src/Gui/AspectFrame.h
index 0831956..1008464 100644
--- a/src/Gui/AspectFrame.h
+++ b/src/Gui/AspectFrame.h
@@ -21,7 +21,7 @@
#define ZOOMEDIT_GUI_ASPECTFRAME_H_
#include <gtkmm/aspectframe.h>
-#include <iostream>
+#include <gtkmm/builder.h>
namespace ZoomEdit {
namespace Gui {
@@ -40,7 +40,7 @@ class AspectFrame : public Gtk::AspectFrame {
}
public:
- AspectFrame(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml>&)
+ AspectFrame(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder>&)
: Gtk::AspectFrame(cobject), width(-1) {
signal_size_allocate().connect(sigc::mem_fun(this, &AspectFrame::onSizeAllocate));
}
diff --git a/src/Gui/RenderArea.cpp b/src/Gui/RenderArea.cpp
index 0fcc9ce..8065dc3 100644
--- a/src/Gui/RenderArea.cpp
+++ b/src/Gui/RenderArea.cpp
@@ -29,7 +29,7 @@ namespace Gui {
GdkGLConfig *RenderArea::glconfig = 0;
-RenderArea::RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml>&)
+RenderArea::RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder>&)
: Gtk::DrawingArea(cobject), view(0), inWindow(false) {
if(!glconfig) {
glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DOUBLE));
diff --git a/src/Gui/RenderArea.h b/src/Gui/RenderArea.h
index d42a352..ea3f815 100644
--- a/src/Gui/RenderArea.h
+++ b/src/Gui/RenderArea.h
@@ -20,9 +20,9 @@
#ifndef ZOOMEDIT_GUI_RENDERAREA_H_
#define ZOOMEDIT_GUI_RENDERAREA_H_
+#include <gtkmm/builder.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/scrollbar.h>
-#include <libglademm/xml.h>
#include <gtk/gtkgl.h>
namespace ZoomEdit {
@@ -35,7 +35,7 @@ namespace Gui {
class RenderArea : public Gtk::DrawingArea {
public:
- RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml>&);
+ RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder>&);
View::View* getView() const {return view;}
void setView(View::View *view0);
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 6d614fb..dcc8f45 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -21,16 +21,22 @@
#include "RenderArea.h"
#include "AspectFrame.h"
+#include <gtkmm/action.h>
+
namespace ZoomEdit {
namespace Gui {
-Window::Window(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &xml)
+Window::Window(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &builder)
: Gtk::Window(cobject) {
- xml->connect_clicked("MenuItemQuit", sigc::mem_fun(this, &Window::hide));
- xml->get_widget_derived("RenderArea", renderArea);
- xml->get_widget_derived("MapArea", mapArea);
- xml->get_widget_derived("AspectFrameMap", aspectFrameMap);
+ Glib::RefPtr<Gtk::Action> itemQuit = Glib::RefPtr<Gtk::Action>::cast_dynamic(builder->get_object("MenuItemQuit"));
+ if(itemQuit) {
+ itemQuit->signal_activate().connect(sigc::mem_fun(this, &Window::hide));
+ }
+
+ builder->get_widget_derived("RenderArea", renderArea);
+ builder->get_widget_derived("MapArea", mapArea);
+ builder->get_widget_derived("AspectFrameMap", aspectFrameMap);
}
Window::~Window() {
diff --git a/src/Gui/Window.h b/src/Gui/Window.h
index a0934f5..97ebcda 100644
--- a/src/Gui/Window.h
+++ b/src/Gui/Window.h
@@ -20,8 +20,8 @@
#ifndef ZOOMEDIT_GUI_WINDOW_H_
#define ZOOMEDIT_GUI_WINDOW_H_
+#include <gtkmm/builder.h>
#include <gtkmm/window.h>
-#include <libglademm/xml.h>
namespace ZoomEdit {
namespace Gui {
@@ -35,7 +35,7 @@ class Window : public Gtk::Window {
AspectFrame *aspectFrameMap;
public:
- Window(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &xml);
+ Window(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &builder);
virtual ~Window();
RenderArea* getRenderArea() const {return renderArea;}
diff --git a/src/Instance.cpp b/src/Instance.cpp
index 351a6d7..ce0d239 100644
--- a/src/Instance.cpp
+++ b/src/Instance.cpp
@@ -35,29 +35,17 @@ guint Instance::instances = 0;
Instance::Instance(const Glib::ustring &file) : window(0), levelXml(0), level(0), view(0) {
instances++;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
- try
- {
- xml = Gnome::Glade::Xml::create("zoomedit.glade");
+ try {
+ builder = Gtk::Builder::create_from_file("zoomedit.ui");
}
- catch(const Gnome::Glade::XmlError& ex)
- {
+ catch(const Glib::Exception& ex) {
std::cerr << ex.what() << std::endl;
return;
}
-#else
- std::auto_ptr<Gnome::Glade::XmlError> error;
- xml = Gnome::Glade::Xml::create("zoomedit.glade", "", "", error);
- if(error.get())
- {
- std::cerr << error->what() << std::endl;
- return;
- }
-#endif
- xml->get_widget_derived("WindowMain", window);
+ builder->get_widget_derived("WindowMain", window);
if(!window) {
- xml.clear();
+ builder.clear();
return;
}
@@ -70,10 +58,10 @@ Instance::Instance(const Glib::ustring &file) : window(0), levelXml(0), level(0)
window->getMapArea()->setView(mapView);
Gtk::ToolButton *button;
- xml->get_widget("ToolButtonZoomIn", button);
+ builder->get_widget("ToolButtonZoomIn", button);
button->signal_clicked().connect(sigc::bind(sigc::mem_fun(view, &View::TopView::zoom), 2, 0, 0));
- xml->get_widget("ToolButtonZoomOut", button);
+ builder->get_widget("ToolButtonZoomOut", button);
button->signal_clicked().connect(sigc::bind(sigc::mem_fun(view, &View::TopView::zoom), -2, 0, 0));
if(file.empty())
diff --git a/src/Instance.h b/src/Instance.h
index 679ccbe..090e2f1 100644
--- a/src/Instance.h
+++ b/src/Instance.h
@@ -20,8 +20,8 @@
#ifndef ZOOMEDIT_INSTANCE_H_
#define ZOOMEDIT_INSTANCE_H_
+#include <gtkmm/builder.h>
#include <gtkmm/main.h>
-#include <libglademm/xml.h>
#include <libxml++/parsers/domparser.h>
namespace ZoomEdit {
@@ -52,7 +52,7 @@ class Instance {
private:
static guint instances;
- Glib::RefPtr<Gnome::Glade::Xml> xml;
+ Glib::RefPtr<Gtk::Builder> builder;
Gui::Window *window;
xmlpp::DomParser *levelXml;