Abdelrazak Younes <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
| 
| > I have created a GuiImplementation.C for gtk as well and then that
| > include should go there.
| > |  | Index: GView.C
| > | ===================================================================
| > | --- GView.C       (revision 14193)
| > | +++ GView.C       (working copy)
| > | @@ -93,7 +93,6 @@
| > |   // Define the components making up the window.
| > |   menubar_.reset(new GMenubar(this, menubackend));
| > |   getToolbars().init();
| > | - bufferview_.reset(new BufferView(this, 300, 300));
| > |   minibuffer_.reset(new GMiniBuffer(this, *controlcommand_));
| > right. I already have that in my tree though.
| 
| Oups sorry, just overwrite my changes I thought your changes were
| xforms and qt3 only...
| 
| Just overwrite my changes then.

Ok, this is my final patch.
Please have a lookover of you have the time.

xforms is bonkers, gtk somewhat works (no scrollbar though), qt3 and
qt4 looks fine.

Index: src/lyxfunc.C
===================================================================
Index: src/frontends/gtk/lyx_gui.C
===================================================================
--- src/frontends/gtk/lyx_gui.C	(revision 14210)
+++ src/frontends/gtk/lyx_gui.C	(working copy)
@@ -145,7 +145,7 @@
 {
 	int view_id = theApp->gui().newView(width, height);
 	GView & view = static_cast<GView &> (theApp->gui().view(view_id));
-	int workArea_id_ = theApp->gui().newWorkArea(width, height, 0);
+	theApp->gui().newWorkArea(width, height, 0);
 
 	LyX::ref().addLyXView(&view);
 
Index: src/frontends/gtk/GWorkArea.h
===================================================================
--- src/frontends/gtk/GWorkArea.h	(revision 14210)
+++ src/frontends/gtk/GWorkArea.h	(working copy)
@@ -58,7 +58,7 @@
 class GWorkArea : public sigc::trackable {
 public:
 	GWorkArea(LyXView & owner, int width, int height);
-	~GWorkArea();
+	virtual ~GWorkArea();
 
 	virtual Painter & getPainter();
 	///
Index: src/frontends/gtk/GView.C
===================================================================
--- src/frontends/gtk/GView.C	(revision 14210)
+++ src/frontends/gtk/GView.C	(working copy)
@@ -118,7 +118,7 @@
 	}
 	set_default_size(width, height);
 	// Make sure the buttons are disabled if needed.
-	updateToolbars();
+	//updateToolbars();
 	string const iconName =
 		support::libFileSearch("images", "lyx", "xpm");
 	if (!iconName.empty())
Index: src/frontends/gtk/GuiImplementation.C
===================================================================
--- src/frontends/gtk/GuiImplementation.C	(revision 0)
+++ src/frontends/gtk/GuiImplementation.C	(revision 0)
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+/**
+ * \file gtk/GuiImplementation.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include "GuiImplementation.h"
+
+#include "GView.h"
+#include "BufferView.h"
+
+namespace lyx {
+namespace frontend {
+
+int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
+{
+	view_.reset(new GView(*this));
+	return 0;
+}
+
+
+int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int /*view_id*/)
+{
+	old_work_area_.reset(new GWorkArea(*view_.get(), w, h));
+	old_screen_.reset(new GScreen(*old_work_area_.get()));
+	work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
+	clipboard_.reset(new GuiClipboard(old_work_area_.get()));
+	guiCursor().connect(work_area_.get());
+	
+	// FIXME BufferView creation should be independant of WorkArea creation
+	buffer_views_[0].reset(new BufferView(view_.get(), work_area_.get()));
+	work_area_->setBufferView(buffer_views_[0].get());
+	view_->setBufferView(buffer_views_[0].get());
+	return 0;
+}
+
+
+void GuiImplementation::destroyWorkArea(int /*id*/)
+{
+	clipboard_.reset();
+	work_area_.reset();
+	old_work_area_.reset();
+	old_screen_.reset();
+}
+
+} // namespace frontend
+} // namespace lyx

Property changes on: src/frontends/gtk/GuiImplementation.C
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/frontends/gtk/GMiniBuffer.C
===================================================================
--- src/frontends/gtk/GMiniBuffer.C	(revision 14210)
+++ src/frontends/gtk/GMiniBuffer.C	(working copy)
@@ -82,7 +82,7 @@
 	focusTimer_->timeout.connect(
 		boost::bind(&GMiniBuffer::focusTimeout, this));
 	idleTimer_->start();
-	messageMode();
+	//messageMode();
 }
 
 
Index: src/frontends/gtk/GuiImplementation.h
===================================================================
--- src/frontends/gtk/GuiImplementation.h	(revision 14210)
+++ src/frontends/gtk/GuiImplementation.h	(working copy)
@@ -15,7 +15,6 @@
 #include "frontends/Gui.h"
 #include "frontends/LyXView.h"
 
-#include "GView.h"
 #include "GScreen.h"
 #include "GWorkArea.h"
 
@@ -24,15 +23,9 @@
 
 #include <boost/shared_ptr.hpp>
 
-#include <map>
-
 namespace lyx {
 namespace frontend {
 
-typedef GView FView;
-typedef GScreen FScreen;
-typedef GWorkArea FWorkArea;
-
 /**
  * The Gui class is the interface to all GTK components.
  */
@@ -52,51 +45,26 @@
 		return *clipboard_;
 	}
 
-	int newView(unsigned int w, unsigned int h)
-	{
-		view_.reset(new FView(*this, w, h));
-		return 0;
-	}
-
+	int newView(unsigned int w, unsigned int h);
 
-	LyXView& view(int id)
+	LyXView & view(int /*id*/)
 	{
 		return *view_;
 	}
 
-
-	void destroyView(int id)
+	void destroyView(int /*id*/)
 	{
 		view_.reset();
 	}
 
-	int newWorkArea(unsigned int w, unsigned int h, int view_id)
-	{		
-		old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
-		old_screen_.reset(new FScreen(*old_work_area_.get()));
-		work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
-		clipboard_.reset(new GuiClipboard(old_work_area_.get()));
-		guiCursor().connect(work_area_.get());
-
-		// FIXME BufferView creation should be independant of WorkArea creation
-		buffer_views_[0].reset(new BufferView(view_.get(), work_area_.get()));
-		work_area_->setBufferView(buffer_views_[0].get());
-		view_->setBufferView(buffer_views_[0].get());
-		return 0;
-	}
+	int newWorkArea(unsigned int w, unsigned int h, int /*view_id*/);
 
-	lyx::frontend::WorkArea& workArea(int id)
+	lyx::frontend::WorkArea & workArea(int /*id*/)
 	{
 		return *work_area_;
 	}
 
-	void destroyWorkArea(int id)
-	{
-		clipboard_.reset();
-		work_area_.reset();
-		old_work_area_.reset();
-		old_screen_.reset();
-	}
+	void destroyWorkArea(int /*id*/);
 
 private:
 	///
@@ -104,11 +72,11 @@
 	///
 	boost::shared_ptr<GuiWorkArea> work_area_;
 	///
-	boost::shared_ptr<FView> view_;
+	boost::shared_ptr<LyXView> view_;
 	///
-	boost::shared_ptr<FWorkArea> old_work_area_;
+	boost::shared_ptr<GWorkArea> old_work_area_;
 	///
-	boost::shared_ptr<FScreen> old_screen_;
+	boost::shared_ptr<GScreen> old_screen_;
 };
 
 } // namespace frontend
Index: src/frontends/gtk/Makefile.am
===================================================================
--- src/frontends/gtk/Makefile.am	(revision 14210)
+++ src/frontends/gtk/Makefile.am	(working copy)
@@ -138,6 +138,7 @@
 	ghelpers.C \
 	ghelpers.h \
 	GuiImplementation.h \
+	GuiImplementation.C \
 	io_callback.C \
 	io_callback.h \
 	lyx_gui.C \
Index: src/frontends/gtk/GuiClipboard.h
===================================================================
--- src/frontends/gtk/GuiClipboard.h	(revision 14210)
+++ src/frontends/gtk/GuiClipboard.h	(working copy)
@@ -19,15 +19,13 @@
 namespace lyx {
 namespace frontend {
 
-typedef GWorkArea FWorkArea;
-
 /**
  * The GTK version of the Clipboard.
  */
 class GuiClipboard: public lyx::frontend::Clipboard
 {
 public:
-	GuiClipboard(FWorkArea * work_area)
+	GuiClipboard(GWorkArea * work_area)
 		: old_work_area_(work_area)
 	{
 	}
@@ -54,7 +52,7 @@
 	//@}
 
 private:
-	FWorkArea * old_work_area_;
+	GWorkArea * old_work_area_;
 };
 
 } // namespace frontend
Index: src/frontends/gtk/GuiWorkArea.h
===================================================================
--- src/frontends/gtk/GuiWorkArea.h	(revision 14210)
+++ src/frontends/gtk/GuiWorkArea.h	(working copy)
@@ -20,16 +20,13 @@
 namespace lyx {
 namespace frontend {
 
-typedef GScreen FScreen;
-typedef GWorkArea FWorkArea;
-
 /**
  * Temporary wrapper around GWorkArea and GScreen.
  * Please refer to the Qt4 implementation for a proper cleanup of the API.
  */
 class GuiWorkArea: public lyx::frontend::WorkArea {
 public:
-	GuiWorkArea(FScreen * screen, FWorkArea * work_area)
+	GuiWorkArea(GScreen * screen, GWorkArea * work_area)
 		: old_screen_(screen), old_work_area_(work_area)
 	{
 	}
@@ -67,7 +64,7 @@
 
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape)
+	virtual void showCursor(int x, int y, int h, CursorShape shape)
 	{
 		old_screen_->showCursor(x, y, h, shape);
 	}
@@ -86,8 +83,8 @@
 	}
 
 private:
-	FScreen * old_screen_;
-	FWorkArea * old_work_area_;
+	GScreen * old_screen_;
+	GWorkArea * old_work_area_;
 };
 
 } // namespace frontend
Index: src/frontends/gtk/GScreen.C
===================================================================
--- src/frontends/gtk/GScreen.C	(revision 14210)
+++ src/frontends/gtk/GScreen.C	(working copy)
@@ -32,6 +32,7 @@
 
 #include "frontends/font_metrics.h"
 #include "frontends/Painter.h"
+#include "frontends/GuiCursor.h"
 
 #include "insets/insettext.h"
 
@@ -64,7 +65,7 @@
 }
 
 
-void GScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
+void GScreen::showCursor(int x, int y, int h, CursorShape shape)
 {
 	// Update the cursor color.
 	setCursorColor(owner_.getGC());
Index: src/frontends/gtk/GPainter.C
===================================================================
--- src/frontends/gtk/GPainter.C	(revision 14210)
+++ src/frontends/gtk/GPainter.C	(working copy)
@@ -232,7 +232,7 @@
 		XftFont * fontS = getXftFont(smallfont);
 		char c;
 		int tmpx = x;
-		for (int i = 0; i < ls; ++i) {
+		for (unsigned int i = 0; i < ls; ++i) {
 			c = lyx::support::uppercase(s[i]);
 			if (c != s[i]) {
 				XftDrawString8(draw, xftClr, fontS, tmpx, y,
Index: src/frontends/gtk/GScreen.h
===================================================================
--- src/frontends/gtk/GScreen.h	(revision 14210)
+++ src/frontends/gtk/GScreen.h	(working copy)
@@ -39,7 +39,7 @@
 	///
 	virtual void removeCursor();
 	///
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape);
+	virtual void showCursor(int x, int y, int h, CursorShape shape);
 
 	/// Copies specified area of pixmap to screen
 	virtual void expose(int x, int y, int w, int h);
Index: src/frontends/WorkArea.h
===================================================================
--- src/frontends/WorkArea.h	(revision 14210)
+++ src/frontends/WorkArea.h	(working copy)
@@ -66,7 +66,7 @@
 	void greyOut();
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape) = 0;
+	virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
 
 	/// hide the cursor
 	virtual void removeCursor() = 0;
Index: src/frontends/qt3/lyx_gui.C
===================================================================
--- src/frontends/qt3/lyx_gui.C	(revision 14210)
+++ src/frontends/qt3/lyx_gui.C	(working copy)
@@ -241,7 +241,7 @@
 
 	int view_id = theApp->gui().newView(width, height);
 	QtView & view = static_cast<QtView &> (theApp->gui().view(view_id));
-	int workArea_id_ = theApp->gui().newWorkArea(width, height, 0);
+	theApp->gui().newWorkArea(width, height, 0);
 
 	LyX::ref().addLyXView(&view);
 
Index: src/frontends/qt3/qscreen.C
===================================================================
--- src/frontends/qt3/qscreen.C	(revision 14210)
+++ src/frontends/qt3/qscreen.C	(working copy)
@@ -60,7 +60,7 @@
 }
 
 
-void QScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
+void QScreen::showCursor(int x, int y, int h, CursorShape shape)
 {
 	if (!qApp->focusWidget())
 		return;
Index: src/frontends/qt3/qscreen.h
===================================================================
--- src/frontends/qt3/qscreen.h	(revision 14210)
+++ src/frontends/qt3/qscreen.h	(working copy)
@@ -40,7 +40,7 @@
 	virtual void expose(int x, int y, int exp_width, int exp_height);
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, lyx::frontend::Cursor_Shape shape);
+	virtual void showCursor(int x, int y, int h, lyx::frontend::CursorShape shape);
 
 	/// hide the cursor
 	virtual void removeCursor();
Index: src/frontends/qt3/QtView.C
===================================================================
Index: src/frontends/qt3/GuiImplementation.h
===================================================================
--- src/frontends/qt3/GuiImplementation.h	(revision 14210)
+++ src/frontends/qt3/GuiImplementation.h	(working copy)
@@ -51,25 +51,25 @@
 		return *clipboard_;
 	}
 
-	int newView(unsigned int w, unsigned int h)
+	int newView(unsigned int /*w*/, unsigned int /*h*/)
 	{
 		view_.reset(new FView(*this));
 		return 0;
 	}
 
 
-	LyXView& view(int id)
+	LyXView& view(int /*id*/)
 	{
 		return *view_;
 	}
 
 
-	void destroyView(int id)
+	void destroyView(int /*id*/)
 	{
 		view_.reset();
 	}
 
-	int newWorkArea(unsigned int w, unsigned int h, int view_id)
+	int newWorkArea(unsigned int w, unsigned int h, int /*view_id*/)
 	{		
 		old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
 		old_screen_.reset(new FScreen(*old_work_area_.get()));
@@ -84,12 +84,12 @@
 		return 0;
 	}
 
-	lyx::frontend::WorkArea& workArea(int id)
+	lyx::frontend::WorkArea& workArea(int /*id*/)
 	{
 		return *work_area_;
 	}
 
-	void destroyWorkArea(int id)
+	void destroyWorkArea(int /*id*/)
 	{
 		clipboard_.reset();
 		work_area_.reset();
Index: src/frontends/qt3/GuiWorkArea.h
===================================================================
--- src/frontends/qt3/GuiWorkArea.h	(revision 14210)
+++ src/frontends/qt3/GuiWorkArea.h	(working copy)
@@ -67,7 +67,7 @@
 
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape)
+	virtual void showCursor(int x, int y, int h, CursorShape shape)
 	{
 		old_screen_->showCursor(x, y, h, shape);
 	}
Index: src/frontends/qt4/QLPainter.C
===================================================================
--- src/frontends/qt4/QLPainter.C	(revision 14210)
+++ src/frontends/qt4/QLPainter.C	(working copy)
@@ -216,7 +216,7 @@
 	setQPainterPen(*qp_.get(), f.realColor());
 	int tmpx = x;
 	size_t ls = s.length();
-	for (size_t i = 0; i < ls; ++i) {
+	for (unsigned int i = 0; i < ls; ++i) {
 		QChar const c = s[i].upper();
 		if (c != s.at(i)) {
 			qp_->setFont(qsmallfont);
@@ -240,7 +240,7 @@
 
 	QString str;
 	str.setLength(ls);
-	for (size_t i = 0; i < ls; ++i)
+	for (unsigned int i = 0; i < ls; ++i)
 		str[i] = QChar(encoding->ucs(s[i]));
 
 	// HACK: QT3 refuses to show single compose characters
Index: src/frontends/qt4/GuiImplementation.C
===================================================================
--- src/frontends/qt4/GuiImplementation.C	(revision 14210)
+++ src/frontends/qt4/GuiImplementation.C	(working copy)
@@ -35,7 +35,7 @@
 }
 
 
-int GuiImplementation::newView(unsigned int w, unsigned int h)
+int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
 {
 	size_t const id = max_view_id_;
 	++max_view_id_;
Index: src/frontends/qt4/GuiWorkArea.C
===================================================================
--- src/frontends/qt4/GuiWorkArea.C	(revision 14210)
+++ src/frontends/qt4/GuiWorkArea.C	(working copy)
@@ -44,7 +44,7 @@
 // Abdel (09/06/2006):
 // I want the drawing to be fast without Keyboard buffering so when working
 // on optimization, please set the following macro to 0:
-#define USE_KEY_BUFFERING 0
+#define USE_KEY_BUFFERING 1
 
 using std::endl;
 using std::string;
@@ -523,7 +523,7 @@
 }
 
 
-void GuiWorkArea::showCursor(int x, int y, int h, Cursor_Shape shape)
+void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
 {
 	if (!qApp->focusWidget())
 		return;
Index: src/frontends/qt4/GuiWorkArea.h
===================================================================
--- src/frontends/qt4/GuiWorkArea.h	(revision 14210)
+++ src/frontends/qt4/GuiWorkArea.h	(working copy)
@@ -144,7 +144,7 @@
 	virtual void expose(int x, int y, int exp_width, int exp_height);
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape);
+	virtual void showCursor(int x, int y, int h, CursorShape shape);
 
 	/// hide the cursor
 	virtual void removeCursor();
@@ -240,7 +240,7 @@
 	///
 	QColor cursor_color_;
 	///
-	Cursor_Shape cursor_shape_;
+	CursorShape cursor_shape_;
 };
 
 } // namespace frontend
Index: src/frontends/GuiCursor.h
===================================================================
--- src/frontends/GuiCursor.h	(revision 14210)
+++ src/frontends/GuiCursor.h	(working copy)
@@ -11,6 +11,22 @@
  * Full author contact details are available in file CREDITS.
  */
 
+// X11 use a define called CursorShape, and we really want to use
+// that name our selves. Therefore we do something similar to what is done
+// in kde/fixx11h.h:
+namespace X {
+#ifdef CursorShape
+#ifndef FIXX11H_CursorShape
+#define FIXX11H_CursorShape
+int const XCursorShape = CursorShape;
+#undef CursorShape
+int const CursorShape = CursorShape;
+#endif
+#undef CursorShape
+#endif
+
+} // namespace X
+
 #ifndef GUI_CURSOR_H
 #define GUI_CURSOR_H
 
@@ -26,7 +42,7 @@
 class WorkArea;
 
 /// types of cursor in work area
-enum Cursor_Shape {
+enum CursorShape {
 	/// normal I-beam
 	BAR_SHAPE,
 	/// L-shape for locked insets of a different language
Index: src/frontends/Gui.h
===================================================================
--- src/frontends/Gui.h	(revision 14210)
+++ src/frontends/Gui.h	(working copy)
@@ -18,6 +18,8 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <map>
+
 class LyXView;
 
 namespace lyx {
Index: src/frontends/xforms/XFormsView.C
===================================================================
--- src/frontends/xforms/XFormsView.C	(revision 14210)
+++ src/frontends/xforms/XFormsView.C	(working copy)
@@ -74,7 +74,7 @@
 XFormsView::XFormsView(Gui & owner, int width, int height)
 	: LyXView(owner),
 	  window_(Box(width, height)),
-	  icon_pixmap_(0), icon_mask_(0), frontend_(*this)
+	  icon_pixmap_(0), icon_mask_(0)
 {
 	int const air = 2;
 
@@ -108,7 +108,6 @@
 
 	menubar_.reset(new XFormsMenubar(this, menubackend));
 	getToolbars().init();
-	bufferview_.reset(new BufferView(this, width, height));
 	minibuffer_.reset(new XMiniBuffer(*this, *controlcommand_));
 
 	//  Assign an icon to the main form.
@@ -138,7 +137,7 @@
 		focus_command_buffer.connect(boost::bind(&XMiniBuffer::focus, minibuffer_.get()));
 
 	// Make sure the buttons are disabled if needed.
-	updateToolbars();
+	//updateToolbars();
 	redraw_con =
 		getDialogs().redrawGUI().connect(boost::bind(&XFormsView::redraw, this));
 }
Index: src/frontends/xforms/xscreen.C
===================================================================
--- src/frontends/xforms/xscreen.C	(revision 14210)
+++ src/frontends/xforms/xscreen.C	(working copy)
@@ -73,7 +73,7 @@
 }
 
 
-void XScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
+void XScreen::showCursor(int x, int y, int h, CursorShape shape)
 {
 	// Update the cursor color. (a little slow doing it like this ??)
 	setCursorColor();
Index: src/frontends/xforms/XFormsView.h
===================================================================
--- src/frontends/xforms/XFormsView.h	(revision 14210)
+++ src/frontends/xforms/XFormsView.h	(working copy)
@@ -12,7 +12,6 @@
 #ifndef LyXView_H
 #define LyXView_H
 
-#include "GuiImplementation.h"
 #include "LayoutEngine.h"
 #include "forms_fwd.h"
 
Index: src/frontends/xforms/GuiImplementation.C
===================================================================
--- src/frontends/xforms/GuiImplementation.C	(revision 0)
+++ src/frontends/xforms/GuiImplementation.C	(revision 0)
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+/**
+ * \file xforms/GuiImplementation.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include "GuiImplementation.h"
+
+#include "XFormsView.h"
+#include "BufferView.h"
+
+
+namespace lyx {
+namespace frontend {
+
+int GuiImplementation::newView(unsigned int w, unsigned int h)
+{
+	view_.reset(new XFormsView(*this, w, h));
+	return 0;
+}
+
+
+int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int /*view_id*/)
+{
+	old_work_area_.reset(new XWorkArea(*view_.get(), w, h));
+	old_screen_.reset(new XScreen(*old_work_area_));
+	work_area_.reset(new GuiWorkArea(boost::static_pointer_cast<XScreen>(old_screen_).get(),
+					 boost::static_pointer_cast<XWorkArea>(old_work_area_).get()));
+	clipboard_.reset(new GuiClipboard(boost::static_pointer_cast<XWorkArea>(old_work_area_).get()));
+	guiCursor().connect(work_area_.get());
+
+	// FIXME BufferView creation should be independant of WorkArea creation
+	buffer_views_[0].reset(new BufferView(view_.get(), work_area_.get()));
+	work_area_->setBufferView(buffer_views_[0].get());
+	view_->setBufferView(buffer_views_[0].get());
+	return 0;
+}
+
+
+void GuiImplementation::destroyWorkArea(int /*id*/)
+{
+	clipboard_.reset();
+	work_area_.reset();
+	old_work_area_.reset();
+	old_screen_.reset();
+}
+
+} // namespace frontend
+} // namespace lyx

Property changes on: src/frontends/xforms/GuiImplementation.C
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/frontends/xforms/XWorkArea.C
===================================================================
--- src/frontends/xforms/XWorkArea.C	(revision 14210)
+++ src/frontends/xforms/XWorkArea.C	(working copy)
@@ -116,6 +116,13 @@
 	FL_OBJECT * obj;
 	FL_OBJECT * frame;
 
+	XFormsView & xview = dynamic_cast<XFormsView &>(owner);
+
+	// Set the current form so that objects have something to get
+	// added to.
+	//fl_addto_form(fl_current_form);
+	fl_addto_form(xview.getForm());
+
 	// A frame around the work area.
 	frame = obj = fl_add_box(FL_BORDER_BOX, 0, 0, w, h, "");
 	fl_set_object_resize(obj, FL_RESIZE_ALL);
@@ -150,7 +157,6 @@
 
 	// Hand control of the layout of these widgets to the
 	// Layout Engine.
-	XFormsView & xview = dynamic_cast<XFormsView &>(owner);
 	BoxList & boxlist = xview.getBox(XFormsView::Center)->children();
 
 	wa_box_ = boxlist.push_back(Box(0,0));
@@ -179,6 +185,8 @@
 	val.function = GXcopy;
 	copy_gc = XCreateGC(fl_get_display(), RootWindow(fl_get_display(), 0),
 			    GCFunction, &val);
+
+	fl_end_form();
 }
 
 
Index: src/frontends/xforms/xscreen.h
===================================================================
--- src/frontends/xforms/xscreen.h	(revision 14210)
+++ src/frontends/xforms/xscreen.h	(working copy)
@@ -13,10 +13,10 @@
 #ifndef XSCREEN_H
 #define XSCREEN_H
 
-#include "frontends/GuiCursor.h"
-
 #include <X11/Xlib.h> // for Pixmap, GC
 
+#include "frontends/GuiCursor.h"
+
 class WorkArea;
 
 namespace lyx {
@@ -44,7 +44,7 @@
 	virtual void expose(int x, int y, int w, int h);
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape);
+	virtual void showCursor(int x, int y, int h, CursorShape shape);
 
 	/// hide the cursor
 	virtual void removeCursor();
Index: src/frontends/xforms/GuiImplementation.h
===================================================================
--- src/frontends/xforms/GuiImplementation.h	(revision 14210)
+++ src/frontends/xforms/GuiImplementation.h	(working copy)
@@ -23,15 +23,9 @@
 
 #include <boost/shared_ptr.hpp>
 
-#include <map>
-
 namespace lyx {
 namespace frontend {
 
-typedef XFormsView FView;
-typedef XScreen FScreen;
-typedef XWorkArea FWorkArea;
-
 /**
  * The Gui class is the interface to all XForms components.
  */
@@ -51,51 +45,28 @@
 		return *clipboard_;
 	}
 
-	int newView(unsigned int w, unsigned int h)
-	{
-		view_.reset(new FView(*this, w, h));
-		return 0;
-	}
+	int newView(unsigned int w, unsigned int h);
 
 
-	LyXView& view(int id)
+	LyXView & view(int /*id*/)
 	{
 		return *view_;
 	}
 
 
-	void destroyView(int id)
+	void destroyView(int /*id*/)
 	{
 		view_.reset();
 	}
 
-	int newWorkArea(unsigned int w, unsigned int h, int view_id)
-	{		
-		old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
-		old_screen_.reset(new FScreen(*old_work_area_.get()));
-		work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
-		clipboard_.reset(new GuiClipboard(old_work_area_.get()));
-		guiCursor().connect(work_area_.get());
-
-		// FIXME BufferView creation should be independant of WorkArea creation
-		buffer_views_[0].reset(new BufferView(view_.get(), work_area_.get()));
-		work_area_->setBufferView(buffer_views_[0].get());
-		view_->setBufferView(buffer_views_[0].get());
-		return 0;
-	}
+	int newWorkArea(unsigned int w, unsigned int h, int view_id);
 
-	lyx::frontend::WorkArea& workArea(int id)
+	lyx::frontend::WorkArea & workArea(int /*id*/)
 	{
 		return *work_area_;
 	}
 
-	void destroyWorkArea(int id)
-	{
-		clipboard_.reset();
-		work_area_.reset();
-		old_work_area_.reset();
-		old_screen_.reset();
-	}
+	void destroyWorkArea(int id);
 
 private:
 	///
@@ -103,11 +74,11 @@
 	///
 	boost::shared_ptr<GuiWorkArea> work_area_;
 	///
-	boost::shared_ptr<FView> view_;
+	boost::shared_ptr<LyXView> view_;
 	///
-	boost::shared_ptr<FWorkArea> old_work_area_;
+	boost::shared_ptr<XWorkArea> old_work_area_;
 	///
-	boost::shared_ptr<FScreen> old_screen_;
+	boost::shared_ptr<XScreen> old_screen_;
 };
 
 } // namespace frontend
Index: src/frontends/xforms/XWorkArea.h
===================================================================
--- src/frontends/xforms/XWorkArea.h	(revision 14210)
+++ src/frontends/xforms/XWorkArea.h	(working copy)
@@ -31,7 +31,7 @@
 	///
 	XWorkArea(LyXView & owner, int width, int height);
 	///
-	~XWorkArea();
+	virtual ~XWorkArea();
 	///
 	virtual Painter & getPainter() { return painter_; }
 	///
Index: src/frontends/xforms/Makefile.am
===================================================================
--- src/frontends/xforms/Makefile.am	(revision 14210)
+++ src/frontends/xforms/Makefile.am	(working copy)
@@ -158,6 +158,7 @@
 	FormWrap.h \
 	GuiClipboard.h \
 	GuiImplementation.h \
+	GuiImplementation.C \
 	GuiWorkArea.h \
 	LayoutEngine.C \
 	LayoutEngine.h \
Index: src/frontends/xforms/GuiClipboard.h
===================================================================
--- src/frontends/xforms/GuiClipboard.h	(revision 14210)
+++ src/frontends/xforms/GuiClipboard.h	(working copy)
@@ -19,15 +19,13 @@
 namespace lyx {
 namespace frontend {
 
-typedef XWorkArea FWorkArea;
-
 /**
  * The XForms version of the Clipboard.
  */
 class GuiClipboard: public lyx::frontend::Clipboard
 {
 public:
-	GuiClipboard(FWorkArea * work_area)
+	GuiClipboard(XWorkArea * work_area)
 		: old_work_area_(work_area)
 	{
 	}
@@ -54,7 +52,7 @@
 	//@}
 
 private:
-	FWorkArea * old_work_area_;
+	XWorkArea * old_work_area_;
 };
 
 } // namespace frontend
Index: src/frontends/xforms/GuiWorkArea.h
===================================================================
--- src/frontends/xforms/GuiWorkArea.h	(revision 14210)
+++ src/frontends/xforms/GuiWorkArea.h	(working copy)
@@ -20,16 +20,13 @@
 namespace lyx {
 namespace frontend {
 
-typedef XScreen FScreen;
-typedef XWorkArea FWorkArea;
-
 /**
  * Temporary wrapper around XWorkArea and XScreen.
  * Please refer to the Qt4 implementation for a proper cleanup of the API.
  */
 class GuiWorkArea: public lyx::frontend::WorkArea {
 public:
-	GuiWorkArea(FScreen * screen, FWorkArea * work_area)
+	GuiWorkArea(XScreen * screen, XWorkArea * work_area)
 		: old_screen_(screen), old_work_area_(work_area)
 	{
 	}
@@ -67,7 +64,7 @@
 
 
 	/// paint the cursor and store the background
-	virtual void showCursor(int x, int y, int h, Cursor_Shape shape)
+	virtual void showCursor(int x, int y, int h, CursorShape shape)
 	{
 		old_screen_->showCursor(x, y, h, shape);
 	}
@@ -86,8 +83,8 @@
 	}
 
 private:
-	FScreen * old_screen_;
-	FWorkArea * old_work_area_;
+	XScreen * old_screen_;
+	XWorkArea * old_work_area_;
 };
 
 } // namespace frontend
Index: src/frontends/GuiCursor.C
===================================================================
--- src/frontends/GuiCursor.C	(revision 14210)
+++ src/frontends/GuiCursor.C	(working copy)
@@ -42,10 +42,6 @@
 
 #include "support/filetools.h" // LibFileSearch
 
-#include <boost/utility.hpp>
-#include <boost/bind.hpp>
-#include <boost/signals/trackable.hpp>
-
 using lyx::support::libFileSearch;
 
 using std::endl;
@@ -57,7 +53,7 @@
 namespace frontend {
 
 GuiCursor::GuiCursor()
-	: cursor_visible_(false), work_area_(NULL)
+	: cursor_visible_(false), work_area_(0)
 {
 }
 
@@ -80,7 +76,7 @@
 	if (!bv.available())
 		return;
 
-	Cursor_Shape shape = BAR_SHAPE;
+	CursorShape shape = BAR_SHAPE;
 
 	LyXText const & text = *bv.getLyXText();
 	LyXFont const & realfont = text.real_current_font;
Index: src/BufferView.h
===================================================================
Index: src/lyx_main.h
===================================================================
-- 
        Lgb

Reply via email to