src/CutAndPaste.C
src/debug.C
src/exporter.C
+src/ext_l10n.h
src/figure_form.C
src/figureForm.C
src/FontLoader.C
bool selection = false;
bool mark_set = false;
- ProhibitInput(bv_);
+ owner_->prohibitInput();
owner_->message(_("Formatting document..."));
redraw();
setState();
- AllowInput(bv_);
+ owner_->allowInput();
/// clear the "Formatting Document" message
owner_->message("");
+2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * text2.C (redoHeightOfParagraph): comment out stuff we don't need
+ in NEW_INSETS
+ (redoDrawingOfParagraph): ditto
+ (redoParagraphs): ditto
+
+ * bufferview_funcs.[Ch]: move ProhibitInput and AllowInput to
+ LyXview (+ rename)
+
+2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * modifications to some other files because of this.
+
+ * Makefile.am (lyx_SOURCES): add XFormsView
+
+ * XFormsView.[Ch]: new files
+
+ * LyXView.[Ch]: make LyXView a base class for the gui handling for
+ the main window. Move the gui dependand stuff to XFormsView
+
2001-07-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* tabular.C (GetCellInset): update cur_cell also in the row/col
#pragma implementation "FontLoader.h"
#endif
-#include "gettext.h"
+#include FORMS_H_LOCATION
#include "FontLoader.h"
#include "FontInfo.h"
+#include "gettext.h"
#include "debug.h"
#include "lyxrc.h" // lyxrc.font_*
#include "BufferView.h"
#include <unistd.h>
#include "LyXView.h"
-#include "lyx_main.h"
-#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
-#include "lyxlookup.h"
-#endif
#include "minibuffer.h"
#include "debug.h"
#include "intl.h"
#include "lyxrc.h"
#include "support/filetools.h" // OnlyFilename()
-#include "layout.h"
#include "lyxtext.h"
#include "buffer.h"
#include "frontends/Dialogs.h"
#include "frontends/Toolbar.h"
#include "frontends/Menubar.h"
#include "MenuBackend.h"
-#include "ToolbarDefaults.h"
#include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs
#include "bufferview_funcs.h" // CurrentState()
#include "gettext.h"
extern void AutoSave(BufferView *);
extern void QuitLyX();
-LyXTextClass::size_type current_layout = 0;
-// This is very temporary
-BufferView * current_view;
-
-extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
+LyXTextClass::size_type current_layout = 0;
-LyXView::LyXView(int width, int height)
+LyXView::LyXView()
{
- create_form_form_main(width, height);
- fl_set_form_atclose(form_, C_LyXView_atCloseMainFormCB, 0);
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
lyxfunc = new LyXFunc(this);
- // Connect the minibuffer signals
- minibuffer->stringReady.connect(SigC::slot(lyxfunc,
- &LyXFunc::miniDispatch));
- minibuffer->timeout.connect(SigC::slot(lyxfunc,
- &LyXFunc::initMiniBuffer));
-
intl = new Intl;
- // Make sure the buttons are disabled if needed.
- toolbar->update();
- menubar->update();
-
dialogs_ = new Dialogs(this);
// temporary until all dialogs moved into Dialogs.
dialogs_->updateBufferDependent
}
-/// Redraw the main form.
-void LyXView::redraw() {
- lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
- fl_redraw_form(form_);
- minibuffer->redraw();
-}
-
-
void LyXView::resize()
{
view()->resize();
}
-FL_FORM * LyXView::getForm() const
-{
- return form_;
-}
-
-
Toolbar * LyXView::getToolbar() const
{
return toolbar;
}
-// Callback for close main form from window manager
-int LyXView::atCloseMainFormCB(FL_FORM *, void *)
-{
- QuitLyX();
- return FL_IGNORE;
-}
-
-
-// Wrapper for the above
-extern "C"
-int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p)
-{
- return LyXView::atCloseMainFormCB(form, p);
-}
-
-
-void LyXView::setPosition(int x, int y)
-{
- fl_set_form_position(form_, x, y);
-}
-
-
-void LyXView::show(int place, int border, string const & title)
-{
- fl_show_form(form_, place, border, title.c_str());
- lyxfunc->initMiniBuffer();
-#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
- InitLyXLookup(fl_get_display(), form_->window);
-#endif
-}
-
-
-void LyXView::create_form_form_main(int width, int height)
- /* to make this work as it should, .lyxrc should have been
- * read first; OR maybe this one should be made dynamic.
- * Hmmmm. Lgb.
- * We will probably not have lyxrc before the main form is
- * initialized, because error messages from lyxrc parsing
- * are presented (and rightly so) in GUI popups. Asger.
- */
-{
- // the main form
- form_ = fl_bgn_form(FL_NO_BOX, width, height);
- form_->u_vdata = this;
- FL_OBJECT * obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
- fl_set_object_color(obj, FL_MCOL, FL_MCOL);
-
- // Parameters for the appearance of the main form
- int const air = 2;
- int const bw = abs(fl_get_border_width());
-
- //
- // THE MENUBAR
- //
- menubar = new Menubar(this, menubackend);
-
- //
- // TOOLBAR
- //
-
- toolbar = new Toolbar(this, air, 30 + air + bw, toolbardefaults);
-
- // Setup the toolbar
- toolbar->set(true);
-
- //
- // WORKAREA
- //
-
- int const ywork = 60 + 2 * air + bw;
- int const workheight = height - ywork - (25 + 2 * air);
-
- ::current_view = bufferview = new BufferView(this, air, ywork,
- width - 3 * air,
- workheight);
-
- //
- // MINIBUFFER
- //
-
- minibuffer = new MiniBuffer(this, air, height - (25 + air),
- width - (2 * air), 25);
-
- //
- // TIMERS
- //
-
- autosave_timeout.timeout.connect(SigC::slot(this, &LyXView::AutoSave));
-
- //
- // Misc
- //
-
- // assign an icon to main form
- string iconname = LibFileSearch("images", "lyx", "xpm");
- if (!iconname.empty()) {
- unsigned int w, h;
- Pixmap lyx_p, lyx_mask;
- lyx_p = fl_read_pixmapfile(fl_root,
- iconname.c_str(),
- &w,
- &h,
- &lyx_mask,
- 0,
- 0,
- 0); // this leaks
- fl_set_form_icon(form_, lyx_p, lyx_mask);
- }
-
- // set min size
- fl_set_form_minsize(form_, 50, 50);
-
- fl_end_form();
-}
-
-
-void LyXView::init()
-{
- // Set the textclass choice
- invalidateLayoutChoice();
- updateLayoutChoice();
- updateMenubar();
-
- // Start autosave timer
- if (lyxrc.autosave) {
- autosave_timeout.setTimeout(lyxrc.autosave * 1000);
- autosave_timeout.start();
- }
-
- intl->InitKeyMapper(lyxrc.use_kbmap);
-}
-
-
void LyXView::invalidateLayoutChoice()
{
last_textclass = -1;
title += _(" (read only)");
}
}
- // Don't update title if it's the same as last time
if (title != last_title) {
- fl_set_form_title(form_, title.c_str());
- last_title = title;
+ setWindowTitle(title);
}
}
// -*- C++ -*-
-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
-
-#ifndef LyXView_H
-#define LyXView_H
+
+#ifndef LYXVIEW_BASE_H
+#define LYXVIEW_BASE_H
#ifdef __GNUG__
#pragma interface
#endif
-#include <config.h>
-#include FORMS_H_LOCATION
+#include <boost/utility.hpp>
+#include <sigc++/signal_system.h>
#include "LString.h"
#include "frontends/Timeout.h"
-#include <boost/utility.hpp>
#include "layout.h"
-class LyXFunc;
+class Buffer;
class Toolbar;
class MiniBuffer;
class Intl;
-class Buffer;
class Menubar;
class BufferView;
class Dialogs;
+class LyXFunc;
-/**
- This class is the form containing the view of the buffer. The actual buffer
- view is supposed (at least IMHO) to be another class, that shows its output
- in one or more LyXView's.
- */
+///
class LyXView : public SigC::Object, boost::noncopyable {
public:
- /// constructor
- LyXView(int w, int h);
-
- /// destructor
- ~LyXView();
-
- /// Where to place the form.
- void setPosition(int, int);
-
- /// Show the main form.
- void show(int, int, string const & t = string("LyX"));
-
- /// init (should probably be removed later) (Lgb)
- void init();
-
+ ///
+ LyXView();
+ ///
+ virtual ~LyXView();
+ ///
+ virtual void init() = 0;
+ ///
+ virtual void setPosition(int, int) = 0;
+ ///
+ virtual void show(int, int, string const &) = 0;
/// Redraw the main form.
- void redraw();
+ virtual void redraw() = 0;
/// Resize all BufferViews in this LyXView (because the width changed)
void resize();
///
BufferView * view() const;
- /// returns a pointer to the form.
- FL_FORM * getForm() const;
-
/// return a pointer to the toolbar
Toolbar * getToolbar() const;
/// Reset autosave timer
void resetAutosaveTimer();
-private:
- ///
- LyXFunc * lyxfunc;
- ///
- Toolbar * toolbar;
- ///
- MiniBuffer * minibuffer;
///
- Menubar * menubar;
+ virtual void prohibitInput() const = 0;
///
- Intl * intl;
+ virtual void allowInput() const = 0;
+protected:
///
- Dialogs * dialogs_;
-
+ Menubar * menubar;
+ ///
+ Toolbar * toolbar;
/** This is supposed to be a pointer or a list of pointers to the
BufferViews currently being shown in the LyXView. So far
this is not used, but that should change pretty soon. (Lgb) */
BufferView * bufferview;
+ ///
+ MiniBuffer * minibuffer;
///
- void invalidateLayoutChoice();
-public:
- /** This callback is run when a close event is sent from the
- window manager. */
- static int atCloseMainFormCB(FL_FORM *, void *);
+ Intl * intl;
+ ///
+ Timeout autosave_timeout;
/// A callback
void AutoSave();
+ ///
+ void invalidateLayoutChoice();
private:
+ ///
+ LyXFunc * lyxfunc;
///
- Timeout autosave_timeout;
- /// makes the main form.
- void create_form_form_main(int width, int height);
- /// A pointer to the form.
- FL_FORM * form_;
+ Dialogs * dialogs_;
+ ///
+ virtual void setWindowTitle(string const &) = 0;
/** The last textclass layout list in the layout choice selector
This should probably be moved to the toolbar, but for now it's
here. (Asger) */
Variables.h \
WorkArea.C \
WorkArea.h \
+ XFormsView.C \
+ XFormsView.h \
broken_headers.h \
buffer.C \
buffer.h \
--- /dev/null
+
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2001 The LyX Team.
+ *
+ * ====================================================== */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+//#include <sys/time.h>
+//#include <unistd.h>
+
+#include "XFormsView.h"
+#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
+#include "lyxlookup.h"
+#endif
+#include "minibuffer.h"
+#include "debug.h"
+#include "intl.h"
+#include "lyxrc.h"
+#include "support/filetools.h" // OnlyFilename()
+#include "frontends/Toolbar.h"
+#include "frontends/Menubar.h"
+#include "MenuBackend.h"
+#include "ToolbarDefaults.h"
+#include "lyxfunc.h"
+#include "BufferView.h"
+
+using std::endl;
+
+//extern void AutoSave(BufferView *);
+extern void QuitLyX();
+
+// This is very temporary
+BufferView * current_view;
+
+extern "C" int C_XFormsView_atCloseMainFormCB(FL_FORM *, void *);
+
+
+XFormsView::XFormsView(int width, int height)
+ : LyXView()
+{
+ create_form_form_main(width, height);
+ fl_set_form_atclose(form_, C_XFormsView_atCloseMainFormCB, 0);
+
+ // Connect the minibuffer signals
+ minibuffer->stringReady.connect(SigC::slot(getLyXFunc(),
+ &LyXFunc::miniDispatch));
+ minibuffer->timeout.connect(SigC::slot(getLyXFunc(),
+ &LyXFunc::initMiniBuffer));
+
+ // Make sure the buttons are disabled if needed.
+ updateToolbar();
+}
+
+
+XFormsView::~XFormsView() {}
+
+
+/// Redraw the main form.
+void XFormsView::redraw() {
+ lyxerr[Debug::INFO] << "XFormsView::redraw()" << endl;
+ fl_redraw_form(form_);
+ getMiniBuffer()->redraw();
+}
+
+
+FL_FORM * XFormsView::getForm() const
+{
+ return form_;
+}
+
+
+// Callback for close main form from window manager
+int XFormsView::atCloseMainFormCB(FL_FORM *, void *)
+{
+ QuitLyX();
+ return FL_IGNORE;
+}
+
+
+// Wrapper for the above
+extern "C"
+int C_XFormsView_atCloseMainFormCB(FL_FORM * form, void * p)
+{
+ return XFormsView::atCloseMainFormCB(form, p);
+}
+
+
+void XFormsView::setPosition(int x, int y)
+{
+ fl_set_form_position(form_, x, y);
+}
+
+
+void XFormsView::show(int place, int border, string const & title)
+{
+ fl_show_form(form_, place, border, title.c_str());
+ getLyXFunc()->initMiniBuffer();
+#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
+ InitLyXLookup(fl_get_display(), form_->window);
+#endif
+}
+
+
+void XFormsView::create_form_form_main(int width, int height)
+ /* to make this work as it should, .lyxrc should have been
+ * read first; OR maybe this one should be made dynamic.
+ * Hmmmm. Lgb.
+ * We will probably not have lyxrc before the main form is
+ * initialized, because error messages from lyxrc parsing
+ * are presented (and rightly so) in GUI popups. Asger.
+ */
+{
+ // the main form
+ form_ = fl_bgn_form(FL_NO_BOX, width, height);
+ form_->u_vdata = this;
+ FL_OBJECT * obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
+ fl_set_object_color(obj, FL_MCOL, FL_MCOL);
+
+ // Parameters for the appearance of the main form
+ int const air = 2;
+ int const bw = abs(fl_get_border_width());
+
+ //
+ // THE MENUBAR
+ //
+ menubar = new Menubar(this, menubackend);
+
+ //
+ // TOOLBAR
+ //
+
+ toolbar = new Toolbar(this, air, 30 + air + bw, toolbardefaults);
+
+ // Setup the toolbar
+ toolbar->set(true);
+
+ //
+ // WORKAREA
+ //
+
+ int const ywork = 60 + 2 * air + bw;
+ int const workheight = height - ywork - (25 + 2 * air);
+
+ ::current_view = bufferview = new BufferView(this, air, ywork,
+ width - 3 * air,
+ workheight);
+
+ //
+ // MINIBUFFER
+ //
+
+ minibuffer = new MiniBuffer(this, air, height - (25 + air),
+ width - (2 * air), 25);
+
+ //
+ // TIMERS
+ //
+
+ autosave_timeout.timeout.connect(SigC::slot(this, &XFormsView::AutoSave));
+
+ //
+ // Misc
+ //
+
+ // assign an icon to main form
+ string iconname = LibFileSearch("images", "lyx", "xpm");
+ if (!iconname.empty()) {
+ unsigned int w, h;
+ Pixmap lyx_p, lyx_mask;
+ lyx_p = fl_read_pixmapfile(fl_root,
+ iconname.c_str(),
+ &w,
+ &h,
+ &lyx_mask,
+ 0,
+ 0,
+ 0); // this leaks
+ fl_set_form_icon(form_, lyx_p, lyx_mask);
+ }
+
+ // set min size
+ fl_set_form_minsize(form_, 50, 50);
+
+ fl_end_form();
+}
+
+
+void XFormsView::init()
+{
+ // Set the textclass choice
+ invalidateLayoutChoice();
+ updateLayoutChoice();
+ updateMenubar();
+
+ // Start autosave timer
+ if (lyxrc.autosave) {
+ autosave_timeout.setTimeout(lyxrc.autosave * 1000);
+ autosave_timeout.start();
+ }
+
+ intl->InitKeyMapper(lyxrc.use_kbmap);
+}
+
+
+void XFormsView::setWindowTitle(string const & title)
+{
+ fl_set_form_title(form_, title.c_str());
+}
+
+
+// How should this actually work? Should it prohibit input in all BufferViews,
+// or just in the current one? If "just the current one", then it should be
+// placed in BufferView. If "all BufferViews" then LyXGUI (I think) should
+// run "prohibitInput" on all LyXViews which will run prohibitInput on all
+// BufferViews. Or is it perhaps just the (input in) BufferViews in the
+// current LyxView that should be prohibited (Lgb) (This applies to
+// "allowInput" as well.)
+void XFormsView::prohibitInput() const
+{
+ view()->hideCursor();
+
+ static Cursor cursor;
+ static bool cursor_undefined = true;
+
+ if (cursor_undefined){
+ cursor = XCreateFontCursor(fl_get_display(), XC_watch);
+ XFlush(fl_get_display());
+ cursor_undefined = false;
+ }
+
+ /* set the cursor to the watch for all forms and the canvas */
+ XDefineCursor(fl_get_display(), getForm()->window, cursor);
+
+ XFlush(fl_get_display());
+ fl_deactivate_all_forms();
+}
+
+
+void XFormsView::allowInput() const
+{
+ /* reset the cursor from the watch for all forms and the canvas */
+
+ XUndefineCursor(fl_get_display(), getForm()->window);
+
+ XFlush(fl_get_display());
+ fl_activate_all_forms();
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2001 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef LyXView_H
+#define LyXView_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <config.h>
+#include FORMS_H_LOCATION
+
+#include "LyXView.h"
+
+/**
+ This class is the form containing the view of the buffer. The actual buffer
+ view is supposed (at least IMHO) to be another class, that shows its output
+ in one or more LyXView's.
+ */
+class XFormsView : public LyXView {
+public:
+ /// constructor
+ XFormsView(int w, int h);
+ /// destructor
+ ~XFormsView();
+ /// Where to place the form.
+ virtual void setPosition(int, int);
+ /// Show the main form.
+ virtual void show(int, int, string const & t = string("LyX"));
+ /// init (should probably be removed later) (Lgb)
+ virtual void init();
+ /// Redraw the main form.
+ virtual void redraw();
+ /// returns a pointer to the form.
+ FL_FORM * getForm() const;
+ ///
+ virtual void prohibitInput() const;
+ ///
+ virtual void allowInput() const;
+ /** This callback is run when a close event is sent from the
+ window manager. */
+ static int atCloseMainFormCB(FL_FORM *, void *);
+private:
+ ///
+ virtual void setWindowTitle(string const &);
+ /// makes the main form.
+ void create_form_form_main(int width, int height);
+ /// A pointer to the form.
+ FL_FORM * form_;
+};
+#endif
{
if (!users->text) return 0;
- ProhibitInput(users);
+ users->owner()->prohibitInput();
// get LaTeX-Filename
string const name = getLatexName();
users->redraw();
users->fitCursor(users->text);
}
- AllowInput(users);
+ users->owner()->allowInput();
return res;
}
if (buf->getUser()) buf->getUser()->insetUnlock();
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
if (buf->getUser())
- ProhibitInput(buf->getUser());
+ buf->getUser()->owner()->prohibitInput();
string fname;
if (buf->isUnnamed())
fname = OnlyFilename(buf->fileName());
reask = false;
} else {
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
return false;
}
break;
break;
case 3: // Cancel
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
return false;
}
}
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
}
bstore.release(buf);
}
-// How should this actually work? Should it prohibit input in all BufferViews,
-// or just in the current one? If "just the current one", then it should be
-// placed in BufferView. If "all BufferViews" then LyXGUI (I think) should
-// run "ProhibitInput" on all LyXViews which will run prohibitInput on all
-// BufferViews. Or is it perhaps just the (input in) BufferViews in the
-// current LyxView that should be prohibited (Lgb) (This applies to
-// "AllowInput" as well.)
-void ProhibitInput(BufferView * bv)
-{
- bv->hideCursor();
-
- static Cursor cursor;
- static bool cursor_undefined = true;
-
- if (cursor_undefined){
- cursor = XCreateFontCursor(fl_get_display(), XC_watch);
- XFlush(fl_get_display());
- cursor_undefined = false;
- }
-
- /* set the cursor to the watch for all forms and the canvas */
- XDefineCursor(fl_get_display(), bv->owner()->getForm()->window,
- cursor);
-
- XFlush(fl_get_display());
- fl_deactivate_all_forms();
-}
-
-
-void AllowInput(BufferView * bv)
-{
- /* reset the cursor from the watch for all forms and the canvas */
-
- XUndefineCursor(fl_get_display(), bv->owner()->getForm()->window);
-
- XFlush(fl_get_display());
- fl_activate_all_forms();
-}
-
-
void Code(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
///
extern void changeDepth(BufferView *, LyXText *, int);
///
-extern void ProhibitInput(BufferView *);
-///
-extern void AllowInput(BufferView *);
-///
extern void Code(BufferView *);
///
extern void Sans(BufferView *);
BufferView * bv = buffer->getUser();
bool need_redraw = false;
if (bv) {
- ProhibitInput(bv);
+ bv->owner()->prohibitInput();
// Remove all error insets
need_redraw = bv->removeAutoInsets();
}
bv->redraw();
bv->fitCursor(bv->text);
}
- AllowInput(bv);
+ bv->owner()->allowInput();
}
if ((result & LaTeX::ERRORS)) {
bool need_redraw = false;
if (bv) {
- ProhibitInput(bv);
+ bv->owner()->prohibitInput();
bv->owner()->message(_("Running LaTeX..."));
// Remove all error insets
need_redraw = bv->removeAutoInsets();
}
if (bv)
- AllowInput(bv);
+ bv->owner()->allowInput();
int const ERROR_MASK =
LaTeX::NO_LOGFILE |
+2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * GUIRunTime.h: add createMainView
+
2001-06-27 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.h: add showSpellcheckerPreferences
#pragma interface
#endif
+class LyXView;
+
/** The LyX GUI independent guiruntime class
The GUI interface is implemented in the corresponding
frontends GUIRunTime.C file.
/// This is run first in the LyXGUI constructor.
static
void setDefaults();
+ ///
+ static
+ LyXView * createMainView(int w, int h);
};
#endif
+2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * Toolbar_pimpl.h: make owner be a XFormsView, small changes
+ because of this.
+
+ * GUIRunTime.C (createMainView): implement
+
2001-06-22 John Levon <moz@compsoc.man.ac.uk>
* FormCharacter.C:
#include "support/lstrings.h"
-// temp. hack until Allow/ProhibitInput is not
+// temp. hack until Allow/prohibitInput is not
// needed any more in src/ - for now it's simplest
// to leave it there
#include "LyXView.h"
// no support for asynchronous selection yet
- ProhibitInput(lv_->view());
+ lv_->prohibitInput();
FileDialog::Result result;
result.first = FileDialog::Chosen;
result.second = private_->Select(title_, path, filter, suggested);
- AllowInput(lv_->view());
+ lv_->allowInput();
return result;
}
if (!ob)
ob = class_->choice_doc_class;
- ProhibitInput(lv_->view());
+ lv_->prohibitInput();
unsigned int tc = combo_doc_class->get() - 1;
if (textclasslist.Load(tc)) {
_("Reverting to original document class."));
combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
}
- AllowInput(lv_->view());
+ lv_->allowInput();
}
#endif
#include "GUIRunTime.h"
+#include "XFormsView.h"
#include "debug.h"
// I keep these here so that it will be processed as early in
| FL_PDMenuFontSize
| FL_PDBorderWidth, &cntl);
}
+
+
+LyXView * GUIRunTime::createMainView(int w, int h)
+{
+ return new XFormsView(w, h);
+}
#include "kbmap.h"
#include "buffer.h"
#include "Dialogs.h"
-#include "LyXView.h"
+#include "XFormsView.h"
#include "lyxfunc.h"
#include "FloatList.h"
#include "support/lstrings.h"
void Menubar::Pimpl::makeMenubar(Menu const & menu)
{
- FL_FORM * form = owner_->getForm();
+ FL_FORM * form = static_cast<XFormsView *>(owner_)->getForm();
int moffset = 0;
// Create menu frame if there is non yet.
item->submenu(), submenus);
if (menu != -1) {
// place popup
- fl_setpup_position(view->getForm()->x + ob->x,
- view->getForm()->y + ob->y + ob->h + 10);
+ fl_setpup_position(static_cast<XFormsView *>(view)->getForm()->x + ob->x,
+ static_cast<XFormsView *>(view)->getForm()->y + ob->y + ob->h + 10);
int choice = fl_dopup(menu);
if (button == 1) {
#include "Toolbar_pimpl.h"
#include "debug.h"
-#include "LyXView.h"
+#include "XFormsView.h"
#include "lyxfunc.h"
#include "func_status.h"
#include "BufferView.h"
Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
- : owner(o), sxpos(x), sypos(y)
+ : owner(static_cast<XFormsView *>(o)), sxpos(x), sypos(y)
{
combox = 0;
#if FL_REVISION < 89
void ToolbarCB(FL_OBJECT * ob, long ac)
{
- LyXView * owner = static_cast<LyXView *>(ob->u_vdata);
+ XFormsView * owner = static_cast<XFormsView *>(ob->u_vdata);
string res = owner->getLyXFunc()->Dispatch(int(ac));
if (!res.empty())
lightReset();
}
+
void Toolbar::Pimpl::lightReset() {
xpos = sxpos - standardspacing;
ypos = sypos;
#pragma interface
#endif
+class XFormsView;
+
/** The LyX xforms toolbar class
*/
struct Toolbar::Pimpl {
/// The list containing all the buttons
ToolbarList toollist;
///
- LyXView * owner;
+ XFormsView * owner;
#if FL_REVISION < 89
///
FL_OBJECT * bubble_timer;
bool selection = false;
bool mark_set = false;
-// ProhibitInput(bv);
+// bv->owner()->prohibitInput();
if (locked) {
LyXText * t = getLyXText(bv);
// this will scroll the screen such that the cursor becomes visible
bv->updateScrollbar();
-// AllowInput(bv);
+// bv->owner()->allowInput();
if (the_locking_inset) {
/// then resize all LyXText in text-insets
inset_x = cx(bv) - top_x + drawTextXOffset;
void MenuInsertLabel(BufferView * bv, string const & arg)
{
string label(arg);
- ProhibitInput(bv);
+ bv->owner()->prohibitInput();
if (label.empty()) {
Paragraph * par = bv->text->cursor.par();
LyXLayout const * layout =
InsetLabel * inset = new InsetLabel( p );
bv->insertInset( inset );
}
- AllowInput(bv);
+ bv->owner()->allowInput();
}
extern LyXServer * lyxserver;
extern bool finished; // flag, that we are quitting the program
extern BufferList bufferlist;
-extern GUIRunTime guiruntime;
extern string user_lyxdir;
FL_CMD_OPT cmdopt[] =
void LyXGUI::create_forms()
{
lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
- lyxViews = new LyXView(width, height);
+ lyxViews = GUIRunTime::createMainView(width, height);
lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
// From here down should be done by somebody else. (Lgb)
{
if (!gui) return;
- guiruntime.runTime();
+ GUIRunTime::runTime();
}
lview = current_view->owner();
if (lview) {
/// Write to minibuffer
- ProhibitInput(current_view);
+ lview->prohibitInput();
string const msg = s1 + ' ' + s2 + ' ' + s3;
lview->message(msg);
fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
- AllowInput(current_view);
+ lview->allowInput();
} else {
/// Write to lyxerr
lyxerr << "----------------------------------------" << endl
setErrorMessage(N_("Missing argument"));
break;
}
- ProhibitInput(owner->view());
+ owner->prohibitInput();
string const fname = i18nLibFileSearch("doc", arg, "lyx");
if (fname.empty()) {
lyxerr << "LyX: unable to find documentation file `"
<< arg << "'. Bad installation?" << endl;
- AllowInput(owner->view());
+ owner->allowInput();
break;
}
ostringstream str;
str << _("Opening help file") << ' '
<< MakeDisplayPath(fname) << "...";
owner->message(str.str().c_str());
- owner->view()->buffer(bufferlist.loadLyXFile(fname,false));
- AllowInput(owner->view());
+ owner->view()->buffer(bufferlist.loadLyXFile(fname, false));
+ owner->allowInput();
break;
}
case LFUN_HELP_VERSION: {
- ProhibitInput(owner->view());
+ owner->prohibitInput();
string msg(_("LyX Version "));
msg += LYX_VERSION;
msg += " of ";
+ MakeDisplayPath(system_lyxdir)).c_str(),
(_("User directory: ")
+ MakeDisplayPath(user_lyxdir)).c_str());
- AllowInput(owner->view());
+ owner->allowInput();
break;
}
#include "support/lyxalgo.h"
#include "support/filetools.h"
#include "LyXView.h"
+#include "XFormsView.h"
#include "gettext.h"
#include "LyXAction.h"
#include "BufferView.h"
text.erase();
fl_set_input(the_buffer, "");
activate();
- fl_set_focus_object(owner_->getForm(), the_buffer);
+ fl_set_focus_object(static_cast<XFormsView *>(owner_)->getForm(),
+ the_buffer);
}
int y = cur.y() - tmprow->baseline();
setHeightOfRow(bview, tmprow);
+
+#if 0
Paragraph * first_phys_par = tmprow->par();
// find the first row of the paragraph
y -= tmprow->height();
setHeightOfRow(bview, tmprow);
}
+#else
+ while (tmprow->previous() && tmprow->previous()->par() == tmprow->par()) {
+ tmprow = tmprow->previous();
+ y -= tmprow->height();
+ setHeightOfRow(bview, tmprow);
+ }
+#endif
// we can set the refreshing parameters now
status = LyXText::NEED_MORE_REFRESH;
int y = cur.y() - tmprow->baseline();
setHeightOfRow(bview, tmprow);
+
+#if 0
Paragraph * first_phys_par = tmprow->par();
// find the first row of the paragraph
tmprow = tmprow->previous();
y -= tmprow->height();
}
-
+#else
+ while (tmprow->previous() && tmprow->previous()->par() == tmprow->par()) {
+ tmprow = tmprow->previous();
+ y -= tmprow->height();
+ }
+#endif
// we can set the refreshing parameters now
if (status == LyXText::UNCHANGED || y < refresh_y) {
refresh_y = y;
Paragraph const * endpar) const
{
Row * tmprow2;
- Paragraph * tmppar = 0, * first_phys_par = 0;
+ Paragraph * tmppar = 0;
+ Paragraph * first_phys_par = 0;
Row * tmprow = cur.row();
int y = cur.y() - tmprow->baseline();
-
- if (!tmprow->previous()){
+
+#if 0
+ if (!tmprow->previous()) {
first_phys_par = firstParagraph(); // a trick/hack for UNDO
} else {
first_phys_par = tmprow->par();
y -= tmprow->height();
}
}
-
+#else
+ if (!tmprow->previous()) {
+ // a trick/hack for UNDO
+ // Can somebody please tell me _why_ this solves
+ // anything. (Lgb)
+ first_phys_par = firstParagraph();
+ } else {
+ first_phys_par = tmprow->par();
+ while (tmprow->previous()
+ && tmprow->previous()->par() == first_phys_par) {
+ tmprow = tmprow->previous();
+ y -= tmprow->height();
+ }
+ }
+#endif
+
// we can set the refreshing parameters now
status = LyXText::NEED_MORE_REFRESH;
refresh_y = y;