mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
outstanding changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2551 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5974502f60
commit
2652ad62f4
@ -8,8 +8,6 @@ BOOST_INCLUDES = -I$(top_srcdir)/boost
|
||||
INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS) $(BOOST_INCLUDES)
|
||||
|
||||
EXTRA_DIST = \
|
||||
insetinfo.C \
|
||||
insetinfo.h \
|
||||
insetlist.C \
|
||||
insetlist.h \
|
||||
insetsection.h \
|
||||
|
@ -264,7 +264,7 @@ bool InsetBibtex::delDatabase(string const & db)
|
||||
int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
||||
{
|
||||
int w = 0;
|
||||
#warning Ha, now we are mainly at 1.2.0 and it is still here (Jug)
|
||||
// Ha, now we are mainly at 1.2.0 and it is still here (Jug)
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
Paragraph * par = bv->buffer()->paragraph;
|
||||
|
||||
|
@ -115,17 +115,13 @@ int InsetCaption::latex(Buffer const * buf, ostream & os,
|
||||
int InsetCaption::ascii(Buffer const * /*buf*/,
|
||||
ostream & /*os*/, int /*linelen*/) const
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Implement me!
|
||||
#endif
|
||||
// FIX: Implement me!
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetCaption::docBook(Buffer const * /*buf*/, ostream & /*os*/) const
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Implement me!
|
||||
#endif
|
||||
// Fix: Implement me!
|
||||
return 0;
|
||||
}
|
||||
|
@ -299,11 +299,8 @@ string const & InsetFloat::type() const
|
||||
|
||||
void InsetFloat::placement(string const & p)
|
||||
{
|
||||
// Here we should only allow the placement to be set
|
||||
// FIX: Here we should only allow the placement to be set
|
||||
// if a valid value.
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning FIX!
|
||||
#endif
|
||||
floatPlacement_ = p;
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,7 @@ void InsetFloatList::read(Buffer const *, LyXLex & lex)
|
||||
|
||||
void InsetFloatList::edit(BufferView *, int, int, unsigned int)
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Implement me please.
|
||||
#endif
|
||||
// FIX: Implement me please.
|
||||
#if 0
|
||||
bv->owner()->getDialogs()->showFloatList(this);
|
||||
#endif
|
||||
|
@ -1,253 +0,0 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "insetinfo.h"
|
||||
#include "paragraph.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||
#include "buffer.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "Painter.h"
|
||||
#include "font.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
/* Info, used for the Info boxes */
|
||||
|
||||
extern BufferView * current_view;
|
||||
|
||||
|
||||
InsetInfo::InsetInfo()
|
||||
: form(0), labelfont(LyXFont::ALL_SANE)
|
||||
{
|
||||
labelfont.decSize().decSize()
|
||||
.setColor(LColor::note);
|
||||
}
|
||||
|
||||
|
||||
InsetInfo::InsetInfo(string const & str)
|
||||
: contents(str), form(0), labelfont(LyXFont::ALL_SANE)
|
||||
{
|
||||
labelfont.decSize().decSize()
|
||||
.setColor(LColor::note);
|
||||
}
|
||||
|
||||
|
||||
InsetInfo::~InsetInfo()
|
||||
{
|
||||
if (form) {
|
||||
fl_hide_form(form);
|
||||
fl_free_form(form);
|
||||
form = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::ascent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
return lyxfont::maxAscent(labelfont) + 1;
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::descent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
return lyxfont::maxDescent(labelfont) + 1;
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::width(BufferView *, LyXFont const &) const
|
||||
{
|
||||
return 6 + lyxfont::width(_("Note"), labelfont);
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::draw(BufferView * bv, LyXFont const &,
|
||||
int baseline, float & x, bool) const
|
||||
{
|
||||
Painter & pain = bv->painter();
|
||||
|
||||
// Draw as "Note" in a yellow box
|
||||
x += 1;
|
||||
pain.fillRectangle(int(x), baseline - ascent(bv, labelfont),
|
||||
width(bv, labelfont) - 2,
|
||||
ascent(bv, labelfont) + descent(bv, labelfont) - 2,
|
||||
LColor::notebg);
|
||||
pain.rectangle(int(x), baseline - ascent(bv, labelfont),
|
||||
width(bv, labelfont) - 2,
|
||||
ascent(bv, labelfont) + descent(bv, labelfont) - 2,
|
||||
LColor::noteframe);
|
||||
|
||||
pain.text(int(x + 2), baseline, _("Note"), labelfont);
|
||||
x += width(bv, labelfont) - 1;
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::write(Buffer const *, ostream & os) const
|
||||
{
|
||||
os << "Info\n" << contents;
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::read(Buffer const *, LyXLex & lex)
|
||||
{
|
||||
string tmp = lex.GetString(); // should be "Info"
|
||||
if (tmp != "Info")
|
||||
lyxerr << "ERROR (InsetInfo::Read): "
|
||||
"consistency check 1 failed." << endl;
|
||||
|
||||
while (lex.IsOK()) {
|
||||
if (!lex.EatLine())
|
||||
// blank line in the file being read
|
||||
// should we skip blank lines?
|
||||
continue;
|
||||
|
||||
string const token = strip(lex.GetString());
|
||||
lyxerr[Debug::PARSER] << "Note: " << token << endl;
|
||||
|
||||
if (token != "\\end_inset") {
|
||||
contents += token + '\n';
|
||||
}
|
||||
else // token == "\\end_inset"
|
||||
break;
|
||||
}
|
||||
// now remove the last '\n's
|
||||
contents = strip(contents, '\n');
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::latex(Buffer const *, ostream &,
|
||||
bool /*fragile*/, bool /*free_spc*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::ascii(Buffer const *, ostream &, int) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::linuxdoc(Buffer const *, ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::docBook(Buffer const *, ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Inset::EDITABLE InsetInfo::editable() const
|
||||
{
|
||||
return IS_EDITABLE;
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::closeInfoCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
InsetInfo * inset = static_cast<InsetInfo*>(ob->u_vdata);
|
||||
string tmp = fl_get_input(inset->strobj);
|
||||
Buffer * buffer = current_view->buffer();
|
||||
if (tmp != inset->contents && !(buffer->isReadonly())) {
|
||||
buffer->markDirty();
|
||||
inset->contents = tmp;
|
||||
}
|
||||
if (inset->form) {
|
||||
fl_hide_form(inset->form);
|
||||
fl_free_form(inset->form);
|
||||
inset->form = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is just a wrapper.
|
||||
extern "C"
|
||||
void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
InsetInfo::closeInfoCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
string const InsetInfo::editMessage() const
|
||||
{
|
||||
return _("Opened note");
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::edit(BufferView *bv, int, int, unsigned int)
|
||||
{
|
||||
static int ow = -1;
|
||||
static int oh;
|
||||
|
||||
if (bv->buffer()->isReadonly())
|
||||
WarnReadonly(bv->buffer()->fileName());
|
||||
|
||||
if (!form) {
|
||||
FL_OBJECT *obj;
|
||||
form = fl_bgn_form(FL_UP_BOX, 400, 180);
|
||||
strobj = obj = fl_add_input(FL_MULTILINE_INPUT, 10, 10, 380, 120, "");
|
||||
fl_set_object_color(obj, FL_MCOL, FL_MCOL);
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 130, 140, 120, 30, idex(_("Close|#C^[")));
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
|
||||
fl_set_object_callback(obj, C_InsetInfo_CloseInfoCB, 0);
|
||||
obj->u_vdata = this;
|
||||
fl_set_object_shortcut(obj, scex(_("Close|#C^[")), 1);
|
||||
fl_end_form();
|
||||
fl_set_form_atclose(form, CancelCloseBoxCB, 0);
|
||||
}
|
||||
fl_set_input(strobj, contents.c_str());
|
||||
if (form->visible) {
|
||||
fl_raise_form(form);
|
||||
} else {
|
||||
fl_show_form(form,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
|
||||
_("Note"));
|
||||
if (ow < 0) {
|
||||
ow = form->w;
|
||||
oh = form->h;
|
||||
}
|
||||
fl_set_form_minsize(form, ow, oh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::edit(BufferView * bv, bool)
|
||||
{
|
||||
edit(bv, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetInfo::clone(Buffer const &, bool) const
|
||||
{
|
||||
return new InsetInfo(contents);
|
||||
}
|
||||
|
||||
|
||||
Inset::Code InsetInfo::lyxCode() const
|
||||
{
|
||||
return Inset::IGNORE_CODE;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of*
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 the LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#ifndef INSET_INFO_H
|
||||
#define INSET_INFO_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "inset.h"
|
||||
#include FORMS_H_LOCATION
|
||||
#include "LString.h"
|
||||
#include "lyxfont.h"
|
||||
|
||||
/** Info. Handles the note insets.
|
||||
|
||||
This class handles the note insets. The edit operation bringes up
|
||||
a dialog, where the user can type a note about life or something
|
||||
else of interest. When collapsed, the inset is displayed as "Note"
|
||||
in a yellow box. Currently, the Read-function is a terrible hack.
|
||||
Some day in the distant future, this will hopefully be obsoleted by
|
||||
a true comment-environment. */
|
||||
class InsetInfo : public Inset {
|
||||
public:
|
||||
///
|
||||
InsetInfo();
|
||||
///
|
||||
explicit
|
||||
InsetInfo(string const & string);
|
||||
///
|
||||
~InsetInfo();
|
||||
///
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
int descent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
int width(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||
///
|
||||
void write(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
void read(Buffer const *, LyXLex & lex);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
///
|
||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||
///
|
||||
int linuxdoc(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
int docBook(Buffer const *, std::ostream &) const;
|
||||
/// what appears in the minibuffer when opening
|
||||
string const editMessage() const;
|
||||
///
|
||||
void edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
void edit(BufferView * bv, bool front = true);
|
||||
///
|
||||
EDITABLE editable() const;
|
||||
///
|
||||
Inset::Code lyxCode() const;
|
||||
///
|
||||
virtual Inset * clone(Buffer const &, bool same_id = false) const;
|
||||
///
|
||||
static void closeInfoCB(FL_OBJECT *, long data);
|
||||
private:
|
||||
///
|
||||
string contents;
|
||||
///
|
||||
FL_FORM * form;
|
||||
///
|
||||
FL_OBJECT * strobj;
|
||||
///
|
||||
LyXFont labelfont;
|
||||
};
|
||||
#endif
|
@ -256,9 +256,8 @@ extern bool use_babel;
|
||||
int InsetQuotes::latex(Buffer const * buf, ostream & os,
|
||||
bool /*fragile*/, bool) const
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning How do we get the local language here??
|
||||
#endif
|
||||
// How do we get the local language here??
|
||||
|
||||
string const doclang = buf->getLanguage()->babel();
|
||||
const int quoteind = quote_index[side_][language_];
|
||||
string qstr;
|
||||
|
@ -65,7 +65,7 @@ extern bool math_insert_greek(BufferView *, char);
|
||||
extern int greek_kb_flag;
|
||||
|
||||
|
||||
#warning this functions should probably go into bufferview_funcs somehow (Jug)
|
||||
// These functions should probably go into bufferview_funcs somehow (Jug)
|
||||
|
||||
void InsetText::saveLyXTextState(LyXText * t) const
|
||||
{
|
||||
@ -1746,12 +1746,12 @@ void InsetText::setParagraphData(Paragraph * p)
|
||||
par = tmp;
|
||||
}
|
||||
|
||||
par = new Paragraph(*p);
|
||||
par = new Paragraph(*p, false);
|
||||
par->setInsetOwner(this);
|
||||
Paragraph * np = par;
|
||||
while (p->next()) {
|
||||
p = p->next();
|
||||
np->next(new Paragraph(*p));
|
||||
np->next(new Paragraph(*p, false));
|
||||
np->next()->previous(np);
|
||||
np = np->next();
|
||||
np->setInsetOwner(this);
|
||||
@ -2193,6 +2193,7 @@ string const InsetText::selectNextWord(BufferView * bv, float & value) const
|
||||
return str;
|
||||
}
|
||||
#warning Dekel please have a look on this one RTL? (Jug)
|
||||
#warning DEKEL!
|
||||
// we have to go on checking so move cusor to the right
|
||||
lt->cursor.pos(lt->cursor.pos() + 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user