mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-04 16:42:57 +00:00
text2 chane, XFormsView
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2175 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e546fb9b37
commit
b9d61343fc
@ -9,6 +9,7 @@ src/converter.C
|
|||||||
src/CutAndPaste.C
|
src/CutAndPaste.C
|
||||||
src/debug.C
|
src/debug.C
|
||||||
src/exporter.C
|
src/exporter.C
|
||||||
|
src/ext_l10n.h
|
||||||
src/figure_form.C
|
src/figure_form.C
|
||||||
src/figureForm.C
|
src/figureForm.C
|
||||||
src/FontLoader.C
|
src/FontLoader.C
|
||||||
|
@ -289,7 +289,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
|||||||
bool selection = false;
|
bool selection = false;
|
||||||
bool mark_set = false;
|
bool mark_set = false;
|
||||||
|
|
||||||
ProhibitInput(bv_);
|
owner_->prohibitInput();
|
||||||
|
|
||||||
owner_->message(_("Formatting document..."));
|
owner_->message(_("Formatting document..."));
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
|||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
setState();
|
setState();
|
||||||
AllowInput(bv_);
|
owner_->allowInput();
|
||||||
|
|
||||||
/// clear the "Formatting Document" message
|
/// clear the "Formatting Document" message
|
||||||
owner_->message("");
|
owner_->message("");
|
||||||
|
@ -1,3 +1,24 @@
|
|||||||
|
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>
|
2001-07-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* tabular.C (GetCellInset): update cur_cell also in the row/col
|
* tabular.C (GetCellInset): update cur_cell also in the row/col
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
#pragma implementation "FontLoader.h"
|
#pragma implementation "FontLoader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gettext.h"
|
#include FORMS_H_LOCATION
|
||||||
#include "FontLoader.h"
|
#include "FontLoader.h"
|
||||||
#include "FontInfo.h"
|
#include "FontInfo.h"
|
||||||
|
#include "gettext.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h" // lyxrc.font_*
|
#include "lyxrc.h" // lyxrc.font_*
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
|
177
src/LyXView.C
177
src/LyXView.C
@ -19,23 +19,17 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "LyXView.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 "minibuffer.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "support/filetools.h" // OnlyFilename()
|
#include "support/filetools.h" // OnlyFilename()
|
||||||
#include "layout.h"
|
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "frontends/Toolbar.h"
|
#include "frontends/Toolbar.h"
|
||||||
#include "frontends/Menubar.h"
|
#include "frontends/Menubar.h"
|
||||||
#include "MenuBackend.h"
|
#include "MenuBackend.h"
|
||||||
#include "ToolbarDefaults.h"
|
|
||||||
#include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs
|
#include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs
|
||||||
#include "bufferview_funcs.h" // CurrentState()
|
#include "bufferview_funcs.h" // CurrentState()
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -46,33 +40,17 @@ using std::endl;
|
|||||||
|
|
||||||
extern void AutoSave(BufferView *);
|
extern void AutoSave(BufferView *);
|
||||||
extern void QuitLyX();
|
extern void QuitLyX();
|
||||||
|
|
||||||
LyXTextClass::size_type current_layout = 0;
|
LyXTextClass::size_type current_layout = 0;
|
||||||
|
|
||||||
// This is very temporary
|
|
||||||
BufferView * current_view;
|
|
||||||
|
|
||||||
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
|
LyXView::LyXView()
|
||||||
|
|
||||||
|
|
||||||
LyXView::LyXView(int width, int height)
|
|
||||||
{
|
{
|
||||||
create_form_form_main(width, height);
|
|
||||||
fl_set_form_atclose(form_, C_LyXView_atCloseMainFormCB, 0);
|
|
||||||
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
||||||
lyxfunc = new LyXFunc(this);
|
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;
|
intl = new Intl;
|
||||||
|
|
||||||
// Make sure the buttons are disabled if needed.
|
|
||||||
toolbar->update();
|
|
||||||
menubar->update();
|
|
||||||
|
|
||||||
dialogs_ = new Dialogs(this);
|
dialogs_ = new Dialogs(this);
|
||||||
// temporary until all dialogs moved into Dialogs.
|
// temporary until all dialogs moved into Dialogs.
|
||||||
dialogs_->updateBufferDependent
|
dialogs_->updateBufferDependent
|
||||||
@ -96,14 +74,6 @@ LyXView::~LyXView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Redraw the main form.
|
|
||||||
void LyXView::redraw() {
|
|
||||||
lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
|
|
||||||
fl_redraw_form(form_);
|
|
||||||
minibuffer->redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LyXView::resize()
|
void LyXView::resize()
|
||||||
{
|
{
|
||||||
view()->resize();
|
view()->resize();
|
||||||
@ -123,12 +93,6 @@ BufferView * LyXView::view() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FL_FORM * LyXView::getForm() const
|
|
||||||
{
|
|
||||||
return form_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Toolbar * LyXView::getToolbar() const
|
Toolbar * LyXView::getToolbar() const
|
||||||
{
|
{
|
||||||
return toolbar;
|
return toolbar;
|
||||||
@ -217,139 +181,6 @@ void LyXView::resetAutosaveTimer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 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()
|
void LyXView::invalidateLayoutChoice()
|
||||||
{
|
{
|
||||||
last_textclass = -1;
|
last_textclass = -1;
|
||||||
@ -401,10 +232,8 @@ void LyXView::updateWindowTitle()
|
|||||||
title += _(" (read only)");
|
title += _(" (read only)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't update title if it's the same as last time
|
|
||||||
if (title != last_title) {
|
if (title != last_title) {
|
||||||
fl_set_form_title(form_, title.c_str());
|
setWindowTitle(title);
|
||||||
last_title = title;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
103
src/LyXView.h
103
src/LyXView.h
@ -1,63 +1,44 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
|
||||||
* ======================================================
|
|
||||||
*
|
|
||||||
* LyX, The Document Processor
|
|
||||||
*
|
|
||||||
* Copyright 1995 Matthias Ettrich
|
|
||||||
* Copyright 1995-2001 The LyX Team.
|
|
||||||
*
|
|
||||||
* ====================================================== */
|
|
||||||
|
|
||||||
#ifndef LyXView_H
|
#ifndef LYXVIEW_BASE_H
|
||||||
#define LyXView_H
|
#define LYXVIEW_BASE_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <config.h>
|
#include <boost/utility.hpp>
|
||||||
#include FORMS_H_LOCATION
|
#include <sigc++/signal_system.h>
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "frontends/Timeout.h"
|
#include "frontends/Timeout.h"
|
||||||
#include <boost/utility.hpp>
|
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
|
||||||
class LyXFunc;
|
class Buffer;
|
||||||
class Toolbar;
|
class Toolbar;
|
||||||
class MiniBuffer;
|
class MiniBuffer;
|
||||||
class Intl;
|
class Intl;
|
||||||
class Buffer;
|
|
||||||
class Menubar;
|
class Menubar;
|
||||||
|
|
||||||
class BufferView;
|
class BufferView;
|
||||||
class Dialogs;
|
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 {
|
class LyXView : public SigC::Object, boost::noncopyable {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
///
|
||||||
LyXView(int w, int h);
|
LyXView();
|
||||||
|
///
|
||||||
/// destructor
|
virtual ~LyXView();
|
||||||
~LyXView();
|
///
|
||||||
|
virtual void init() = 0;
|
||||||
/// Where to place the form.
|
///
|
||||||
void setPosition(int, int);
|
virtual void setPosition(int, int) = 0;
|
||||||
|
///
|
||||||
/// Show the main form.
|
virtual void show(int, int, string const &) = 0;
|
||||||
void show(int, int, string const & t = string("LyX"));
|
|
||||||
|
|
||||||
/// init (should probably be removed later) (Lgb)
|
|
||||||
void init();
|
|
||||||
|
|
||||||
/// Redraw the main form.
|
/// Redraw the main form.
|
||||||
void redraw();
|
virtual void redraw() = 0;
|
||||||
|
|
||||||
/// Resize all BufferViews in this LyXView (because the width changed)
|
/// Resize all BufferViews in this LyXView (because the width changed)
|
||||||
void resize();
|
void resize();
|
||||||
@ -68,9 +49,6 @@ public:
|
|||||||
///
|
///
|
||||||
BufferView * view() const;
|
BufferView * view() const;
|
||||||
|
|
||||||
/// returns a pointer to the form.
|
|
||||||
FL_FORM * getForm() const;
|
|
||||||
|
|
||||||
/// return a pointer to the toolbar
|
/// return a pointer to the toolbar
|
||||||
Toolbar * getToolbar() const;
|
Toolbar * getToolbar() const;
|
||||||
|
|
||||||
@ -116,39 +94,36 @@ public:
|
|||||||
|
|
||||||
/// Reset autosave timer
|
/// Reset autosave timer
|
||||||
void resetAutosaveTimer();
|
void resetAutosaveTimer();
|
||||||
private:
|
///
|
||||||
///
|
virtual void prohibitInput() const = 0;
|
||||||
LyXFunc * lyxfunc;
|
///
|
||||||
///
|
virtual void allowInput() const = 0;
|
||||||
Toolbar * toolbar;
|
protected:
|
||||||
///
|
|
||||||
MiniBuffer * minibuffer;
|
|
||||||
///
|
///
|
||||||
Menubar * menubar;
|
Menubar * menubar;
|
||||||
///
|
///
|
||||||
Intl * intl;
|
Toolbar * toolbar;
|
||||||
///
|
|
||||||
Dialogs * dialogs_;
|
|
||||||
|
|
||||||
/** This is supposed to be a pointer or a list of pointers to the
|
/** This is supposed to be a pointer or a list of pointers to the
|
||||||
BufferViews currently being shown in the LyXView. So far
|
BufferViews currently being shown in the LyXView. So far
|
||||||
this is not used, but that should change pretty soon. (Lgb) */
|
this is not used, but that should change pretty soon. (Lgb) */
|
||||||
BufferView * bufferview;
|
BufferView * bufferview;
|
||||||
|
///
|
||||||
|
MiniBuffer * minibuffer;
|
||||||
///
|
///
|
||||||
void invalidateLayoutChoice();
|
Intl * intl;
|
||||||
public:
|
|
||||||
/** This callback is run when a close event is sent from the
|
|
||||||
window manager. */
|
|
||||||
static int atCloseMainFormCB(FL_FORM *, void *);
|
|
||||||
/// A callback
|
|
||||||
void AutoSave();
|
|
||||||
private:
|
|
||||||
///
|
///
|
||||||
Timeout autosave_timeout;
|
Timeout autosave_timeout;
|
||||||
/// makes the main form.
|
/// A callback
|
||||||
void create_form_form_main(int width, int height);
|
void AutoSave();
|
||||||
/// A pointer to the form.
|
///
|
||||||
FL_FORM * form_;
|
void invalidateLayoutChoice();
|
||||||
|
private:
|
||||||
|
///
|
||||||
|
LyXFunc * lyxfunc;
|
||||||
|
///
|
||||||
|
Dialogs * dialogs_;
|
||||||
|
///
|
||||||
|
virtual void setWindowTitle(string const &) = 0;
|
||||||
/** The last textclass layout list in the layout choice selector
|
/** The last textclass layout list in the layout choice selector
|
||||||
This should probably be moved to the toolbar, but for now it's
|
This should probably be moved to the toolbar, but for now it's
|
||||||
here. (Asger) */
|
here. (Asger) */
|
||||||
|
@ -83,6 +83,8 @@ lyx_SOURCES = \
|
|||||||
Variables.h \
|
Variables.h \
|
||||||
WorkArea.C \
|
WorkArea.C \
|
||||||
WorkArea.h \
|
WorkArea.h \
|
||||||
|
XFormsView.C \
|
||||||
|
XFormsView.h \
|
||||||
broken_headers.h \
|
broken_headers.h \
|
||||||
buffer.C \
|
buffer.C \
|
||||||
buffer.h \
|
buffer.h \
|
||||||
|
257
src/XFormsView.C
Normal file
257
src/XFormsView.C
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
|
||||||
|
/* 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();
|
||||||
|
}
|
60
src/XFormsView.h
Normal file
60
src/XFormsView.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// -*- 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
|
@ -3229,7 +3229,7 @@ int Buffer::runChktex()
|
|||||||
{
|
{
|
||||||
if (!users->text) return 0;
|
if (!users->text) return 0;
|
||||||
|
|
||||||
ProhibitInput(users);
|
users->owner()->prohibitInput();
|
||||||
|
|
||||||
// get LaTeX-Filename
|
// get LaTeX-Filename
|
||||||
string const name = getLatexName();
|
string const name = getLatexName();
|
||||||
@ -3267,7 +3267,7 @@ int Buffer::runChktex()
|
|||||||
users->redraw();
|
users->redraw();
|
||||||
users->fitCursor(users->text);
|
users->fitCursor(users->text);
|
||||||
}
|
}
|
||||||
AllowInput(users);
|
users->owner()->allowInput();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ bool BufferList::close(Buffer * buf)
|
|||||||
if (buf->getUser()) buf->getUser()->insetUnlock();
|
if (buf->getUser()) buf->getUser()->insetUnlock();
|
||||||
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
|
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
|
||||||
if (buf->getUser())
|
if (buf->getUser())
|
||||||
ProhibitInput(buf->getUser());
|
buf->getUser()->owner()->prohibitInput();
|
||||||
string fname;
|
string fname;
|
||||||
if (buf->isUnnamed())
|
if (buf->isUnnamed())
|
||||||
fname = OnlyFilename(buf->fileName());
|
fname = OnlyFilename(buf->fileName());
|
||||||
@ -193,7 +193,7 @@ bool BufferList::close(Buffer * buf)
|
|||||||
reask = false;
|
reask = false;
|
||||||
} else {
|
} else {
|
||||||
if (buf->getUser())
|
if (buf->getUser())
|
||||||
AllowInput(buf->getUser());
|
buf->getUser()->owner()->allowInput();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -205,12 +205,12 @@ bool BufferList::close(Buffer * buf)
|
|||||||
break;
|
break;
|
||||||
case 3: // Cancel
|
case 3: // Cancel
|
||||||
if (buf->getUser())
|
if (buf->getUser())
|
||||||
AllowInput(buf->getUser());
|
buf->getUser()->owner()->allowInput();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (buf->getUser())
|
if (buf->getUser())
|
||||||
AllowInput(buf->getUser());
|
buf->getUser()->owner()->allowInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
bstore.release(buf);
|
bstore.release(buf);
|
||||||
|
@ -103,46 +103,6 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 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)
|
void Code(BufferView * bv)
|
||||||
{
|
{
|
||||||
LyXFont font(LyXFont::ALL_IGNORE);
|
LyXFont font(LyXFont::ALL_IGNORE);
|
||||||
|
@ -41,10 +41,6 @@ extern void Tex(BufferView *);
|
|||||||
///
|
///
|
||||||
extern void changeDepth(BufferView *, LyXText *, int);
|
extern void changeDepth(BufferView *, LyXText *, int);
|
||||||
///
|
///
|
||||||
extern void ProhibitInput(BufferView *);
|
|
||||||
///
|
|
||||||
extern void AllowInput(BufferView *);
|
|
||||||
///
|
|
||||||
extern void Code(BufferView *);
|
extern void Code(BufferView *);
|
||||||
///
|
///
|
||||||
extern void Sans(BufferView *);
|
extern void Sans(BufferView *);
|
||||||
|
@ -761,7 +761,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
|
|||||||
BufferView * bv = buffer->getUser();
|
BufferView * bv = buffer->getUser();
|
||||||
bool need_redraw = false;
|
bool need_redraw = false;
|
||||||
if (bv) {
|
if (bv) {
|
||||||
ProhibitInput(bv);
|
bv->owner()->prohibitInput();
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
need_redraw = bv->removeAutoInsets();
|
need_redraw = bv->removeAutoInsets();
|
||||||
}
|
}
|
||||||
@ -779,7 +779,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
|
|||||||
bv->redraw();
|
bv->redraw();
|
||||||
bv->fitCursor(bv->text);
|
bv->fitCursor(bv->text);
|
||||||
}
|
}
|
||||||
AllowInput(bv);
|
bv->owner()->allowInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result & LaTeX::ERRORS)) {
|
if ((result & LaTeX::ERRORS)) {
|
||||||
@ -819,7 +819,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
|||||||
bool need_redraw = false;
|
bool need_redraw = false;
|
||||||
|
|
||||||
if (bv) {
|
if (bv) {
|
||||||
ProhibitInput(bv);
|
bv->owner()->prohibitInput();
|
||||||
bv->owner()->message(_("Running LaTeX..."));
|
bv->owner()->message(_("Running LaTeX..."));
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
need_redraw = bv->removeAutoInsets();
|
need_redraw = bv->removeAutoInsets();
|
||||||
@ -873,7 +873,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bv)
|
if (bv)
|
||||||
AllowInput(bv);
|
bv->owner()->allowInput();
|
||||||
|
|
||||||
int const ERROR_MASK =
|
int const ERROR_MASK =
|
||||||
LaTeX::NO_LOGFILE |
|
LaTeX::NO_LOGFILE |
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-07-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* GUIRunTime.h: add createMainView
|
||||||
|
|
||||||
2001-06-27 John Levon <moz@compsoc.man.ac.uk>
|
2001-06-27 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* Dialogs.h: add showSpellcheckerPreferences
|
* Dialogs.h: add showSpellcheckerPreferences
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class LyXView;
|
||||||
|
|
||||||
/** The LyX GUI independent guiruntime class
|
/** The LyX GUI independent guiruntime class
|
||||||
The GUI interface is implemented in the corresponding
|
The GUI interface is implemented in the corresponding
|
||||||
frontends GUIRunTime.C file.
|
frontends GUIRunTime.C file.
|
||||||
@ -33,5 +35,8 @@ public:
|
|||||||
/// This is run first in the LyXGUI constructor.
|
/// This is run first in the LyXGUI constructor.
|
||||||
static
|
static
|
||||||
void setDefaults();
|
void setDefaults();
|
||||||
|
///
|
||||||
|
static
|
||||||
|
LyXView * createMainView(int w, int h);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
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>
|
2001-06-22 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* FormCharacter.C:
|
* FormCharacter.C:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "support/lstrings.h"
|
#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
|
// needed any more in src/ - for now it's simplest
|
||||||
// to leave it there
|
// to leave it there
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
@ -67,14 +67,14 @@ FileDialog::Result const FileDialog::Select(string const & path, string const &
|
|||||||
|
|
||||||
// no support for asynchronous selection yet
|
// no support for asynchronous selection yet
|
||||||
|
|
||||||
ProhibitInput(lv_->view());
|
lv_->prohibitInput();
|
||||||
|
|
||||||
FileDialog::Result result;
|
FileDialog::Result result;
|
||||||
|
|
||||||
result.first = FileDialog::Chosen;
|
result.first = FileDialog::Chosen;
|
||||||
result.second = private_->Select(title_, path, filter, suggested);
|
result.second = private_->Select(title_, path, filter, suggested);
|
||||||
|
|
||||||
AllowInput(lv_->view());
|
lv_->allowInput();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
|||||||
if (!ob)
|
if (!ob)
|
||||||
ob = class_->choice_doc_class;
|
ob = class_->choice_doc_class;
|
||||||
|
|
||||||
ProhibitInput(lv_->view());
|
lv_->prohibitInput();
|
||||||
|
|
||||||
unsigned int tc = combo_doc_class->get() - 1;
|
unsigned int tc = combo_doc_class->get() - 1;
|
||||||
if (textclasslist.Load(tc)) {
|
if (textclasslist.Load(tc)) {
|
||||||
@ -1047,7 +1047,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
|||||||
_("Reverting to original document class."));
|
_("Reverting to original document class."));
|
||||||
combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
|
combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
|
||||||
}
|
}
|
||||||
AllowInput(lv_->view());
|
lv_->allowInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "GUIRunTime.h"
|
#include "GUIRunTime.h"
|
||||||
|
#include "XFormsView.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
// I keep these here so that it will be processed as early in
|
// I keep these here so that it will be processed as early in
|
||||||
@ -110,3 +111,9 @@ void GUIRunTime::setDefaults()
|
|||||||
| FL_PDMenuFontSize
|
| FL_PDMenuFontSize
|
||||||
| FL_PDBorderWidth, &cntl);
|
| FL_PDBorderWidth, &cntl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LyXView * GUIRunTime::createMainView(int w, int h)
|
||||||
|
{
|
||||||
|
return new XFormsView(w, h);
|
||||||
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "kbmap.h"
|
#include "kbmap.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "LyXView.h"
|
#include "XFormsView.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "FloatList.h"
|
#include "FloatList.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
@ -97,7 +97,7 @@ Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb)
|
|||||||
|
|
||||||
void Menubar::Pimpl::makeMenubar(Menu const & menu)
|
void Menubar::Pimpl::makeMenubar(Menu const & menu)
|
||||||
{
|
{
|
||||||
FL_FORM * form = owner_->getForm();
|
FL_FORM * form = static_cast<XFormsView *>(owner_)->getForm();
|
||||||
int moffset = 0;
|
int moffset = 0;
|
||||||
|
|
||||||
// Create menu frame if there is non yet.
|
// Create menu frame if there is non yet.
|
||||||
@ -565,8 +565,8 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
|
|||||||
item->submenu(), submenus);
|
item->submenu(), submenus);
|
||||||
if (menu != -1) {
|
if (menu != -1) {
|
||||||
// place popup
|
// place popup
|
||||||
fl_setpup_position(view->getForm()->x + ob->x,
|
fl_setpup_position(static_cast<XFormsView *>(view)->getForm()->x + ob->x,
|
||||||
view->getForm()->y + ob->y + ob->h + 10);
|
static_cast<XFormsView *>(view)->getForm()->y + ob->y + ob->h + 10);
|
||||||
int choice = fl_dopup(menu);
|
int choice = fl_dopup(menu);
|
||||||
|
|
||||||
if (button == 1) {
|
if (button == 1) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Toolbar_pimpl.h"
|
#include "Toolbar_pimpl.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "LyXView.h"
|
#include "XFormsView.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "func_status.h"
|
#include "func_status.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
@ -81,7 +81,7 @@ Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti) {
|
|||||||
|
|
||||||
|
|
||||||
Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
|
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;
|
combox = 0;
|
||||||
#if FL_REVISION < 89
|
#if FL_REVISION < 89
|
||||||
@ -268,7 +268,7 @@ namespace {
|
|||||||
|
|
||||||
void ToolbarCB(FL_OBJECT * ob, long ac)
|
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));
|
string res = owner->getLyXFunc()->Dispatch(int(ac));
|
||||||
if (!res.empty())
|
if (!res.empty())
|
||||||
@ -530,6 +530,7 @@ void Toolbar::Pimpl::reset()
|
|||||||
lightReset();
|
lightReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::Pimpl::lightReset() {
|
void Toolbar::Pimpl::lightReset() {
|
||||||
xpos = sxpos - standardspacing;
|
xpos = sxpos - standardspacing;
|
||||||
ypos = sypos;
|
ypos = sypos;
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class XFormsView;
|
||||||
|
|
||||||
/** The LyX xforms toolbar class
|
/** The LyX xforms toolbar class
|
||||||
*/
|
*/
|
||||||
struct Toolbar::Pimpl {
|
struct Toolbar::Pimpl {
|
||||||
@ -98,7 +100,7 @@ public:
|
|||||||
/// The list containing all the buttons
|
/// The list containing all the buttons
|
||||||
ToolbarList toollist;
|
ToolbarList toollist;
|
||||||
///
|
///
|
||||||
LyXView * owner;
|
XFormsView * owner;
|
||||||
#if FL_REVISION < 89
|
#if FL_REVISION < 89
|
||||||
///
|
///
|
||||||
FL_OBJECT * bubble_timer;
|
FL_OBJECT * bubble_timer;
|
||||||
|
@ -1702,7 +1702,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
|||||||
bool selection = false;
|
bool selection = false;
|
||||||
bool mark_set = false;
|
bool mark_set = false;
|
||||||
|
|
||||||
// ProhibitInput(bv);
|
// bv->owner()->prohibitInput();
|
||||||
|
|
||||||
if (locked) {
|
if (locked) {
|
||||||
LyXText * t = getLyXText(bv);
|
LyXText * t = getLyXText(bv);
|
||||||
@ -1746,7 +1746,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
|||||||
|
|
||||||
// this will scroll the screen such that the cursor becomes visible
|
// this will scroll the screen such that the cursor becomes visible
|
||||||
bv->updateScrollbar();
|
bv->updateScrollbar();
|
||||||
// AllowInput(bv);
|
// bv->owner()->allowInput();
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
/// then resize all LyXText in text-insets
|
/// then resize all LyXText in text-insets
|
||||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||||
|
@ -472,7 +472,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
|
|||||||
void MenuInsertLabel(BufferView * bv, string const & arg)
|
void MenuInsertLabel(BufferView * bv, string const & arg)
|
||||||
{
|
{
|
||||||
string label(arg);
|
string label(arg);
|
||||||
ProhibitInput(bv);
|
bv->owner()->prohibitInput();
|
||||||
if (label.empty()) {
|
if (label.empty()) {
|
||||||
Paragraph * par = bv->text->cursor.par();
|
Paragraph * par = bv->text->cursor.par();
|
||||||
LyXLayout const * layout =
|
LyXLayout const * layout =
|
||||||
@ -520,7 +520,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
|
|||||||
InsetLabel * inset = new InsetLabel( p );
|
InsetLabel * inset = new InsetLabel( p );
|
||||||
bv->insertInset( inset );
|
bv->insertInset( inset );
|
||||||
}
|
}
|
||||||
AllowInput(bv);
|
bv->owner()->allowInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ FD_form_figure * fd_form_figure;
|
|||||||
extern LyXServer * lyxserver;
|
extern LyXServer * lyxserver;
|
||||||
extern bool finished; // flag, that we are quitting the program
|
extern bool finished; // flag, that we are quitting the program
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
extern GUIRunTime guiruntime;
|
|
||||||
extern string user_lyxdir;
|
extern string user_lyxdir;
|
||||||
|
|
||||||
FL_CMD_OPT cmdopt[] =
|
FL_CMD_OPT cmdopt[] =
|
||||||
@ -267,7 +266,7 @@ void LyXGUI::init()
|
|||||||
void LyXGUI::create_forms()
|
void LyXGUI::create_forms()
|
||||||
{
|
{
|
||||||
lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
|
||||||
lyxViews = new LyXView(width, height);
|
lyxViews = GUIRunTime::createMainView(width, height);
|
||||||
lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
|
lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
|
||||||
|
|
||||||
// From here down should be done by somebody else. (Lgb)
|
// From here down should be done by somebody else. (Lgb)
|
||||||
@ -312,7 +311,7 @@ void LyXGUI::runTime()
|
|||||||
{
|
{
|
||||||
if (!gui) return;
|
if (!gui) return;
|
||||||
|
|
||||||
guiruntime.runTime();
|
GUIRunTime::runTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,12 +137,12 @@ void WriteAlert(string const & s1, string const & s2, string const & s3)
|
|||||||
lview = current_view->owner();
|
lview = current_view->owner();
|
||||||
if (lview) {
|
if (lview) {
|
||||||
/// Write to minibuffer
|
/// Write to minibuffer
|
||||||
ProhibitInput(current_view);
|
lview->prohibitInput();
|
||||||
string const msg = s1 + ' ' + s2 + ' ' + s3;
|
string const msg = s1 + ' ' + s2 + ' ' + s3;
|
||||||
lview->message(msg);
|
lview->message(msg);
|
||||||
fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
|
fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
|
||||||
fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
|
fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
|
||||||
AllowInput(current_view);
|
lview->allowInput();
|
||||||
} else {
|
} else {
|
||||||
/// Write to lyxerr
|
/// Write to lyxerr
|
||||||
lyxerr << "----------------------------------------" << endl
|
lyxerr << "----------------------------------------" << endl
|
||||||
|
@ -1070,25 +1070,25 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
setErrorMessage(N_("Missing argument"));
|
setErrorMessage(N_("Missing argument"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ProhibitInput(owner->view());
|
owner->prohibitInput();
|
||||||
string const fname = i18nLibFileSearch("doc", arg, "lyx");
|
string const fname = i18nLibFileSearch("doc", arg, "lyx");
|
||||||
if (fname.empty()) {
|
if (fname.empty()) {
|
||||||
lyxerr << "LyX: unable to find documentation file `"
|
lyxerr << "LyX: unable to find documentation file `"
|
||||||
<< arg << "'. Bad installation?" << endl;
|
<< arg << "'. Bad installation?" << endl;
|
||||||
AllowInput(owner->view());
|
owner->allowInput();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ostringstream str;
|
ostringstream str;
|
||||||
str << _("Opening help file") << ' '
|
str << _("Opening help file") << ' '
|
||||||
<< MakeDisplayPath(fname) << "...";
|
<< MakeDisplayPath(fname) << "...";
|
||||||
owner->message(str.str().c_str());
|
owner->message(str.str().c_str());
|
||||||
owner->view()->buffer(bufferlist.loadLyXFile(fname,false));
|
owner->view()->buffer(bufferlist.loadLyXFile(fname, false));
|
||||||
AllowInput(owner->view());
|
owner->allowInput();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_HELP_VERSION: {
|
case LFUN_HELP_VERSION: {
|
||||||
ProhibitInput(owner->view());
|
owner->prohibitInput();
|
||||||
string msg(_("LyX Version "));
|
string msg(_("LyX Version "));
|
||||||
msg += LYX_VERSION;
|
msg += LYX_VERSION;
|
||||||
msg += " of ";
|
msg += " of ";
|
||||||
@ -1098,7 +1098,7 @@ string const LyXFunc::Dispatch(int ac,
|
|||||||
+ MakeDisplayPath(system_lyxdir)).c_str(),
|
+ MakeDisplayPath(system_lyxdir)).c_str(),
|
||||||
(_("User directory: ")
|
(_("User directory: ")
|
||||||
+ MakeDisplayPath(user_lyxdir)).c_str());
|
+ MakeDisplayPath(user_lyxdir)).c_str());
|
||||||
AllowInput(owner->view());
|
owner->allowInput();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "support/lyxalgo.h"
|
#include "support/lyxalgo.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
|
#include "XFormsView.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
@ -246,7 +247,8 @@ void MiniBuffer::prepare()
|
|||||||
text.erase();
|
text.erase();
|
||||||
fl_set_input(the_buffer, "");
|
fl_set_input(the_buffer, "");
|
||||||
activate();
|
activate();
|
||||||
fl_set_focus_object(owner_->getForm(), the_buffer);
|
fl_set_focus_object(static_cast<XFormsView *>(owner_)->getForm(),
|
||||||
|
the_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
43
src/text2.C
43
src/text2.C
@ -758,6 +758,8 @@ void LyXText::redoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
|
|||||||
int y = cur.y() - tmprow->baseline();
|
int y = cur.y() - tmprow->baseline();
|
||||||
|
|
||||||
setHeightOfRow(bview, tmprow);
|
setHeightOfRow(bview, tmprow);
|
||||||
|
|
||||||
|
#if 0
|
||||||
Paragraph * first_phys_par = tmprow->par();
|
Paragraph * first_phys_par = tmprow->par();
|
||||||
|
|
||||||
// find the first row of the paragraph
|
// find the first row of the paragraph
|
||||||
@ -773,6 +775,13 @@ void LyXText::redoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
|
|||||||
y -= tmprow->height();
|
y -= tmprow->height();
|
||||||
setHeightOfRow(bview, tmprow);
|
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
|
// we can set the refreshing parameters now
|
||||||
status = LyXText::NEED_MORE_REFRESH;
|
status = LyXText::NEED_MORE_REFRESH;
|
||||||
@ -788,6 +797,8 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
|
|||||||
|
|
||||||
int y = cur.y() - tmprow->baseline();
|
int y = cur.y() - tmprow->baseline();
|
||||||
setHeightOfRow(bview, tmprow);
|
setHeightOfRow(bview, tmprow);
|
||||||
|
|
||||||
|
#if 0
|
||||||
Paragraph * first_phys_par = tmprow->par();
|
Paragraph * first_phys_par = tmprow->par();
|
||||||
|
|
||||||
// find the first row of the paragraph
|
// find the first row of the paragraph
|
||||||
@ -800,7 +811,12 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
|
|||||||
tmprow = tmprow->previous();
|
tmprow = tmprow->previous();
|
||||||
y -= tmprow->height();
|
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
|
// we can set the refreshing parameters now
|
||||||
if (status == LyXText::UNCHANGED || y < refresh_y) {
|
if (status == LyXText::UNCHANGED || y < refresh_y) {
|
||||||
refresh_y = y;
|
refresh_y = y;
|
||||||
@ -818,13 +834,15 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
|||||||
Paragraph const * endpar) const
|
Paragraph const * endpar) const
|
||||||
{
|
{
|
||||||
Row * tmprow2;
|
Row * tmprow2;
|
||||||
Paragraph * tmppar = 0, * first_phys_par = 0;
|
Paragraph * tmppar = 0;
|
||||||
|
Paragraph * first_phys_par = 0;
|
||||||
|
|
||||||
Row * tmprow = cur.row();
|
Row * tmprow = cur.row();
|
||||||
|
|
||||||
int y = cur.y() - tmprow->baseline();
|
int y = cur.y() - tmprow->baseline();
|
||||||
|
|
||||||
if (!tmprow->previous()){
|
#if 0
|
||||||
|
if (!tmprow->previous()) {
|
||||||
first_phys_par = firstParagraph(); // a trick/hack for UNDO
|
first_phys_par = firstParagraph(); // a trick/hack for UNDO
|
||||||
} else {
|
} else {
|
||||||
first_phys_par = tmprow->par();
|
first_phys_par = tmprow->par();
|
||||||
@ -841,7 +859,22 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
|||||||
y -= tmprow->height();
|
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
|
// we can set the refreshing parameters now
|
||||||
status = LyXText::NEED_MORE_REFRESH;
|
status = LyXText::NEED_MORE_REFRESH;
|
||||||
refresh_y = y;
|
refresh_y = y;
|
||||||
|
Loading…
Reference in New Issue
Block a user