]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gnome/GnomeBase.C
A lean, clean and working start to the new, improved gnome frontend.
[lyx.git] / src / frontends / gnome / GnomeBase.C
index 631d5f2c506e7dc0fc1bbb67764e5cec04c539cb..e7d00f8585e99fe97b8483c60d7052372e094ee0 100644 (file)
@@ -1,7 +1,6 @@
-// -*- C++ -*-
 /* This file is part of
  * =================================================
- * 
+ *
  *          LyX, The Document Processor
  *          Copyright 1995 Matthias Ettrich.
  *          Copyright 1995-2000 The LyX Team.
 #include "support/filetools.h"
 #include <glib.h>
 
-GnomeBase::GnomeBase(ControlBase & c, string const & glade_file, string const & name)
-       : ViewBC<gnomeBC>(c), file_(glade_file), widget_name_(name), xml_(0)
+#include <gnome--/dialog.h>
+
+GnomeBase::GnomeBase(ControlButtons & c,
+                string const & name)
+       : ViewBC<gnomeBC>(c)
+       , file_(name + ".glade"), widget_name_(name), xml_(0)
+       , dialog_(0)
 {}
-       
+
 GnomeBase::~GnomeBase()
 {
-     gtk_object_unref(GTK_OBJECT(xml_));
+       if (xml_)
+               gtk_object_unref(GTK_OBJECT(xml_));
 }
 
-       
+
 void GnomeBase::loadXML() const
 {
+#ifdef WITH_WARNINGS
 #warning Change this before declaring it production code! (be 20010325)
-       string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;/home/baruch/prog/lyx/graphics/src/frontends/gnome/dialogs/");
+#endif
+       string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;");
        string const file = FileOpenSearch(path, file_, "glade");
 
        if (file.empty()) {
                lyxerr << "Cannot find glade file. Aborting." << std::endl;
-               Assert(true);
+               lyx::Assert(true);
        }
-       
+
        lyxerr[Debug::GUI] << "Glade file to open is " << file << '\n';
-       
+
        xml_ = glade_xml_new(file.c_str(), widget_name_.c_str());
 }
+
+
+void GnomeBase::show()
+{
+       update();
+       dialog()->show();
+}
+
+
+void GnomeBase::hide()
+{
+       dialog()->hide();
+}
+
+bool GnomeBase::validate()
+{
+       return true;
+}
+
+void GnomeBase::OKClicked()
+{
+       lyxerr[Debug::GUI] << "GnomeBase::OKClicked()\n";
+       OKButton();
+}
+
+void GnomeBase::CancelClicked() 
+{ 
+       lyxerr[Debug::GUI] << "GnomeBase::CancelClicked()\n";
+       CancelButton(); 
+}
+
+void GnomeBase::ApplyClicked() 
+{ 
+       lyxerr[Debug::GUI] << "GnomeBase::ApplyClicked()\n";
+       ApplyButton(); 
+}
+
+void GnomeBase::RestoreClicked() 
+{ 
+       lyxerr[Debug::GUI] << "GnomeBase::RestoreClicked()\n";
+       RestoreButton(); 
+}
+
+void GnomeBase::InputChanged()
+{
+       bc().valid(validate());
+}
+
+Gnome::Dialog * GnomeBase::dialog()
+{
+       if (!dialog_)
+               dialog_ = getWidget<Gnome::Dialog>(widget_name_.c_str());
+
+       return dialog_;
+}