some work on Floats and some cleanup in WorkArea, some changes to compile more easily with gcc 2.97

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1289 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-12-29 12:48:02 +00:00
parent 1600244f88
commit 74b224fcba
29 changed files with 496 additions and 148 deletions

View File

@ -1,3 +1,87 @@
2000-12-29 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/FileInfo.h: move unistd.h to after sys/types.h and
sys/stat.h.
* src/support/FileInfo.C: don't include sys/types. and sys/stat.h
* src/mathed/math_inset.h: move LString.h to be included first
* src/insets/insetfloat.C: adjust for change in private variable names
* src/frontends/xforms/xform_helpers.h : don't include config.h
* src/frontends/xforms/xform_helpers.C: adjust the order of
includes, some whitespace changes.
* src/trans.C (Load): constify filename and res
* src/text2.C (SetCounter): call Floating::name()
* src/screen.C: change to not use owner from WorkArea, but from
text instead.
* src/lyxfunc.C: adjust because of changes in Intl.
* src/intl.h: make trans a object instead of pointer, inlucd
trans_mgr.h in this file.
(getTrans): return a reference to TransManager
* src/intl.C: don't include trans_mgr.h here
modify calls to trans to work on object instead of on pointer
* src/WorkArea.h: add using for Signal1
comment out forward decl of BufferView.
add signal scrollCB
remove class variable owner_ and getter method for this.
* src/WorkArea.C: don't include BufferView.h
(WorkArea): change to not take a BufferView.h, use signals
instead.
(scroll_cb): emit signal
* src/LaTeXFeatures.C: include Floatlist.h
(getPackages): only load flot.sty when needed
(getMacros): prepare for outputting the correct code to preamble.
* src/Floating.h: make all variables private + rename to var_.
(Floating): default ctor
(Floating): complex ctor to set a complete Floating
(type): getter
(placement): getter
(name): getter
(builtin): getter
* src/FloatList.C (FloatList): use Floating's constructor
(begin): new method
(end): ditto
(newFloat): call type()
(defaultPlacement): call placement()
(operator): new operator
* src/BufferView_pimpl.C (Pimpl): modify call to WorkArea
(scrollUp): call pimpl's scrollCB
(scrollDown): ditto
(pasteClipboard): constify clip
* src/BufferView2.C (insertLyXFile): constify fname, fi and c.
(insertErrors): constify desctext, errortext, msgtxt and errorrow
(open_new_inset): delete some commented code.
* src/BufferView.[Ch] (enterView): comment out
(leaveView): ditto
(scrollCB): ditto
(workAreaMotionNotify): ditto
(workAreaButtonPress): ditto
(doubleClick): ditto
(tripleClick): ditto
(workAreaButtonRelease): ditto
(workAreaExpose): ditto
* config/lyxinclude.m4 (cross_compiling): small stuff to be able
to compile with cvs gcc (2.97).
2000-12-28 Dekel Tsur <dekelts@tau.ac.il> 2000-12-28 Dekel Tsur <dekelts@tau.ac.il>
* lib/ui/default.ui: menu structure cleanup. * lib/ui/default.ui: menu structure cleanup.

View File

@ -187,7 +187,8 @@ dnl Check the version of g++
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";; 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; 2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
2.96*) CXXFLAGS="-g $lyx_opt -fno-exceptions";; 2.96*) CXXFLAGS="-g $lyx_opt -fno-exceptions";;
2.97*) CXXFLAGS="-g $lyx_opt -fvtable-thunks -fno-builtin -ffunction-sections -fdata-sections";; 2.97*) CXXFLAGS="-g $lyx_opt -fvtable-thunks -fno-builtin -ffunction-sections -fdata-sections"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE=1";;
*2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; *2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; *) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
esac esac

View File

@ -53,35 +53,35 @@ src/frontends/kde/refdlg.C
src/frontends/kde/tocdlg.C src/frontends/kde/tocdlg.C
src/frontends/kde/urldlg.C src/frontends/kde/urldlg.C
src/frontends/xforms/FormBase.h src/frontends/xforms/FormBase.h
src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_citation.C src/frontends/xforms/form_citation.C
src/frontends/xforms/FormCopyright.C src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_copyright.C src/frontends/xforms/form_copyright.C
src/frontends/xforms/FormDocument.C src/frontends/xforms/FormCopyright.C
src/frontends/xforms/form_document.C src/frontends/xforms/form_document.C
src/frontends/xforms/FormError.C src/frontends/xforms/FormDocument.C
src/frontends/xforms/form_error.C src/frontends/xforms/form_error.C
src/frontends/xforms/FormGraphics.C src/frontends/xforms/FormError.C
src/frontends/xforms/form_graphics.C src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormIndex.C src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_index.C src/frontends/xforms/form_index.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormInset.h src/frontends/xforms/FormInset.h
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_paragraph.C src/frontends/xforms/form_paragraph.C
src/frontends/xforms/FormPreferences.C src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_preferences.C src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPrint.C src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_print.C src/frontends/xforms/form_print.C
src/frontends/xforms/FormRef.C src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_ref.C src/frontends/xforms/form_ref.C
src/frontends/xforms/FormTabular.C src/frontends/xforms/FormRef.C
src/frontends/xforms/form_tabular.C src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormTabularCreate.C src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular_create.C src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/FormToc.C src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/form_toc.C src/frontends/xforms/form_toc.C
src/frontends/xforms/FormUrl.C src/frontends/xforms/FormToc.C
src/frontends/xforms/form_url.C src/frontends/xforms/form_url.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/input_validators.C src/frontends/xforms/input_validators.C
src/frontends/xforms/Menubar_pimpl.C src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/xform_helpers.C src/frontends/xforms/xform_helpers.C

View File

@ -141,6 +141,7 @@ void BufferView::gotoError()
} }
#if 0
void BufferView::enterView() void BufferView::enterView()
{ {
pimpl_->enterView(); pimpl_->enterView();
@ -195,6 +196,7 @@ void BufferView::workAreaExpose()
{ {
pimpl_->workAreaExpose(); pimpl_->workAreaExpose();
} }
#endif
void BufferView::cursorPrevious(LyXText * text) void BufferView::cursorPrevious(LyXText * text)

View File

@ -232,6 +232,7 @@ public:
/// ///
void pushIntoUpdateList(Inset * i); void pushIntoUpdateList(Inset * i);
#if 0
/// ///
void workAreaExpose(); void workAreaExpose();
/// ///
@ -248,6 +249,7 @@ public:
void enterView(); void enterView();
/// ///
void leaveView(); void leaveView();
#endif
/// ///
bool ChangeRefs(string const & from, string const & to); bool ChangeRefs(string const & from, string const & to);
/// ///

View File

@ -53,10 +53,10 @@ bool BufferView::insertLyXFile(string const & filen)
{ {
if (filen.empty()) return false; if (filen.empty()) return false;
string fname = MakeAbsPath(filen); string const fname = MakeAbsPath(filen);
// check if file exist // check if file exist
FileInfo fi(fname); FileInfo const fi(fname);
if (!fi.readable()) { if (!fi.readable()) {
WriteAlert(_("Error!"), WriteAlert(_("Error!"),
@ -75,7 +75,7 @@ bool BufferView::insertLyXFile(string const & filen)
return false; return false;
} }
char c = ifs.peek(); char const c = ifs.peek();
LyXLex lex(0, 0); LyXLex lex(0, 0);
lex.setStream(ifs); lex.setStream(ifs);
@ -94,6 +94,7 @@ bool BufferView::insertLyXFile(string const & filen)
return res; return res;
} }
bool BufferView::removeAutoInsets() bool BufferView::removeAutoInsets()
{ {
LyXParagraph * par = buffer()->paragraph; LyXParagraph * par = buffer()->paragraph;
@ -145,10 +146,10 @@ void BufferView::insertErrors(TeXErrors & terr)
for (TeXErrors::Errors::const_iterator cit = terr.begin(); for (TeXErrors::Errors::const_iterator cit = terr.begin();
cit != terr.end(); cit != terr.end();
++cit) { ++cit) {
string desctext((*cit).error_desc); string const desctext((*cit).error_desc);
string errortext((*cit).error_text); string const errortext((*cit).error_text);
string msgtxt = desctext + '\n' + errortext; string const msgtxt = desctext + '\n' + errortext;
int errorrow = (*cit).error_in_line; int const errorrow = (*cit).error_in_line;
// Insert error string for row number // Insert error string for row number
int tmpid = -1; int tmpid = -1;
@ -269,8 +270,6 @@ bool BufferView::open_new_inset(UpdatableInset * new_inset)
delete new_inset; delete new_inset;
return false; return false;
} }
// text->CursorLeft(this);
// update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
new_inset->Edit(this, 0, 0, 0); new_inset->Edit(this, 0, 0, 0);
return true; return true;
} }
@ -861,6 +860,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
} }
} }
bool BufferView::ChangeRefs(string const & from, string const & to) bool BufferView::ChangeRefs(string const & from, string const & to)
{ {
bool flag = false; bool flag = false;
@ -919,6 +919,7 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
return ChangeRefs(from, to); return ChangeRefs(from, to);
} }
UpdatableInset * BufferView::theLockingInset() const UpdatableInset * BufferView::theLockingInset() const
{ {
// If NULL is not allowed we should put an Assert here. (Lgb) // If NULL is not allowed we should put an Assert here. (Lgb)

View File

@ -75,8 +75,13 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
: bv_(b), owner_(o), cursor_timeout(400) : bv_(b), owner_(o), cursor_timeout(400)
{ {
buffer_ = 0; buffer_ = 0;
#if 0
workarea_ = new WorkArea(bv_, xpos, ypos, width, height); workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
#else
workarea_ = new WorkArea(xpos, ypos, width, height);
#endif
// Setup the signals // Setup the signals
workarea_->scrollCB.connect(slot(this, &BufferView::Pimpl::scrollCB));
workarea_->workAreaExpose workarea_->workAreaExpose
.connect(slot(this, &BufferView::Pimpl::workAreaExpose)); .connect(slot(this, &BufferView::Pimpl::workAreaExpose));
workarea_->workAreaEnter workarea_->workAreaEnter
@ -472,7 +477,7 @@ int BufferView::Pimpl::scrollUp(long time)
workarea_->setScrollbarValue(value); workarea_->setScrollbarValue(value);
bv_->scrollCB(value); scrollCB(value);
return 0; return 0;
} }
@ -502,7 +507,7 @@ int BufferView::Pimpl::scrollDown(long time)
workarea_->setScrollbarValue(value); workarea_->setScrollbarValue(value);
bv_->scrollCB(value); scrollCB(value);
return 0; return 0;
} }
@ -1352,7 +1357,7 @@ void BufferView::Pimpl::pasteClipboard(bool asPara)
screen_->HideCursor(); screen_->HideCursor();
bv_->beforeChange(); bv_->beforeChange();
string clip(workarea_->getClipboard()); string const clip(workarea_->getClipboard());
if (clip.empty()) return; if (clip.empty()) return;

View File

@ -9,41 +9,39 @@
FloatList::FloatList() FloatList::FloatList()
{ {
// Insert the latex builtin float-types // Insert the latex builtin float-types
Floating table;
table.type = "table"; // table
table.placement = "htbp"; Floating table("table", "htbp", "lot", "", "plain", "Table", true);
table.ext = "lot"; list[table.type()] = table;
table.within = "";
table.style = "plain"; // figure
table.name = "Table"; Floating figure("figure", "htbp", "lof", "", "plain", "Figure", true);
table.builtin = true; list[figure.type()] = figure;
list[table.type] = table;
Floating figure;
figure.type = "figure";
figure.placement = "htbp";
figure.ext = "lof";
figure.within = "";
figure.style = "plain";
figure.name = "Figure";
figure.builtin = true;
list[figure.type] = figure;
// And we add algorithm too since LyX has // And we add algorithm too since LyX has
// supported that for a long time // supported that for a long time,
Floating algorithm; // but support for this should probably be moved to a layout file.
algorithm.type = "algorithm"; Floating algorithm("algorithm", "htbp", "loa",
algorithm.placement = "htbp"; "", "ruled", "Algorithm");
algorithm.ext = "loa"; list[algorithm.type()] = algorithm;
algorithm.within = ""; }
algorithm.style = "ruled";
algorithm.name = "Algorithm";
algorithm.builtin = false; FloatList::const_iterator FloatList::begin() const
list[algorithm.type] = algorithm; {
return list.begin();
}
FloatList::const_iterator FloatList::end() const
{
return list.end();
} }
void FloatList::newFloat(Floating const & fl) void FloatList::newFloat(Floating const & fl)
{ {
list[fl.type] = fl; list[fl.type()] = fl;
} }
@ -51,7 +49,7 @@ string const FloatList::defaultPlacement(string const & t) const
{ {
List::const_iterator cit = list.find(t); List::const_iterator cit = list.find(t);
if (cit != list.end()) if (cit != list.end())
return (*cit).second.placement; return (*cit).second.placement();
return string(); return string();
} }
@ -77,5 +75,12 @@ Floating const & FloatList::getType(string const & t) const
#endif #endif
} }
FloatList::const_iterator FloatList::operator[](string const & t) const
{
return list.find(t);
}
// The global floatlist // The global floatlist
FloatList floatList; FloatList floatList;

View File

@ -27,8 +27,14 @@ public:
/// ///
typedef std::map<string, Floating> List; typedef std::map<string, Floating> List;
/// ///
typedef List::const_iterator const_iterator;
///
FloatList(); FloatList();
/// ///
const_iterator begin() const;
///
const_iterator end() const;
///
void newFloat(Floating const & fl); void newFloat(Floating const & fl);
/// ///
string const defaultPlacement(string const & t) const; string const defaultPlacement(string const & t) const;
@ -36,6 +42,8 @@ public:
bool typeExist(string const & t) const; bool typeExist(string const & t) const;
/// ///
Floating const & getType(string const & t) const; Floating const & getType(string const & t) const;
///
const_iterator operator[](string const & t) const;
private: private:
/// ///
List list; List list;

View File

@ -25,18 +25,78 @@
class Floating { class Floating {
public: public:
/// ///
string type; Floating();
/// ///
string placement; Floating(string const & type, string const & placement,
string const & ext, string const & within,
string const & style, string const & name,
bool builtin = false);
/// ///
string ext; string const & type() const;
/// ///
string within; string const & placement() const;
/// ///
string style; string const & name() const;
/// ///
string name; bool builtin() const;
private:
/// ///
bool builtin; string type_;
///
string placement_;
///
string ext_;
///
string within_;
///
string style_;
///
string name_;
///
bool builtin_;
}; };
inline
Floating::Floating()
{}
inline
Floating::Floating(string const & type, string const & placement,
string const & ext, string const & within,
string const & style, string const & name,
bool builtin)
: type_(type), placement_(placement), ext_(ext), within_(within),
style_(style), name_(name), builtin_(builtin)
{}
inline
string const & Floating::type() const
{
return type_;
}
inline
string const & Floating::placement() const
{
return placement_;
}
inline
string const & Floating::name() const
{
return name_;
}
inline
bool Floating::builtin() const
{
return builtin_;
}
#endif #endif

View File

@ -23,6 +23,8 @@
#include "bufferparams.h" #include "bufferparams.h"
#include "layout.h" #include "layout.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "FloatList.h"
using std::endl; using std::endl;
LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n) LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n)
@ -252,11 +254,22 @@ string const LaTeXFeatures::getPackages()
packages += "\\usepackage{prettyref}\n"; packages += "\\usepackage{prettyref}\n";
// float.sty // float.sty
// This is not correct and needs fixing. // We only need float.sty if we use non builtin floats. This includes
// We don't need float.sty if we only use unchanged // modified table and figure floats. (Lgb)
// table and figure floats. (Lgb) if (!usedFloats.empty()) {
if (!usedFloats.empty()) bool use_float = false;
UsedFloats::const_iterator beg = usedFloats.begin();
UsedFloats::const_iterator end = usedFloats.end();
for (; beg != end; ++beg) {
Floating const & fl = floatList.getType((*beg));
if (!fl.type().empty() && !fl.builtin()) {
use_float = true;
break;
}
}
if (use_float)
packages += "\\usepackage{float}\n"; packages += "\\usepackage{float}\n";
}
packages += externalPreambles; packages += externalPreambles;
@ -317,6 +330,22 @@ string const LaTeXFeatures::getMacros()
// \floatstyle{ruled} // \floatstyle{ruled}
// \newfloat{algorithm}{htbp}{loa} // \newfloat{algorithm}{htbp}{loa}
// \floatname{algorithm}{Algorithm} // \floatname{algorithm}{Algorithm}
UsedFloats::const_iterator beg = usedFloats.begin();
UsedFloats::const_iterator end = usedFloats.end();
for (; beg != end; ++beg) {
Floating const & fl = floatList.getType((*beg));
// We have to special case "table" and "figure"
if ((fl.type() == "tabular" && !fl.builtin()) ||
(fl.type() == "figure" && !fl.builtin())) {
// Output code to modify "table" or "figure"
// but only if builtin == false
} else {
// The other non builtin floats.
}
}
return macros; return macros;
} }

View File

@ -134,9 +134,9 @@ struct LaTeXFeatures {
/// ///
LanguageList UsedLanguages; LanguageList UsedLanguages;
/// ///
typedef std::set<string> FloatList; typedef std::set<string> UsedFloats;
/// ///
FloatList usedFloats; UsedFloats usedFloats;
/// ///
typedef std::map<string , string> FileMap; typedef std::map<string , string> FileMap;
/// ///

View File

@ -18,7 +18,9 @@
#include "WorkArea.h" #include "WorkArea.h"
#include "debug.h" #include "debug.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#if 0
#include "BufferView.h" #include "BufferView.h"
#endif
#include "LyXView.h" #include "LyXView.h"
#include "lyxfunc.h" #include "lyxfunc.h"
@ -59,8 +61,16 @@ extern "C" {
WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height) WorkArea::WorkArea(
: owner_(o), workareapixmap(0), painter_(*this) #if 0
BufferView * o,
#endif
int xpos, int ypos, int width, int height)
:
#if 0
owner_(o),
#endif
workareapixmap(0), painter_(*this)
{ {
fl_freeze_all_forms(); fl_freeze_all_forms();
@ -261,7 +271,11 @@ void WorkArea::scroll_cb(FL_OBJECT * ob, long)
// If we really want the accellerating scroll we can do that // If we really want the accellerating scroll we can do that
// from here. IMHO that is a waste of effort since we already // from here. IMHO that is a waste of effort since we already
// have other ways to move fast around in the document. (Lgb) // have other ways to move fast around in the document. (Lgb)
#if 0
area->owner_->scrollCB(fl_get_scrollbar_value(ob)); area->owner_->scrollCB(fl_get_scrollbar_value(ob));
#else
area->scrollCB(fl_get_scrollbar_value(ob));
#endif
waitForX(); waitForX();
} }

View File

@ -25,17 +25,24 @@
#ifdef SIGC_CXX_NAMESPACES #ifdef SIGC_CXX_NAMESPACES
using SigC::Signal0; using SigC::Signal0;
using SigC::Signal1;
using SigC::Signal2; using SigC::Signal2;
using SigC::Signal3; using SigC::Signal3;
#endif #endif
#if 0
class BufferView; class BufferView;
#endif
/// ///
class WorkArea { class WorkArea {
public: public:
/// ///
WorkArea(BufferView *, int xpos, int ypos, int width, int height); WorkArea(
#if 0
BufferView *,
#endif
int xpos, int ypos, int width, int height);
/// ///
~WorkArea(); ~WorkArea();
/// ///
@ -103,13 +110,16 @@ public:
string const getClipboard() const; string const getClipboard() const;
/// ///
void putClipboard(string const &) const; void putClipboard(string const &) const;
#if 0
/// ///
BufferView * owner() const { return owner_; } BufferView * owner() const { return owner_; }
#endif
// Signals // Signals
/// ///
Signal0<void> workAreaExpose; Signal0<void> workAreaExpose;
/// ///
Signal1<void, double> scrollCB;
///
Signal2<void, KeySym, unsigned int> workAreaKeyPress; Signal2<void, KeySym, unsigned int> workAreaKeyPress;
/// ///
Signal3<void, int, int, unsigned int> workAreaButtonPress; Signal3<void, int, int, unsigned int> workAreaButtonPress;
@ -138,8 +148,10 @@ private:
FL_OBJECT * work_area; FL_OBJECT * work_area;
/// ///
FL_OBJECT * scrollbar; FL_OBJECT * scrollbar;
#if 0
/// ///
BufferView * owner_; BufferView * owner_;
#endif
/// The pixmap overlay on the workarea /// The pixmap overlay on the workarea
Pixmap workareapixmap; Pixmap workareapixmap;
/// ///

View File

@ -5,13 +5,14 @@
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include <fstream> // ofstream
#include <vector>
#ifdef __GNUG_ #ifdef __GNUG_
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "xform_helpers.h" #include "xform_helpers.h"
#include <fstream> // ofstream
#include "lyxlex.h" #include "lyxlex.h"
#include "filedlg.h" // LyXFileDlg #include "filedlg.h" // LyXFileDlg
#include "support/FileInfo.h" #include "support/FileInfo.h"

View File

@ -6,7 +6,7 @@
#endif #endif
#include <utility> // pair #include <utility> // pair
#include <config.h> //#include <config.h>
#include "LString.h" #include "LString.h"
#include "Color.h" #include "Color.h"

View File

@ -3,7 +3,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright 1998 The LyX Team. * Copyright 1998-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */
@ -90,7 +90,7 @@ InsetFloat::InsetFloat(string const & type)
font.setColor(LColor::footnote); font.setColor(LColor::footnote);
setLabelFont(font); setLabelFont(font);
setAutoCollapse(false); setAutoCollapse(false);
floatType = type; floatType_ = type;
setInsetName(type); setInsetName(type);
//floatPlacement = "H"; //floatPlacement = "H";
} }
@ -99,13 +99,13 @@ InsetFloat::InsetFloat(string const & type)
void InsetFloat::Write(Buffer const * buf, ostream & os) const void InsetFloat::Write(Buffer const * buf, ostream & os) const
{ {
os << "Float " // getInsetName() os << "Float " // getInsetName()
<< floatType << '\n'; << floatType_ << '\n';
if (floatPlacement.empty()) { if (floatPlacement_.empty()) {
os << "placement " os << "placement "
<< floatList.getType(floatType).placement << "\n"; << floatList.getType(floatType_).placement() << "\n";
} else { } else {
os << "placement " << floatPlacement << "\n"; os << "placement " << floatPlacement_ << "\n";
} }
InsetCollapsable::Write(buf, os); InsetCollapsable::Write(buf, os);
@ -119,7 +119,7 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
string token = lex.GetString(); string token = lex.GetString();
if (token == "placement") { if (token == "placement") {
lex.next(); lex.next();
floatPlacement = lex.GetString(); floatPlacement_ = lex.GetString();
} else { } else {
lyxerr << "InsetFloat::Read: Missing placement!" lyxerr << "InsetFloat::Read: Missing placement!"
<< endl; << endl;
@ -131,13 +131,13 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
void InsetFloat::Validate(LaTeXFeatures & features) const void InsetFloat::Validate(LaTeXFeatures & features) const
{ {
features.usedFloats.insert(floatType); features.usedFloats.insert(floatType_);
} }
Inset * InsetFloat::Clone(Buffer const &) const Inset * InsetFloat::Clone(Buffer const &) const
{ {
InsetFloat * result = new InsetFloat(floatType); InsetFloat * result = new InsetFloat(floatType_);
result->inset->init(inset); result->inset->init(inset);
result->collapsed = collapsed; result->collapsed = collapsed;
@ -154,14 +154,14 @@ string const InsetFloat::EditMessage() const
int InsetFloat::Latex(Buffer const * buf, int InsetFloat::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const ostream & os, bool fragile, bool fp) const
{ {
os << "\\begin{" << floatType << "}"; os << "\\begin{" << floatType_ << "}";
if (!floatPlacement.empty() if (!floatPlacement_.empty()
&& floatPlacement != floatList.defaultPlacement(floatType)) && floatPlacement_ != floatList.defaultPlacement(floatType_))
os << "[" << floatPlacement << "]"; os << "[" << floatPlacement_ << "]";
os << "%\n"; os << "%\n";
int i = inset->Latex(buf, os, fragile, fp); int const i = inset->Latex(buf, os, fragile, fp);
os << "\\end{" << floatType << "}%\n"; os << "\\end{" << floatType_ << "}%\n";
return i + 2; return i + 2;
} }
@ -195,7 +195,7 @@ void InsetFloat::InsetButtonRelease(BufferView * bv, int x, int y, int button)
string const & InsetFloat::type() const string const & InsetFloat::type() const
{ {
return floatType; return floatType_;
} }
@ -204,12 +204,12 @@ void InsetFloat::wide(bool w)
wide_ = w; wide_ = w;
if (wide_) { if (wide_) {
string lab(_("float:")); string lab(_("float:"));
lab += floatType; lab += floatType_;
lab += "*"; lab += "*";
setLabel(lab); setLabel(lab);
} else { } else {
string lab(_("float:")); string lab(_("float:"));
lab += floatType; lab += floatType_;
setLabel(lab); setLabel(lab);
} }
} }

View File

@ -53,9 +53,9 @@ public:
bool wide() const; bool wide() const;
private: private:
/// ///
string floatType; string floatType_;
/// ///
string floatPlacement; string floatPlacement_;
/// ///
bool wide_; bool wide_;
}; };

View File

@ -799,7 +799,11 @@ InsetText::LocalDispatch(BufferView * bv,
} }
TEXT(bv)->ClearSelection(); TEXT(bv)->ClearSelection();
for (string::size_type i = 0; i < arg.length(); ++i) { for (string::size_type i = 0; i < arg.length(); ++i) {
#if 0
bv->owner()->getIntl()->getTrans()->TranslateAndInsert(arg[i], TEXT(bv)); bv->owner()->getIntl()->getTrans()->TranslateAndInsert(arg[i], TEXT(bv));
#else
bv->owner()->getIntl()->getTrans().TranslateAndInsert(arg[i], TEXT(bv));
#endif
} }
} }
UpdateLocal(bv, CURSOR_PAR, true); UpdateLocal(bv, CURSOR_PAR, true);

View File

@ -26,7 +26,11 @@
#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "debug.h" #include "debug.h"
#include "lyxrc.h" #include "lyxrc.h"
#if 0
#include "trans_mgr.h" #include "trans_mgr.h"
#endif
#include "support/lstrings.h" #include "support/lstrings.h"
#include "language.h" #include "language.h"
#include "frontends/Dialogs.h" // redrawGUI #include "frontends/Dialogs.h" // redrawGUI
@ -43,8 +47,10 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code);
Intl::Intl() Intl::Intl()
: prim_lang(lyxrc.primary_kbmap), : prim_lang(lyxrc.primary_kbmap),
sec_lang(lyxrc.secondary_kbmap), sec_lang(lyxrc.secondary_kbmap)
trans(new TransManager) #if 0
, trans(new TransManager)
#endif
{ {
keymapon = lyxrc.use_kbmap; keymapon = lyxrc.use_kbmap;
chsetcode = 0; chsetcode = 0;
@ -54,10 +60,13 @@ Intl::Intl()
r_ = Dialogs::redrawGUI.connect(slot(this, &Intl::redraw)); r_ = Dialogs::redrawGUI.connect(slot(this, &Intl::redraw));
} }
Intl::~Intl() Intl::~Intl()
{ {
r_.disconnect(); r_.disconnect();
#if 0
delete trans; delete trans;
#endif
} }
@ -72,7 +81,11 @@ int Intl::SetPrimary(string const & lang)
{ {
if (lyxerr.debugging(Debug::KBMAP)) if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "Primary: `" << lang << "'" << endl; lyxerr << "Primary: `" << lang << "'" << endl;
#if 0
return trans->SetPrimary(lang); return trans->SetPrimary(lang);
#else
return trans.SetPrimary(lang);
#endif
} }
@ -80,7 +93,11 @@ int Intl::SetSecondary(string const & lang)
{ {
if (lyxerr.debugging(Debug::KBMAP)) if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "Secondary: `" << lang << "'" << endl; lyxerr << "Secondary: `" << lang << "'" << endl;
#if 0
return trans->SetSecondary(lang); return trans->SetSecondary(lang);
#else
return trans.SetSecondary(lang);
#endif
} }
@ -107,7 +124,7 @@ void Intl::update()
void Intl::KeyMapOn(bool on) void Intl::KeyMapOn(bool on)
/* turn on/off key mappings, status in keymapon */ // turn on/off key mappings, status in keymapon
{ {
keymapon = on; keymapon = on;
@ -126,7 +143,11 @@ void Intl::KeyMapOn(bool on)
} else { } else {
fl_set_button(fd_form_keymap->KeyOffBtn, 1); fl_set_button(fd_form_keymap->KeyOffBtn, 1);
fl_hide_object(fd_form_keymap->KeymapErr); fl_hide_object(fd_form_keymap->KeymapErr);
#if 0
trans->DisableKeymap(); trans->DisableKeymap();
#else
trans.DisableKeymap();
#endif
} }
} }
@ -159,13 +180,21 @@ void Intl::KeyMapPrim()
curkeymap = i; curkeymap = i;
#if 0
if (p.empty() || trans->SetPrimary(p)) { if (p.empty() || trans->SetPrimary(p)) {
#else
if (p.empty() || trans.SetPrimary(p)) {
#endif
// error selecting keymap // error selecting keymap
fl_show_object(fd_form_keymap->KeymapErr); fl_show_object(fd_form_keymap->KeymapErr);
update(); update();
} else { } else {
// no error // no error
#if 0
trans->EnablePrimary(); trans->EnablePrimary();
#else
trans.EnablePrimary();
#endif
keymapon = true; keymapon = true;
primarykeymap = true; primarykeymap = true;
fl_hide_object(fd_form_keymap->KeymapErr); fl_hide_object(fd_form_keymap->KeymapErr);
@ -179,7 +208,7 @@ void Intl::KeyMapSec()
fl_set_button(fd_form_keymap->KeyOnBtn, 0); fl_set_button(fd_form_keymap->KeyOnBtn, 0);
fl_set_button(fd_form_keymap->KeyOnBtn2, 1); fl_set_button(fd_form_keymap->KeyOnBtn2, 1);
/* read text from choice */ // read text from choice
int const i = Language2->get(); int const i = Language2->get();
string p; string p;
@ -189,6 +218,7 @@ void Intl::KeyMapSec()
p = Language2->getline(); p = Language2->getline();
curkeymap = i; curkeymap = i;
#if 0
if (p.empty() || trans->SetSecondary(p)) { if (p.empty() || trans->SetSecondary(p)) {
// error selecting keymap // error selecting keymap
fl_show_object(fd_form_keymap->KeymapErr); fl_show_object(fd_form_keymap->KeymapErr);
@ -200,7 +230,21 @@ void Intl::KeyMapSec()
primarykeymap = false; primarykeymap = false;
fl_hide_object(fd_form_keymap->KeymapErr); fl_hide_object(fd_form_keymap->KeymapErr);
} }
#else
if (p.empty() || trans.SetSecondary(p)) {
// error selecting keymap
fl_show_object(fd_form_keymap->KeymapErr);
update();
} else {
// no error
trans.EnableSecondary();
keymapon = true;
primarykeymap = false;
fl_hide_object(fd_form_keymap->KeymapErr);
} }
#endif
}
void Intl::LCombo(int, void * v, Combox * combox) void Intl::LCombo(int, void * v, Combox * combox)
{ {
@ -212,6 +256,7 @@ void Intl::LCombo(int, void * v, Combox * combox)
return; return;
} }
void Intl::DispatchCallback(FL_OBJECT * ob, long code) void Intl::DispatchCallback(FL_OBJECT * ob, long code)
{ {
if (ob && (code == 0)) { if (ob && (code == 0)) {
@ -234,7 +279,7 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code)
void Intl::InitKeyMapper(bool on) void Intl::InitKeyMapper(bool on)
/* initialize key mapper */ // initialize key mapper
{ {
lyxerr[Debug::INIT] << "Initializing key mappings..." << endl; lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
@ -309,20 +354,30 @@ void Intl::InitKeyMapper(bool on)
fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str()); fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str());
} }
else else
#if 0
trans->SetPrimary(prim_lang); trans->SetPrimary(prim_lang);
#else
trans.SetPrimary(prim_lang);
#endif
if (!Language2->select_text(sec_lang)) { if (!Language2->select_text(sec_lang)) {
Language2->select(n + 1); Language2->select(n + 1);
fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str()); fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str());
} }
else else
#if 0
trans->SetSecondary(sec_lang); trans->SetSecondary(sec_lang);
#else
trans.SetSecondary(sec_lang);
#endif
KeyMapOn(keymapon); KeyMapOn(keymapon);
if (keymapon) if (keymapon)
Keymap(23); // turn primary on Keymap(23); // turn primary on
#if 0
trans->setCharset(lyxrc.font_norm); trans->setCharset(lyxrc.font_norm);
#else
trans.setCharset(lyxrc.font_norm);
#endif
} }
@ -336,7 +391,7 @@ void Intl::Keymap(long code)
// spagetti example using a switch... (Lgb) // spagetti example using a switch... (Lgb)
switch (code) { switch (code) {
case 0: case 0:
/* cancel/hide */ // cancel/hide
fl_hide_form(fd_form_keymap->KeyMap); fl_hide_form(fd_form_keymap->KeyMap);
break; break;
case 3: case 3:
@ -356,9 +411,13 @@ void Intl::Keymap(long code)
KeyMapSec(); KeyMapSec();
} }
break; break;
case 27: /* set new font norm */ case 27: // set new font norm
char const * p = fl_get_input(fd_form_keymap->Charset); char const * p = fl_get_input(fd_form_keymap->Charset);
#if 0
if (trans->setCharset(p)) if (trans->setCharset(p))
#else
if (trans.setCharset(p))
#endif
fl_show_object(fd_form_keymap->ChsetErr); fl_show_object(fd_form_keymap->ChsetErr);
else else
fl_hide_object(fd_form_keymap->ChsetErr); fl_hide_object(fd_form_keymap->ChsetErr);

View File

@ -12,13 +12,20 @@
#pragma interface #pragma interface
#endif #endif
#include <sigc++/signal_system.h>
#include "LString.h" #include "LString.h"
#include "form1.h" #include "form1.h"
#include <sigc++/signal_system.h>
#if 1
#include "trans_mgr.h"
#endif
class LyXText; class LyXText;
class Combox; class Combox;
#if 0
class TransManager; class TransManager;
#endif
#ifdef SIGC_CXX_NAMESPACES #ifdef SIGC_CXX_NAMESPACES
using SigC::Object; using SigC::Object;
@ -61,8 +68,13 @@ public:
/// initialize key mapper /// initialize key mapper
void InitKeyMapper(bool on); void InitKeyMapper(bool on);
#if 0
/// Get the Translation Manager /// Get the Translation Manager
TransManager * getTrans(); TransManager * getTrans();
#else
// Get the Translation Manager
TransManager & getTrans();
#endif
/// ///
bool keymapon; bool keymapon;
/// ///
@ -97,17 +109,30 @@ private:
string & prim_lang; string & prim_lang;
/// ///
string & sec_lang; string & sec_lang;
#if 0
/// ///
TransManager * trans; TransManager * trans;
#else
///
TransManager trans;
#endif
/// Redraw connection. /// Redraw connection.
Connection r_; Connection r_;
}; };
#if 0
inline inline
TransManager * Intl::getTrans() TransManager * Intl::getTrans()
{ {
return trans; return trans;
} }
#else
inline
TransManager & Intl::getTrans()
{
return trans;
}
#endif
#endif #endif

View File

@ -1954,7 +1954,11 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_BACKSPACE: case LFUN_BACKSPACE:
{ {
if (!owner->view()->text->selection) { if (!owner->view()->text->selection) {
#if 0
if (owner->getIntl()->getTrans()->backspace()) { if (owner->getIntl()->getTrans()->backspace()) {
#else
if (owner->getIntl()->getTrans().backspace()) {
#endif
owner->view()->text->Backspace(owner->view()); owner->view()->text->Backspace(owner->view());
owner->view()->text->sel_cursor = owner->view()->text->sel_cursor =
owner->view()->text->cursor; owner->view()->text->cursor;
@ -2418,9 +2422,15 @@ string const LyXFunc::Dispatch(int ac,
if (keyseq.length == -1 && keyseq.getiso() != 0) if (keyseq.length == -1 && keyseq.getiso() != 0)
c = keyseq.getiso(); c = keyseq.getiso();
#if 0
owner->getIntl()->getTrans()-> owner->getIntl()->getTrans()->
deadkey(c, get_accent(action).accent, deadkey(c, get_accent(action).accent,
owner->view()->text); owner->view()->text);
#else
owner->getIntl()->getTrans()
.deadkey(c, get_accent(action).accent,
owner->view()->text);
#endif
// Need to reset, in case the minibuffer calls these // Need to reset, in case the minibuffer calls these
// actions // actions
@ -2942,9 +2952,17 @@ string const LyXFunc::Dispatch(int ac,
i < argument.length(); ++i) { i < argument.length(); ++i) {
if (greek_kb_flag) { if (greek_kb_flag) {
if (!math_insert_greek(argument[i])) if (!math_insert_greek(argument[i]))
#if 0
owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text); owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text);
#else
owner->getIntl()->getTrans().TranslateAndInsert(argument[i], owner->view()->text);
#endif
} else } else
#if 0
owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text); owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text);
#else
owner->getIntl()->getTrans().TranslateAndInsert(argument[i], owner->view()->text);
#endif
} }
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);

View File

@ -26,9 +26,9 @@
#pragma interface #pragma interface
#endif #endif
#include "LString.h"
#include "math_defs.h" #include "math_defs.h"
#include "symbol_def.h" #include "symbol_def.h"
#include "LString.h"
/** /**
Functions or LaTeX names for objects that I don't know how to draw. Functions or LaTeX names for objects that I don't know how to draw.

View File

@ -840,8 +840,7 @@ LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams,
"position does not exist. " "position does not exist. "
<< pos << " (" << static_cast<int>(pos) << pos << " (" << static_cast<int>(pos)
<< ")" << endl; << ")" << endl;
} } else if (pos > 0) {
else if (pos > 0) {
return GetFontSettings(bparams, pos - 1); return GetFontSettings(bparams, pos - 1);
} }
#else #else
@ -855,6 +854,7 @@ LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams,
//return LyXFont(LyXFont::ALL_INHERIT); //return LyXFont(LyXFont::ALL_INHERIT);
} }
// Gets uninstantiated font setting at position 0 // Gets uninstantiated font setting at position 0
LyXFont const LyXParagraph::GetFirstFontSettings() const LyXFont const LyXParagraph::GetFirstFontSettings() const
{ {

View File

@ -116,8 +116,13 @@ void LyXScreen::DrawFromTo(LyXText * text,
LyXText::text_status st = text->status; LyXText::text_status st = text->status;
do { do {
text->status = st; text->status = st;
#if 0
text->GetVisibleRow(owner.owner(), y + y_offset, text->GetVisibleRow(owner.owner(), y + y_offset,
x_offset, row, y + text->first); x_offset, row, y + text->first);
#else
text->GetVisibleRow(text->bv_owner, y + y_offset,
x_offset, row, y + text->first);
#endif
} while (text->status == LyXText::CHANGED_IN_DRAW); } while (text->status == LyXText::CHANGED_IN_DRAW);
text->status = st; text->status = st;
y += row->height(); y += row->height();
@ -146,8 +151,13 @@ void LyXScreen::DrawOneRow(LyXText * text, Row * row, int y_text,
LyXText::text_status st = text->status; LyXText::text_status st = text->status;
do { do {
text->status = st; text->status = st;
#if 0
text->GetVisibleRow(owner.owner(), y, x_offset, row, text->GetVisibleRow(owner.owner(), y, x_offset, row,
y + text->first); y + text->first);
#else
text->GetVisibleRow(text->bv_owner, y, x_offset, row,
y + text->first);
#endif
} while (text->status == LyXText::CHANGED_IN_DRAW); } while (text->status == LyXText::CHANGED_IN_DRAW);
text->status = st; text->status = st;
} }
@ -214,10 +224,17 @@ void LyXScreen::ShowCursor(LyXText const * text)
{ {
if (!cursor_visible) { if (!cursor_visible) {
Cursor_Shape shape = BAR_SHAPE; Cursor_Shape shape = BAR_SHAPE;
#if 0
if (text->real_current_font.language() != if (text->real_current_font.language() !=
owner.owner()->buffer()->params.language owner.owner()->buffer()->params.language
|| text->real_current_font.isVisibleRightToLeft() || text->real_current_font.isVisibleRightToLeft()
!= owner.owner()->buffer()->params.language->RightToLeft()) != owner.owner()->buffer()->params.language->RightToLeft())
#else
if (text->real_current_font.language() !=
text->bv_owner->buffer()->params.language
|| text->real_current_font.isVisibleRightToLeft()
!= text->bv_owner->buffer()->params.language->RightToLeft())
#endif
shape = (text->real_current_font.isVisibleRightToLeft()) shape = (text->real_current_font.isVisibleRightToLeft())
? REVERSED_L_SHAPE : L_SHAPE; ? REVERSED_L_SHAPE : L_SHAPE;
ShowManualCursor(text, text->cursor.x(), text->cursor.y(), ShowManualCursor(text, text->cursor.x(), text->cursor.y(),

View File

@ -15,8 +15,9 @@
#pragma implementation #pragma implementation
#endif #endif
#include <sys/types.h> //#include <sys/types.h>
#include <sys/stat.h> //#include <sys/stat.h>
#include <cerrno> #include <cerrno>
#include "FileInfo.h" #include "FileInfo.h"

View File

@ -18,9 +18,9 @@
#include <ctime> #include <ctime>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include "LString.h" #include "LString.h"

View File

@ -2037,7 +2037,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
Floating const & fl Floating const & fl
= floatList.getType(tmp->type()); = floatList.getType(tmp->type());
// We should get the correct number here too. // We should get the correct number here too.
s = fl.name + " #:"; s = fl.name() + " #:";
} else { } else {
/* par->SetLayout(0); /* par->SetLayout(0);
s = layout->labelstring; */ s = layout->labelstring; */

View File

@ -363,7 +363,7 @@ string const Trans::process(char c, TransManager & k)
int Trans::Load(string const & language) int Trans::Load(string const & language)
{ {
string filename = LibFileSearch("kbd", language, "kmap"); string const filename = LibFileSearch("kbd", language, "kmap");
if (filename.empty()) if (filename.empty())
return -1; return -1;
@ -371,7 +371,7 @@ int Trans::Load(string const & language)
LyXLex lex(kmapTags, K_LAST-1); LyXLex lex(kmapTags, K_LAST-1);
lex.setFile(filename); lex.setFile(filename);
int res = Load(lex); int const res = Load(lex);
if (res == 0) { if (res == 0) {
name_ = language; name_ = language;