]> git.lyx.org Git - lyx.git/commitdiff
It compiles again. I must be crazy. At least it does not run but segfaults
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 18 Oct 2006 20:35:06 +0000 (20:35 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 18 Oct 2006 20:35:06 +0000 (20:35 +0000)
on startup.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15364 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/GToolbar.C
src/frontends/gtk/GViewBase.C
src/frontends/gtk/GViewBase.h
src/frontends/gtk/GuiApplication.C
src/frontends/gtk/GuiApplication.h
src/frontends/gtk/lyx_gui.C [deleted file]

index e79005d25de115ce880fbf14232c23abd5121345..f87119a88d7797700eb9b445ae0e56c3279a3029 100644 (file)
@@ -197,7 +197,7 @@ GToolbar::GToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & owner)
        ToolbarBackend::item_iterator it = tbb.items.begin();
        ToolbarBackend::item_iterator end = tbb.items.end();
        for (; it != end; ++it)
-               add(it->first, it->second);
+               add(it->first, lyx::from_utf8(it->second));
 
        toolbar_.set_toolbar_style(Gtk::TOOLBAR_ICONS);
        toolbar_.show_all();
@@ -233,10 +233,7 @@ void GToolbar::add(FuncRequest const & func, lyx::docstring const & tooltip)
        }
 
        default: {
-               // ENCODING, FIXME - we assume tooltips are in locale.  No 
-               // idea whether they actually are.
-               // FIXME UNICODE 2: tooltip is a docstring now...
-               Glib::ustring tip = Glib::locale_to_utf8(tooltip);
+               Glib::ustring tip = lyx::to_utf8(tooltip);
 
                Gtk::ToolButton * toolbutton;
                Gtk::Image * image = NULL;
index 205bb8246ce3c61305a01dd0bae1962f314c3252..eaea85053101f22f21392c5d8ee4026a97fe35d7 100644 (file)
@@ -54,7 +54,7 @@ void GViewBase::build()
                window()->set_icon_from_file(iconName);
        window()->signal_delete_event().connect(
                sigc::mem_fun(*this, &GViewBase::onDeleteEvent));
-       window()->set_title(Glib::locale_to_utf8(getTitle()));
+       window()->set_title(lyx::to_utf8(getTitle()));
 }
 
 
@@ -120,7 +120,7 @@ void GViewBase::setRestore(Gtk::Button * restore)
 void GViewBase::setTitle(lyx::docstring const & title)
 {
        Dialog::View::setTitle(title);
-       window()->set_title(title);
+       window()->set_title(lyx::to_utf8(title));
 }
 
 
@@ -161,7 +161,7 @@ bool GViewBase::onDeleteEvent(GdkEventAny *)
 }
 
 
-GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
+GViewGladeB::GViewGladeB(Dialog & parent, docstring const & t, bool allowResize) :
        GViewBase(parent, t, allowResize)
 {
 }
index 00b42dab72dc9f312b3abb431bbbee5ac17e4119..764b1d36baf93ca99598a166e207b090eb57aaa3 100644 (file)
@@ -26,7 +26,7 @@ namespace frontend {
 
 class GViewBase : public Dialog::View, public sigc::trackable {
 public:
-       GViewBase(Dialog &, std::string const &, bool allowResize);
+       GViewBase(Dialog &, lyx::docstring const &, bool allowResize);
        virtual ~GViewBase();
        void setCancel(Gtk::Button * cancel);
        void setApply(Gtk::Button * apply);
index 169c57f2246c766334f30c82dfb280dffaf10842..eefd320b8fc768aebc411eb88393f0facdadffca 100644 (file)
 #endif
 
 #include "GuiApplication.h"
+#include "io_callback.h"
 
 #include "GtkmmX.h"
 
 #include "BufferView.h"
+#include "Color.h"
 
 #include "graphics/LoaderQueue.h"
 
@@ -40,6 +42,8 @@
 
 #include "LyXGdkImage.h"
 
+#include <iomanip>
+
 
 using lyx::support::subst;
 
@@ -65,9 +69,9 @@ int getDPI()
 
 namespace lyx {
 
-lyx::frontend::Application * createApplication(int & argc, char * argv[])
+frontend::Application * createApplication(int & argc, char * argv[])
 {
-       return new GuiApplication(argc, argv);
+       return new frontend::GuiApplication(argc, argv);
 }
 
 namespace frontend {
@@ -163,7 +167,7 @@ bool GuiApplication::getRgbColor(LColor_color col,
 string const GuiApplication::hexName(LColor_color col)
 {
        lyx::RGBColor rgbcol;
-       if (!getRGBColor(col, rgbcol)) {
+       if (!getRgbColor(col, rgbcol)) {
                lyxerr << "X can't find color for \"" << lcolor.getLyXName(col)
                       << '"' << std::endl;
                return string();
index d803f77bd4a42114cd48b5b7189a6c0efcce875e..ca661d4b87de3c353dbf25be589524f9b8e44060 100644 (file)
@@ -54,6 +54,7 @@ public:
        virtual int const exec();
        virtual Gui & gui() { return gui_; }
        virtual void exit(int status);
+       void syncEvents();
        virtual std::string const romanFontName();
        virtual std::string const sansFontName();
        virtual std::string const typewriterFontName();
diff --git a/src/frontends/gtk/lyx_gui.C b/src/frontends/gtk/lyx_gui.C
deleted file mode 100644 (file)
index dbf06e4..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * \file gtk/lyx_gui.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjnes
- * \author John Levon
- * \author Huang Ying
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-// Too hard to make concept checks work with this file
-#ifdef _GLIBCXX_CONCEPT_CHECKS
-#undef _GLIBCXX_CONCEPT_CHECKS
-#endif
-#ifdef _GLIBCPP_CONCEPT_CHECKS
-#undef _GLIBCPP_CONCEPT_CHECKS
-#endif
-
-#include "lyx_gui.h"
-
-#include "debug.h"
-#include "funcrequest.h"
-#include "gettext.h"
-
-#include "Color.h"
-#include "LColor.h"
-#include "LyXAction.h"
-#include "lyx_main.h"
-#include "lyxrc.h"
-#include "lyxfont.h"
-#include "graphics/LoaderQueue.h"
-
-#include "io_callback.h"
-
-// FIXME: move this stuff out again
-#include "lyxfunc.h"
-#include "lyxserver.h"
-#include "lyxsocket.h"
-#include "BufferView.h"
-
-#include "GuiApplication.h"
-#include "GuiImplementation.h"
-#include "GView.h"
-#include "GtkmmX.h"
-
-#include "GWorkArea.h"
-
-#include "support/lyxlib.h"
-#include "support/os.h"
-#include "support/filetools.h"
-#include "support/package.h"
-
-#include <gtkmm.h>
-
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <fcntl.h>
-
-#include <sstream>
-#include <iomanip>
-
-namespace os = lyx::support::os;
-
-using std::ostringstream;
-using std::string;
-
-using lyx::support::package;
-
-using lyx::frontend::colorCache;
-using lyx::frontend::Gui;
-using lyx::frontend::GuiApplication;
-using lyx::frontend::GuiImplementation;
-using lyx::frontend::GView;
-
-
-namespace {
-
-/// estimate DPI from X server
-int getDPI()
-{
-       //TODO use GDK instead
-       Screen * scr = ScreenOfDisplay(getDisplay(), getScreen());
-       return int(((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
-               (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2);
-}
-
-} // namespace anon
-
-GuiApplication * guiApp;
-
-int lyx_gui::exec(int & argc, char * argv[])
-{
-       guiApp = new GuiApplication(argc, argv);
-       theApp = guiApp;
-
-       return LyX::ref().exec2(argc, argv);
-}
-
-
-bool lyx_gui::getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
-{
-       Gdk::Color gdkColor;
-       Gdk::Color * gclr = colorCache.getColor(col);
-       if (!gclr) {
-               gclr = &gdkColor;
-               if(!gclr->parse(lcolor.getX11Name(col))) {
-                       rgbcol.r = 0;
-                       rgbcol.g = 0;
-                       rgbcol.b = 0;
-                       return false;
-               }
-       }
-
-       // Note that X stores the RGB values in the range 0 - 65535
-       // whilst we require them in the range 0 - 255.
-       rgbcol.r = gclr->get_red() / 256;
-       rgbcol.g = gclr->get_green() / 256;
-       rgbcol.b = gclr->get_blue() / 256;
-       return true;
-}
-
-
-string const lyx_gui::hexname(LColor_color col)
-{
-       lyx::RGBColor rgbcol;
-       if (!getRGBColor(col, rgbcol)) {
-               lyxerr << "X can't find color for \"" << lcolor.getLyXName(col)
-                      << '"' << std::endl;
-               return string();
-       }
-
-       std::ostringstream os;
-
-       os << std::setbase(16) << std::setfill('0')
-          << std::setw(2) << rgbcol.r
-          << std::setw(2) << rgbcol.g
-          << std::setw(2) << rgbcol.b;
-
-       return os.str();
-}
-
-
-void lyx_gui::update_color(LColor_color /*col*/)
-{
-       colorCache.clear();
-}
-
-
-namespace {
-
-std::map<int, boost::shared_ptr<io_callback> > callbacks;
-
-} // NS anon
-
-
-void lyx_gui::register_socket_callback(int fd,
-                                      boost::function<void()> func)
-{
-       callbacks[fd] = boost::shared_ptr<io_callback>(new io_callback(fd, func));
-}
-
-
-void lyx_gui::unregister_socket_callback(int fd)
-{
-       callbacks.erase(fd);
-}
-
-
-void lyx_gui::sync_events()
-{
-       // FIXME
-}