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>
* 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.*) CXXFLAGS="-g $lyx_opt -fno-rtti -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";;
*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
esac

View File

@ -53,35 +53,35 @@ src/frontends/kde/refdlg.C
src/frontends/kde/tocdlg.C
src/frontends/kde/urldlg.C
src/frontends/xforms/FormBase.h
src/frontends/xforms/FormCitation.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/FormDocument.C
src/frontends/xforms/FormCopyright.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/FormGraphics.C
src/frontends/xforms/FormError.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/FormIndex.C
src/frontends/xforms/FormInset.h
src/frontends/xforms/FormParagraph.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/FormPrint.C
src/frontends/xforms/FormPreferences.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/FormTabular.C
src/frontends/xforms/FormRef.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/FormToc.C
src/frontends/xforms/FormTabularCreate.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/FormUrl.C
src/frontends/xforms/input_validators.C
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/xform_helpers.C

View File

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

View File

@ -232,6 +232,7 @@ public:
///
void pushIntoUpdateList(Inset * i);
#if 0
///
void workAreaExpose();
///
@ -248,6 +249,7 @@ public:
void enterView();
///
void leaveView();
#endif
///
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;
string fname = MakeAbsPath(filen);
string const fname = MakeAbsPath(filen);
// check if file exist
FileInfo fi(fname);
FileInfo const fi(fname);
if (!fi.readable()) {
WriteAlert(_("Error!"),
@ -75,7 +75,7 @@ bool BufferView::insertLyXFile(string const & filen)
return false;
}
char c = ifs.peek();
char const c = ifs.peek();
LyXLex lex(0, 0);
lex.setStream(ifs);
@ -94,6 +94,7 @@ bool BufferView::insertLyXFile(string const & filen)
return res;
}
bool BufferView::removeAutoInsets()
{
LyXParagraph * par = buffer()->paragraph;
@ -145,10 +146,10 @@ void BufferView::insertErrors(TeXErrors & terr)
for (TeXErrors::Errors::const_iterator cit = terr.begin();
cit != terr.end();
++cit) {
string desctext((*cit).error_desc);
string errortext((*cit).error_text);
string msgtxt = desctext + '\n' + errortext;
int errorrow = (*cit).error_in_line;
string const desctext((*cit).error_desc);
string const errortext((*cit).error_text);
string const msgtxt = desctext + '\n' + errortext;
int const errorrow = (*cit).error_in_line;
// Insert error string for row number
int tmpid = -1;
@ -269,8 +270,6 @@ bool BufferView::open_new_inset(UpdatableInset * new_inset)
delete new_inset;
return false;
}
// text->CursorLeft(this);
// update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
new_inset->Edit(this, 0, 0, 0);
return true;
}
@ -769,7 +768,7 @@ void BufferView::hideLockedInsetCursor()
void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
{
if (theLockingInset() && available()){
if (theLockingInset() && available()) {
y += text->cursor.y() + theLockingInset()->InsetInInsetY();
if (pimpl_->screen_->FitManualCursor(text, x, y, asc, desc))
updateScrollbar();
@ -821,9 +820,9 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
// first check for locking insets
if (theLockingInset()) {
if (theLockingInset() == inset) {
if (text->UpdateInset(this, inset)){
if (text->UpdateInset(this, inset)) {
update();
if (mark_dirty){
if (mark_dirty) {
if (buffer()->isLyxClean())
owner()->getMiniBuffer()->
setTimer(4);
@ -851,7 +850,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
if (available()) {
hideCursor();
update(BufferView::UPDATE);
if (text->UpdateInset(this, inset)){
if (text->UpdateInset(this, inset)) {
if (mark_dirty)
update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
else
@ -861,6 +860,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
}
}
bool BufferView::ChangeRefs(string const & from, string const & to)
{
bool flag = false;
@ -919,6 +919,7 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
return ChangeRefs(from, to);
}
UpdatableInset * BufferView::theLockingInset() const
{
// 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)
{
buffer_ = 0;
#if 0
workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
#else
workarea_ = new WorkArea(xpos, ypos, width, height);
#endif
// Setup the signals
workarea_->scrollCB.connect(slot(this, &BufferView::Pimpl::scrollCB));
workarea_->workAreaExpose
.connect(slot(this, &BufferView::Pimpl::workAreaExpose));
workarea_->workAreaEnter
@ -472,7 +477,7 @@ int BufferView::Pimpl::scrollUp(long time)
workarea_->setScrollbarValue(value);
bv_->scrollCB(value);
scrollCB(value);
return 0;
}
@ -502,7 +507,7 @@ int BufferView::Pimpl::scrollDown(long time)
workarea_->setScrollbarValue(value);
bv_->scrollCB(value);
scrollCB(value);
return 0;
}
@ -1352,7 +1357,7 @@ void BufferView::Pimpl::pasteClipboard(bool asPara)
screen_->HideCursor();
bv_->beforeChange();
string clip(workarea_->getClipboard());
string const clip(workarea_->getClipboard());
if (clip.empty()) return;

View File

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

View File

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

View File

@ -25,18 +25,78 @@
class Floating {
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

View File

@ -23,6 +23,8 @@
#include "bufferparams.h"
#include "layout.h"
#include "support/filetools.h"
#include "FloatList.h"
using std::endl;
LaTeXFeatures::LaTeXFeatures(BufferParams const & p, LyXTextClass::size_type n)
@ -252,11 +254,22 @@ string const LaTeXFeatures::getPackages()
packages += "\\usepackage{prettyref}\n";
// float.sty
// This is not correct and needs fixing.
// We don't need float.sty if we only use unchanged
// table and figure floats. (Lgb)
if (!usedFloats.empty())
packages += "\\usepackage{float}\n";
// We only need float.sty if we use non builtin floats. This includes
// modified table and figure floats. (Lgb)
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 += externalPreambles;
@ -317,6 +330,22 @@ string const LaTeXFeatures::getMacros()
// \floatstyle{ruled}
// \newfloat{algorithm}{htbp}{loa}
// \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;
}

View File

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

View File

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

View File

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

View File

@ -5,13 +5,14 @@
#include FORMS_H_LOCATION
#include <fstream> // ofstream
#include <vector>
#ifdef __GNUG_
#pragma implementation
#endif
#include <vector>
#include "xform_helpers.h"
#include <fstream> // ofstream
#include "lyxlex.h"
#include "filedlg.h" // LyXFileDlg
#include "support/FileInfo.h"
@ -24,10 +25,10 @@ using std::pair;
using std::vector;
// Take a string and add breaks so that it fits into a desired label width, w
string formatted( string const & sin, int w, int size, int style )
string formatted(string const & sin, int w, int size, int style)
{
string sout;
if (sin.empty() ) return sout;
if (sin.empty()) return sout;
// break sin up into a vector of individual words
vector<string> sentence;
@ -69,27 +70,27 @@ string formatted( string const & sin, int w, int size, int style )
}
string const browseFile( string const & filename,
string const & title,
string const & pattern,
pair<string,string> const & dir1,
pair<string,string> const & dir2 )
string const browseFile(string const & filename,
string const & title,
string const & pattern,
pair<string,string> const & dir1,
pair<string,string> const & dir2)
{
string lastPath = ".";
if( !filename.empty() ) lastPath = OnlyPath(filename);
if (!filename.empty()) lastPath = OnlyPath(filename);
LyXFileDlg fileDlg;
if( !dir1.second.empty() ) {
FileInfo fileInfo( dir1.second );
if( fileInfo.isOK() && fileInfo.isDir() )
fileDlg.SetButton( 0, _(dir1.first), dir1.second );
if (!dir1.second.empty()) {
FileInfo fileInfo(dir1.second);
if (fileInfo.isOK() && fileInfo.isDir())
fileDlg.SetButton(0, _(dir1.first), dir1.second);
}
if( !dir2.second.empty() ) {
FileInfo fileInfo( dir2.second );
if( fileInfo.isOK() && fileInfo.isDir() )
fileDlg.SetButton( 1, _(dir2.first), dir2.second );
if (!dir2.second.empty()) {
FileInfo fileInfo(dir2.second);
if (fileInfo.isOK() && fileInfo.isDir())
fileDlg.SetButton(1, _(dir2.first), dir2.second);
}
bool error = false;
@ -97,7 +98,7 @@ string const browseFile( string const & filename,
do {
string p = fileDlg.Select(_(title),
lastPath,
pattern, OnlyFilename(filename) );
pattern, OnlyFilename(filename));
if (p.empty()) return p;

View File

@ -6,12 +6,12 @@
#endif
#include <utility> // pair
#include <config.h>
//#include <config.h>
#include "LString.h"
#include "Color.h"
// Take a string and add breaks so that it fits into a desired label width, w
string formatted( string const &label, int w, int size, int style );
string formatted(string const &label, int w, int size, int style);
/** Launch a file dialog and return the chosen file.
filename: a suggested filename.
@ -19,11 +19,11 @@ string formatted( string const &label, int w, int size, int style );
pattern: *.ps etc.
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
*/
string const browseFile( string const & filename,
string const & title,
string const & pattern,
std::pair<string,string> const & dir1,
std::pair<string,string> const & dir2 );
string const browseFile(string const & filename,
string const & title,
string const & pattern,
std::pair<string,string> const & dir1,
std::pair<string,string> const & dir2);
/// struct holding xform-specific colors
struct XformColor : public NamedColor {

View File

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

View File

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

View File

@ -799,7 +799,11 @@ InsetText::LocalDispatch(BufferView * bv,
}
TEXT(bv)->ClearSelection();
for (string::size_type i = 0; i < arg.length(); ++i) {
#if 0
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);

View File

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

View File

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

View File

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

View File

@ -26,9 +26,9 @@
#pragma interface
#endif
#include "LString.h"
#include "math_defs.h"
#include "symbol_def.h"
#include "LString.h"
/**
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. "
<< pos << " (" << static_cast<int>(pos)
<< ")" << endl;
}
else if (pos > 0) {
} else if (pos > 0) {
return GetFontSettings(bparams, pos - 1);
}
#else
@ -855,6 +854,7 @@ LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams,
//return LyXFont(LyXFont::ALL_INHERIT);
}
// Gets uninstantiated font setting at position 0
LyXFont const LyXParagraph::GetFirstFontSettings() const
{

View File

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

View File

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

View File

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

View File

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

View File

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