mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
use the new sstream return non-pods as const, use string instead of char * in a lot of places
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c00fe60338
commit
45a03f4f67
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
||||
2000-09-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/buffer.C (writeFile): try to fix the locale modified format
|
||||
number to always be as we want it.
|
||||
|
||||
* src/WorkArea.C (work_area_handler): try to workaround the bugs
|
||||
in XForms 0.89. C-space is now working again.
|
||||
|
||||
* src/Lsstream.h src/support/sstream.h: new files.
|
||||
|
||||
* also commented out all cases where strstream were used.
|
||||
|
||||
* src/Bullet.h (c_str): remove method.
|
||||
|
||||
* remove all stuff that is irrelevant when NEW_MENUBAR is defined
|
||||
|
||||
* a lot of files: get rid of "char const *" and "char *" is as
|
||||
many places as possible. We only want to use them in interaction
|
||||
with system of other libraries, not inside lyx.
|
||||
|
||||
* a lot of files: return const object is not of pod type. This
|
||||
helps ensure that temporary objects is not modified. And fits well
|
||||
with "programming by contract".
|
||||
|
||||
* configure.in: check for the locale header too
|
||||
|
||||
* Makefile.am (sourcedoc): new tag for generation of doc++
|
||||
documentation
|
||||
|
||||
2000-09-14 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/frontends/xforms/FormDocument.C (ComboInputCB): fixed the
|
||||
|
@ -49,3 +49,8 @@ bindist:
|
||||
@echo "*** distribution and refer to *you* in case of problem."
|
||||
@echo "*** $(bindistfile) has been created."
|
||||
|
||||
|
||||
sourcedoc:
|
||||
mkdir sourcedoc
|
||||
cd sourcedoc
|
||||
doc++ -p $(srcdir)/src/*.h
|
||||
|
@ -94,7 +94,7 @@ LYX_CXX_CHEADERS
|
||||
LYX_STD_COUNT
|
||||
dnl we disable rtti for now
|
||||
dnl LYX_CXX_RTTI
|
||||
AC_CHECK_HEADERS(ostream istream sstream)
|
||||
AC_CHECK_HEADERS(ostream istream sstream locale)
|
||||
LYX_CXX_STL_MODERN_STREAMS
|
||||
|
||||
### We need a regex implementation, so we provide our own if none is found.
|
||||
|
@ -119,7 +119,6 @@ src/mathed/formulamacro.C
|
||||
src/mathed/math_forms.C
|
||||
src/mathed/math_panel.C
|
||||
src/MenuBackend.C
|
||||
src/menus.C
|
||||
src/minibuffer.C
|
||||
src/PaperLayout.C
|
||||
src/paragraph.C
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
stakk.push(bit);
|
||||
}
|
||||
///
|
||||
string pop(int * x, int * y) {
|
||||
string const pop(int * x, int * y) {
|
||||
BackStackItem bit = stakk.top();
|
||||
*x = bit.x;
|
||||
*y = bit.y;
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
///
|
||||
void selectLastWord();
|
||||
///
|
||||
char * nextWord(float & value);
|
||||
string const nextWord(float & value);
|
||||
///
|
||||
void insertCorrectQuote();
|
||||
///
|
||||
|
@ -678,16 +678,14 @@ void BufferView::insertCorrectQuote()
|
||||
|
||||
|
||||
/* these functions are for the spellchecker */
|
||||
char * BufferView::nextWord(float & value)
|
||||
string const BufferView::nextWord(float & value)
|
||||
{
|
||||
if (!available()) {
|
||||
value = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char * string = text->SelectNextWord(this, value);
|
||||
|
||||
return string;
|
||||
return text->SelectNextWord(this, value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,9 +26,6 @@
|
||||
#include "intl.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#ifndef NEW_MENUBAR
|
||||
# include "menus.h"
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
@ -162,22 +159,14 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
||||
updateScrollbar();
|
||||
}
|
||||
bv_->text->first = screen_->TopCursorVisible(bv_->text);
|
||||
#ifdef NEW_MENUBAR
|
||||
owner_->updateMenubar();
|
||||
#else
|
||||
owner_->getMenus()->showMenus();
|
||||
#endif
|
||||
owner_->updateToolbar();
|
||||
redraw();
|
||||
owner_->getDialogs()->updateBufferDependent();
|
||||
bv_->insetWakeup();
|
||||
} else {
|
||||
lyxerr[Debug::INFO] << " No Buffer!" << endl;
|
||||
#ifdef NEW_MENUBAR
|
||||
owner_->updateMenubar();
|
||||
#else
|
||||
owner_->getMenus()->hideMenus();
|
||||
#endif
|
||||
owner_->updateToolbar();
|
||||
updateScrollbar();
|
||||
workarea_->redraw();
|
||||
|
@ -137,7 +137,9 @@ struct BufferView::Pimpl : public Object {
|
||||
///
|
||||
BackStack backstack;
|
||||
///
|
||||
int last_click_x, last_click_y;
|
||||
int last_click_x;
|
||||
///
|
||||
int last_click_y;
|
||||
///
|
||||
WorkArea * workarea_;
|
||||
///
|
||||
|
@ -62,7 +62,7 @@ string const & Bullet::getText() const
|
||||
}
|
||||
|
||||
|
||||
bool operator == (const Bullet & b1, const Bullet & b2)
|
||||
bool operator==(const Bullet & b1, const Bullet & b2)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
@ -109,7 +109,7 @@ void Bullet::generateText() const
|
||||
}
|
||||
|
||||
|
||||
string Bullet::bulletSize(short int s)
|
||||
string const Bullet::bulletSize(short int s)
|
||||
{
|
||||
// use a parameter rather than hard code `size' in here
|
||||
// in case some future function may want to retrieve
|
||||
@ -125,7 +125,7 @@ string Bullet::bulletSize(short int s)
|
||||
}
|
||||
|
||||
|
||||
string Bullet::bulletEntry(short int f, short int c)
|
||||
string const Bullet::bulletEntry(short int f, short int c)
|
||||
{
|
||||
// Despite how this may at first appear the static local variables
|
||||
// are only initialized once..
|
||||
|
20
src/Bullet.h
20
src/Bullet.h
@ -49,15 +49,9 @@ public:
|
||||
///
|
||||
string const & getText() const;
|
||||
///
|
||||
char const * c_str() const;
|
||||
///
|
||||
Bullet & operator = (Bullet const &);
|
||||
Bullet & operator=(Bullet const &);
|
||||
///
|
||||
friend bool operator==(Bullet const &, Bullet const &);
|
||||
///
|
||||
friend bool operator!=(Bullet const & b1, Bullet const & b2) {
|
||||
return !(b1 == b2);
|
||||
}
|
||||
protected:
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
///
|
||||
@ -107,9 +101,9 @@ private:
|
||||
///
|
||||
void generateText() const;
|
||||
///
|
||||
static string bulletSize(short int);
|
||||
static string const bulletSize(short int);
|
||||
///
|
||||
static string bulletEntry(short int, short int);
|
||||
static string const bulletEntry(short int, short int);
|
||||
|
||||
///
|
||||
short font;
|
||||
@ -245,16 +239,14 @@ Bullet & Bullet::operator=(Bullet const & b)
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*-----------------End Bullet Member Functions-----------------*/
|
||||
|
||||
inline
|
||||
char const * Bullet::c_str() const
|
||||
bool operator!=(Bullet const & b1, Bullet const & b2)
|
||||
{
|
||||
return getText().c_str();
|
||||
return !(b1 == b2);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------End Bullet Member Functions-----------------*/
|
||||
|
||||
///
|
||||
extern
|
||||
Bullet const ITEMIZE_DEFAULTS[];
|
||||
|
@ -47,7 +47,7 @@ void FloatList::newFloat(Floating const & fl)
|
||||
}
|
||||
|
||||
|
||||
string FloatList::defaultPlacement(string const & t) const
|
||||
string const FloatList::defaultPlacement(string const & t) const
|
||||
{
|
||||
List::const_iterator cit = list.find(t);
|
||||
if (cit != list.end())
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
///
|
||||
void newFloat(Floating const & fl);
|
||||
///
|
||||
string defaultPlacement(string const & t) const;
|
||||
string const defaultPlacement(string const & t) const;
|
||||
///
|
||||
bool typeExist(string const & t) const;
|
||||
///
|
||||
|
@ -27,7 +27,7 @@
|
||||
using std::endl;
|
||||
|
||||
/// Load font close to this size
|
||||
string FontInfo::getFontname(int size)
|
||||
string const FontInfo::getFontname(int size)
|
||||
{
|
||||
if (!exist())
|
||||
return string();
|
||||
@ -71,7 +71,7 @@ string FontInfo::getFontname(int size)
|
||||
|
||||
|
||||
/// Build newly sized font string
|
||||
string FontInfo::resize(string const & font, int size) const
|
||||
string const FontInfo::resize(string const & font, int size) const
|
||||
{
|
||||
string ret(font);
|
||||
// Find the position of the size spec
|
||||
|
@ -51,14 +51,14 @@ public:
|
||||
}
|
||||
|
||||
/// Get existing pattern
|
||||
string getPattern() const { return pattern; }
|
||||
string const getPattern() const { return pattern; }
|
||||
|
||||
/// Set new pattern
|
||||
void setPattern(string const & pat);
|
||||
|
||||
/** Return full name of font close to this size.
|
||||
If impossible, result is the empty string */
|
||||
string getFontname(int size);
|
||||
string const getFontname(int size);
|
||||
private:
|
||||
/// Font pattern (with wildcard for size)
|
||||
string pattern;
|
||||
@ -91,6 +91,6 @@ private:
|
||||
void query();
|
||||
|
||||
/// Build newly sized font string
|
||||
string resize(string const &, int size) const;
|
||||
string const resize(string const &, int size) const;
|
||||
};
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ Buffer * ImportNoweb::run()
|
||||
|
||||
|
||||
// Provide the literate documentclass by parsing the file.
|
||||
string ImportNoweb::documentclass()
|
||||
string const ImportNoweb::documentclass()
|
||||
{
|
||||
string result = "literate-article"; // Default
|
||||
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
///
|
||||
string file;
|
||||
///
|
||||
string documentclass();
|
||||
string const documentclass();
|
||||
///
|
||||
enum {
|
||||
///
|
||||
|
10
src/LColor.C
10
src/LColor.C
@ -119,7 +119,7 @@ LColor::LColor()
|
||||
}
|
||||
|
||||
|
||||
string LColor::getGUIName(LColor::color c) const
|
||||
string const LColor::getGUIName(LColor::color c) const
|
||||
{
|
||||
InfoTab::const_iterator ici = infotab.find(c);
|
||||
if (ici != infotab.end())
|
||||
@ -129,7 +129,7 @@ string LColor::getGUIName(LColor::color c) const
|
||||
}
|
||||
|
||||
|
||||
string LColor::getX11Name(LColor::color c) const
|
||||
string const LColor::getX11Name(LColor::color c) const
|
||||
{
|
||||
InfoTab::const_iterator ici = infotab.find(c);
|
||||
if (ici != infotab.end())
|
||||
@ -142,7 +142,7 @@ string LColor::getX11Name(LColor::color c) const
|
||||
}
|
||||
|
||||
|
||||
string LColor::getLaTeXName(LColor::color c) const
|
||||
string const LColor::getLaTeXName(LColor::color c) const
|
||||
{
|
||||
InfoTab::const_iterator ici = infotab.find(c);
|
||||
if (ici != infotab.end())
|
||||
@ -151,7 +151,7 @@ string LColor::getLaTeXName(LColor::color c) const
|
||||
}
|
||||
|
||||
|
||||
string LColor::getLyXName(LColor::color c) const
|
||||
string const LColor::getLyXName(LColor::color c) const
|
||||
{
|
||||
InfoTab::const_iterator ici = infotab.find(c);
|
||||
if (ici != infotab.end())
|
||||
@ -196,7 +196,7 @@ LColor::color LColor::getFromGUIName(string const & guiname) const
|
||||
if (!compare_no_case((*ici).second.guiname, guiname))
|
||||
return (*ici).first;
|
||||
}
|
||||
return LColor::ignore;
|
||||
return LColor::inherit;
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,16 +176,16 @@ public:
|
||||
///
|
||||
bool setColor(string const & lyxname, string const & x11name);
|
||||
/// Get GUI name of color
|
||||
string getGUIName(LColor::color c) const;
|
||||
string const getGUIName(LColor::color c) const;
|
||||
|
||||
/// Get X11 name of color
|
||||
string getX11Name(LColor::color c) const;
|
||||
string const getX11Name(LColor::color c) const;
|
||||
|
||||
/// Get LaTeX name of color
|
||||
string getLaTeXName(LColor::color c) const;
|
||||
string const getLaTeXName(LColor::color c) const;
|
||||
|
||||
/// Get LyX name of color
|
||||
string getLyXName(LColor::color c) const;
|
||||
string const getLyXName(LColor::color c) const;
|
||||
///
|
||||
LColor::color getFromGUIName(string const & guiname) const;
|
||||
///
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "DepTable.h"
|
||||
#include <vector>
|
||||
|
||||
#include "support/utility.hpp"
|
||||
|
||||
class MiniBuffer;
|
||||
|
||||
///
|
||||
@ -61,7 +63,7 @@ private:
|
||||
|
||||
|
||||
///
|
||||
class LaTeX {
|
||||
class LaTeX : public noncopyable {
|
||||
public:
|
||||
/** Return values from scanLogFile() and run() (to come)
|
||||
|
||||
@ -122,11 +124,6 @@ protected:
|
||||
/// The dependency file.
|
||||
string depfile;
|
||||
|
||||
/// unavail
|
||||
LaTeX(LaTeX const &);
|
||||
/// unavail
|
||||
LaTeX & operator= (LaTeX const &);
|
||||
|
||||
///
|
||||
void deplog(DepTable & head);
|
||||
|
||||
|
@ -32,7 +32,7 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
|
||||
array = false;
|
||||
color = false;
|
||||
graphics = false; // INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
graphicx = false;
|
||||
graphicx = false;
|
||||
setspace = false;
|
||||
makeidx = false;
|
||||
verbatim = false;
|
||||
@ -74,7 +74,9 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
|
||||
NeedLyXMinipageIndent = false;
|
||||
}
|
||||
|
||||
void LaTeXFeatures::require(string const & name) {
|
||||
|
||||
void LaTeXFeatures::require(string const & name)
|
||||
{
|
||||
if (name == "array") {
|
||||
array = true;
|
||||
} else if (name == "color") {
|
||||
@ -121,7 +123,8 @@ void LaTeXFeatures::require(string const & name) {
|
||||
}
|
||||
}
|
||||
|
||||
string LaTeXFeatures::getPackages()
|
||||
|
||||
string const LaTeXFeatures::getPackages()
|
||||
{
|
||||
string packages;
|
||||
LyXTextClass const & tclass =
|
||||
@ -158,7 +161,7 @@ string LaTeXFeatures::getPackages()
|
||||
+ params.graphicsDriver + "]{graphicx}\n";
|
||||
}
|
||||
|
||||
// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
// INSET_GRAPHICS: remove this when InsetFig is thrown.
|
||||
// graphics.sty
|
||||
if (graphics && params.graphicsDriver != "none") {
|
||||
if (params.graphicsDriver == "default")
|
||||
@ -200,22 +203,22 @@ string LaTeXFeatures::getPackages()
|
||||
packages += "\\doublespacing\n";
|
||||
break;
|
||||
case Spacing::Other:
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream value;
|
||||
#else
|
||||
char val[30];
|
||||
ostrstream value(val, 30);
|
||||
|
||||
#endif
|
||||
//#else
|
||||
// char val[30];
|
||||
// ostrstream value(val, 30);
|
||||
//
|
||||
//#endif
|
||||
value << params.spacing.getValue(); // setw?
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
packages += string("\\setstretch{")
|
||||
+ value.str().c_str() + "}\n";
|
||||
#else
|
||||
value << '\0';
|
||||
packages += string("\\setstretch{")
|
||||
+ value.str() + "}\n";
|
||||
#endif
|
||||
//#else
|
||||
// value << '\0';
|
||||
// packages += string("\\setstretch{")
|
||||
// + value.str() + "}\n";
|
||||
//#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@ -273,7 +276,7 @@ string LaTeXFeatures::getPackages()
|
||||
}
|
||||
|
||||
|
||||
string LaTeXFeatures::getMacros()
|
||||
string const LaTeXFeatures::getMacros()
|
||||
{
|
||||
string macros;
|
||||
|
||||
@ -330,7 +333,7 @@ string LaTeXFeatures::getMacros()
|
||||
}
|
||||
|
||||
|
||||
string LaTeXFeatures::getTClassPreamble()
|
||||
string const LaTeXFeatures::getTClassPreamble()
|
||||
{
|
||||
// the text class specific preamble
|
||||
LyXTextClass const & tclass =
|
||||
@ -347,7 +350,7 @@ string LaTeXFeatures::getTClassPreamble()
|
||||
}
|
||||
|
||||
|
||||
string LaTeXFeatures::getIncludedFiles()
|
||||
string const LaTeXFeatures::getIncludedFiles()
|
||||
{
|
||||
string sgmlpreamble;
|
||||
FileMap::const_iterator end = IncludedFiles.end();
|
||||
|
@ -36,13 +36,13 @@ struct LaTeXFeatures {
|
||||
///
|
||||
LaTeXFeatures(BufferParams const &, int n) ;
|
||||
/// The packaes needed by the document
|
||||
string getPackages();
|
||||
string const getPackages();
|
||||
/// The macros definitions needed by the document
|
||||
string getMacros();
|
||||
string const getMacros();
|
||||
/// The definitions needed by the document's textclass
|
||||
string getTClassPreamble();
|
||||
string const getTClassPreamble();
|
||||
///
|
||||
string getIncludedFiles();
|
||||
string const getIncludedFiles();
|
||||
|
||||
///
|
||||
void showStruct();
|
||||
|
21
src/Lsstream.h
Normal file
21
src/Lsstream.h
Normal file
@ -0,0 +1,21 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
#ifndef LSSTREAM_H
|
||||
#define LSSTREAM_H
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
#include <sstream>
|
||||
#else
|
||||
#include "support/sstream.h"
|
||||
#endif
|
||||
|
||||
#endif
|
@ -609,7 +609,7 @@ int LyXAction::getApproxFunc(string const & func) const
|
||||
}
|
||||
|
||||
|
||||
string LyXAction::getApproxFuncName(string const & func) const
|
||||
string const LyXAction::getApproxFuncName(string const & func) const
|
||||
{
|
||||
int f = getApproxFunc(func);
|
||||
// This will return empty string if f isn't an action.
|
||||
@ -617,7 +617,7 @@ string LyXAction::getApproxFuncName(string const & func) const
|
||||
}
|
||||
|
||||
|
||||
string LyXAction::getActionName(int action) const
|
||||
string const LyXAction::getActionName(int action) const
|
||||
{
|
||||
kb_action ac;
|
||||
string arg;
|
||||
@ -639,7 +639,7 @@ string LyXAction::getActionName(int action) const
|
||||
|
||||
// Returns one line help associated with a (pseudo)action, i.e. appends
|
||||
// the argument of the action if necessary
|
||||
string LyXAction::helpText(int pseudoaction) const
|
||||
string const LyXAction::helpText(int pseudoaction) const
|
||||
{
|
||||
string help, arg;
|
||||
kb_action action;
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
/** Returns an action name the most similar to a string.
|
||||
Don't include arguments, they would be ignored. */
|
||||
string getApproxFuncName(string const & func) const;
|
||||
string const getApproxFuncName(string const & func) const;
|
||||
|
||||
/// Returns a pseudo-action given an action and its argument.
|
||||
int getPseudoAction(kb_action action, string const & arg) const;
|
||||
@ -89,10 +89,10 @@ public:
|
||||
bool isPseudoAction(int) const;
|
||||
|
||||
/// Return the name associated with command
|
||||
string getActionName(int action) const;
|
||||
string const getActionName(int action) const;
|
||||
|
||||
/// Return one line help text associated with (pseudo)action
|
||||
string helpText(int action) const;
|
||||
string const helpText(int action) const;
|
||||
|
||||
/// True if the command has `flag' set
|
||||
bool funcHasFlag(kb_action action, func_attrib flag) const;
|
||||
|
@ -32,12 +32,8 @@
|
||||
#include "buffer.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Toolbar.h"
|
||||
#ifdef NEW_MENUBAR
|
||||
# include "frontends/Menubar.h"
|
||||
# include "MenuBackend.h"
|
||||
#else
|
||||
# include "menus.h"
|
||||
#endif
|
||||
#include "frontends/Menubar.h"
|
||||
#include "MenuBackend.h"
|
||||
#include "ToolbarDefaults.h"
|
||||
#include "lyx_gui_misc.h" // [update,Close]AllBufferRelatedDialogs
|
||||
#include "bufferview_funcs.h" // CurrentState()
|
||||
@ -83,11 +79,7 @@ LyXView::LyXView(int width, int height)
|
||||
|
||||
LyXView::~LyXView()
|
||||
{
|
||||
#ifdef NEW_MENUBAR
|
||||
delete menubar;
|
||||
#else
|
||||
delete menus;
|
||||
#endif
|
||||
delete toolbar;
|
||||
delete bufferview;
|
||||
delete minibuffer;
|
||||
@ -155,7 +147,6 @@ MiniBuffer * LyXView::getMiniBuffer() const
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEW_MENUBAR
|
||||
Menubar * LyXView::getMenubar() const
|
||||
{
|
||||
return menubar;
|
||||
@ -171,13 +162,6 @@ void LyXView::updateMenubar()
|
||||
menubar->set("main");
|
||||
}
|
||||
|
||||
#else
|
||||
Menus * LyXView::getMenus() const
|
||||
{
|
||||
return menus;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Intl * LyXView::getIntl() const
|
||||
{
|
||||
@ -224,9 +208,9 @@ void LyXView::setPosition(int x, int y)
|
||||
}
|
||||
|
||||
|
||||
void LyXView::show(int place, int border, char const * title)
|
||||
void LyXView::show(int place, int border, string const & title)
|
||||
{
|
||||
fl_show_form(form_, place, border, title);
|
||||
fl_show_form(form_, place, border, title.c_str());
|
||||
minibuffer->Init();
|
||||
InitLyXLookup(fl_display, form_->window);
|
||||
}
|
||||
@ -254,11 +238,7 @@ void LyXView::create_form_form_main(int width, int height)
|
||||
//
|
||||
// THE MENUBAR
|
||||
//
|
||||
#ifdef NEW_MENUBAR
|
||||
menubar = new Menubar(this, menubackend);
|
||||
#else
|
||||
menus = new Menus(this, air);
|
||||
#endif
|
||||
|
||||
//
|
||||
// TOOLBAR
|
||||
@ -332,9 +312,7 @@ void LyXView::init()
|
||||
invalidateLayoutChoice();
|
||||
updateLayoutChoice();
|
||||
UpdateDocumentClassChoice();
|
||||
#ifdef NEW_MENUBAR
|
||||
updateMenubar();
|
||||
#endif
|
||||
|
||||
// Start autosave timer
|
||||
if (lyxrc.autosave) {
|
||||
|
@ -18,22 +18,17 @@
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "LString.h"
|
||||
#include "Timeout.h"
|
||||
#include "support/utility.hpp"
|
||||
|
||||
// uncomment this line to try out the new menus
|
||||
#define NEW_MENUBAR 1
|
||||
|
||||
class LyXFunc;
|
||||
class Toolbar;
|
||||
class MiniBuffer;
|
||||
class Intl;
|
||||
class Buffer;
|
||||
#ifdef NEW_MENUBAR
|
||||
class Menubar;
|
||||
#else
|
||||
class Menus;
|
||||
#endif
|
||||
|
||||
class BufferView;
|
||||
class Dialogs;
|
||||
@ -60,7 +55,7 @@ public:
|
||||
void setPosition(int, int);
|
||||
|
||||
/// Show the main form.
|
||||
void show(int, int, char const * t = "LyX");
|
||||
void show(int, int, string const & t = string("LyX"));
|
||||
|
||||
/// init (should probably be removed later) (Lgb)
|
||||
void init();
|
||||
@ -92,16 +87,12 @@ public:
|
||||
/// return a pointer to the minibuffer
|
||||
MiniBuffer * getMiniBuffer() const;
|
||||
|
||||
#ifdef NEW_MENUBAR
|
||||
///
|
||||
Menubar * getMenubar() const;
|
||||
|
||||
///
|
||||
void updateMenubar();
|
||||
#else
|
||||
///
|
||||
Menus * getMenus() const;
|
||||
#endif
|
||||
|
||||
///
|
||||
Intl * getIntl() const;
|
||||
|
||||
@ -127,13 +118,8 @@ private:
|
||||
Toolbar * toolbar;
|
||||
///
|
||||
MiniBuffer * minibuffer;
|
||||
#ifdef NEW_MENUBAR
|
||||
///
|
||||
Menubar * menubar;
|
||||
#else
|
||||
///
|
||||
Menus * menus;
|
||||
#endif
|
||||
///
|
||||
Intl * intl;
|
||||
///
|
||||
|
@ -56,6 +56,7 @@ lyx_SOURCES = \
|
||||
LaTeXLog.C \
|
||||
Literate.C \
|
||||
Literate.h \
|
||||
Lsstream.h \
|
||||
LyXAction.C \
|
||||
LyXAction.h \
|
||||
LyXSendto.C \
|
||||
@ -192,8 +193,6 @@ lyx_SOURCES = \
|
||||
lyxvc.C \
|
||||
lyxvc.h \
|
||||
main.C \
|
||||
menus.C \
|
||||
menus.h \
|
||||
minibuffer.C \
|
||||
minibuffer.h \
|
||||
nt_defines.h \
|
||||
@ -208,8 +207,6 @@ lyx_SOURCES = \
|
||||
spellchecker.C \
|
||||
spellchecker.h \
|
||||
stl_string_fwd.h \
|
||||
table.C \
|
||||
table.h \
|
||||
tabular.C \
|
||||
tabular.h \
|
||||
tex-accent.C \
|
||||
|
@ -61,9 +61,9 @@ public:
|
||||
string const & command = string(),
|
||||
bool optional = false);
|
||||
/// The label of a given menuitem
|
||||
string label() const { return token(label_, '|', 0); }
|
||||
string const label() const { return token(label_, '|', 0); }
|
||||
///
|
||||
string shortcut() const { return token(label_, '|', 1); }
|
||||
string const shortcut() const { return token(label_, '|', 1); }
|
||||
/// The kind of entry
|
||||
Kind kind() const { return kind_; }
|
||||
/// the action (if relevant)
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
|
||||
/// Draw a string at position x, y (y is the baseline)
|
||||
virtual PainterBase & text(int x, int y,
|
||||
string const &str, LyXFont const & f) = 0;
|
||||
string const & str, LyXFont const & f) = 0;
|
||||
|
||||
/** Draw a string at position x, y (y is the baseline)
|
||||
This is just for fast drawing */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifdef HAVE_SSTREAM
|
||||
#include <sstream>
|
||||
using std::istringstream;
|
||||
@ -21,6 +22,9 @@ using std::ostringstream;
|
||||
#else
|
||||
#include <strstream>
|
||||
#endif
|
||||
#else
|
||||
#include "Lsstream.h"
|
||||
#endif
|
||||
|
||||
#include "Spacing.h"
|
||||
#include "LString.h"
|
||||
@ -60,14 +64,14 @@ void Spacing::set(Spacing::Space sp, float val)
|
||||
}
|
||||
|
||||
|
||||
void Spacing::set(Spacing::Space sp, char const * val)
|
||||
void Spacing::set(Spacing::Space sp, string const & val)
|
||||
{
|
||||
float fval;
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
istringstream istr(val);
|
||||
#else
|
||||
istrstream istr(val);
|
||||
#endif
|
||||
//#else
|
||||
// istrstream istr(val.c_str());
|
||||
//#endif
|
||||
istr >> fval;
|
||||
set(sp, fval);
|
||||
}
|
||||
@ -90,7 +94,7 @@ void Spacing::writeFile(ostream & os, bool para) const
|
||||
}
|
||||
|
||||
|
||||
string Spacing::writeEnvirBegin() const
|
||||
string const Spacing::writeEnvirBegin() const
|
||||
{
|
||||
switch(space) {
|
||||
case Default: break; // do nothing
|
||||
@ -101,26 +105,28 @@ string Spacing::writeEnvirBegin() const
|
||||
case Double:
|
||||
return "\\begin{doublespace}";
|
||||
case Other:
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
{
|
||||
ostringstream ost;
|
||||
ost << "\\begin{spacing}{"
|
||||
<< getValue() << "}";
|
||||
return ost.str().c_str();
|
||||
#else
|
||||
{
|
||||
char tmp[512];
|
||||
ostrstream ost(tmp, 512);
|
||||
ost << "\\begin{spacing}{"
|
||||
<< getValue() << "}" << '\0';
|
||||
return ost.str();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//#else
|
||||
// {
|
||||
// char tmp[512];
|
||||
// ostrstream ost(tmp, 512);
|
||||
// ost << "\\begin{spacing}{"
|
||||
// << getValue() << "}\0";
|
||||
// return ost.str();
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
string Spacing::writeEnvirEnd() const
|
||||
string const Spacing::writeEnvirEnd() const
|
||||
{
|
||||
switch(space) {
|
||||
case Default: break; // do nothing
|
||||
|
@ -49,25 +49,33 @@ public:
|
||||
///
|
||||
void set(Spacing::Space sp, float val = 1.0);
|
||||
///
|
||||
void set(Spacing::Space sp, char const * val) ;
|
||||
void set(Spacing::Space sp, string const & val) ;
|
||||
///
|
||||
void writeFile(std::ostream &, bool para = false) const;
|
||||
///
|
||||
string writeEnvirBegin() const;
|
||||
string const writeEnvirBegin() const;
|
||||
///
|
||||
string writeEnvirEnd() const;
|
||||
///
|
||||
friend bool operator==(Spacing const & a, Spacing const & b) {
|
||||
return a.space == b.space && a.getValue() == b.getValue();
|
||||
}
|
||||
///
|
||||
friend bool operator!=(Spacing const & a, Spacing const & b) {
|
||||
return !(a == b);
|
||||
}
|
||||
string const writeEnvirEnd() const;
|
||||
private:
|
||||
///
|
||||
Space space;
|
||||
///
|
||||
float value;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator==(Spacing const & a, Spacing const & b)
|
||||
{
|
||||
return a.getSpace() == b.getSpace()
|
||||
&& a.getValue() == b.getValue();
|
||||
}
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator!=(Spacing const & a, Spacing const & b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@ void Variables::set(string const & var, string const & val)
|
||||
}
|
||||
|
||||
|
||||
string Variables::get(string const & var) const
|
||||
string const Variables::get(string const & var) const
|
||||
{
|
||||
Vars::const_iterator cit = vars_.find(var);
|
||||
if (cit != vars_.end())
|
||||
@ -44,7 +44,7 @@ bool Variables::isset(string const & var) const
|
||||
}
|
||||
|
||||
|
||||
string Variables::expand(string const & s) const
|
||||
string const Variables::expand(string const & s) const
|
||||
{
|
||||
string str(s);
|
||||
LRegex reg("\\$\\{\\(.*\\)\\}");
|
||||
|
@ -26,11 +26,11 @@ public:
|
||||
///
|
||||
void set(string const &, string const &);
|
||||
///
|
||||
string get(string const &) const;
|
||||
string const get(string const &) const;
|
||||
///
|
||||
bool isset(string const & var) const;
|
||||
///
|
||||
string expand(string const &) const;
|
||||
string const expand(string const &) const;
|
||||
private:
|
||||
///
|
||||
typedef std::map<string, string> Vars;
|
||||
|
@ -40,6 +40,7 @@ void waitForX()
|
||||
XSync(fl_get_display(), 0);
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
// Just a bunch of C wrappers around static members of WorkArea
|
||||
void C_WorkArea_scroll_cb(FL_OBJECT * ob, long buf)
|
||||
@ -125,10 +126,9 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
width - 15 - 2 * bw, // scrollbarwidth
|
||||
height - 2 * bw, "",
|
||||
C_WorkArea_work_area_handler);
|
||||
//obj->wantkey = FL_KEY_TAB;
|
||||
obj->wantkey = FL_KEY_ALL;
|
||||
obj->u_vdata = this; /* This is how we pass the WorkArea
|
||||
to the work_area_handler. */
|
||||
to the work_area_handler. */
|
||||
fl_set_object_boxtype(obj,FL_DOWN_BOX);
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
|
||||
@ -265,6 +265,7 @@ void WorkArea::scroll_cb(FL_OBJECT * ob, long)
|
||||
waitForX();
|
||||
}
|
||||
|
||||
|
||||
bool Lgb_bug_find_hack = false;
|
||||
|
||||
int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
@ -355,19 +356,35 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
}
|
||||
KeySym ret_key = keysym;
|
||||
#else
|
||||
// Ok, this is a bit simplistic...seems that the rules
|
||||
// need to be a bit more...
|
||||
if (!key) break;
|
||||
KeySym ret_key = (keysym ? keysym : key);
|
||||
// Note that we need this handling because of a bug
|
||||
// in XForms 0.89, if this bug is resolved in the way I hope
|
||||
// we can just use the keysym directly with out looking
|
||||
// at key at all. (Lgb)
|
||||
KeySym ret_key = 0;
|
||||
if (!key) {
|
||||
// We migth have to add more keysyms here also,
|
||||
// we will do that as the issues arise. (Lgb)
|
||||
if (keysym == XK_space)
|
||||
ret_key = keysym;
|
||||
else
|
||||
break;
|
||||
} else {
|
||||
ret_key = (keysym ? keysym : key);
|
||||
}
|
||||
|
||||
#endif
|
||||
unsigned int ret_state = xke->state;
|
||||
|
||||
|
||||
// If you have a better way to handle "wild-output" of
|
||||
// characters after the key has been released than the one
|
||||
// below, please contact me. (Lgb)
|
||||
static Time last_time_pressed = 0;
|
||||
static unsigned int last_key_pressed = 0;
|
||||
static unsigned int last_state_pressed = 0;
|
||||
//lyxerr << "Workarea Diff: " << xke->time - last_time_pressed
|
||||
// << endl;
|
||||
if (xke->time - last_time_pressed < 40 // should perhaps be tunable
|
||||
lyxerr[Debug::KEY] << "Workarea Diff: "
|
||||
<< xke->time - last_time_pressed
|
||||
<< endl;
|
||||
if (xke->time - last_time_pressed < 35 // should perhaps be tunable
|
||||
&& xke->state == last_state_pressed
|
||||
&& xke->keycode == last_key_pressed) {
|
||||
lyxerr[Debug::KEY]
|
||||
@ -449,9 +466,10 @@ int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
|
||||
clipboard_read = true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
string WorkArea::getClipboard() const
|
||||
|
||||
string const WorkArea::getClipboard() const
|
||||
{
|
||||
clipboard_read = false;
|
||||
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
return fl_get_scrollbar_value(scrollbar);
|
||||
}
|
||||
///
|
||||
std::pair<float, float> getScrollbarBounds() const {
|
||||
std::pair<float, float> const getScrollbarBounds() const {
|
||||
std::pair<float, float> p;
|
||||
fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
|
||||
return p;
|
||||
@ -100,7 +100,7 @@ public:
|
||||
/// xforms callback
|
||||
static void scroll_cb(FL_OBJECT *, long);
|
||||
///
|
||||
string getClipboard() const;
|
||||
string const getClipboard() const;
|
||||
///
|
||||
void putClipboard(string const &) const;
|
||||
///
|
||||
|
166
src/buffer.C
166
src/buffer.C
@ -24,6 +24,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef HAVE_LOCALE
|
||||
#include <locale>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "buffer.h"
|
||||
#endif
|
||||
@ -100,9 +104,9 @@ using std::pair;
|
||||
using std::vector;
|
||||
using std::max;
|
||||
using std::set;
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
using std::istringstream;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
// all these externs should eventually be removed.
|
||||
extern BufferList bufferlist;
|
||||
@ -163,7 +167,7 @@ Buffer::~Buffer()
|
||||
}
|
||||
|
||||
|
||||
string Buffer::getLatexName(bool no_path) const
|
||||
string const Buffer::getLatexName(bool no_path) const
|
||||
{
|
||||
if (no_path)
|
||||
return OnlyFilename(ChangeExtension(MakeLatexName(filename),
|
||||
@ -461,11 +465,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
old_float += "\n\\end_inset\n";
|
||||
//lyxerr << "float body: " << old_float << endl;
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
istringstream istr(old_float);
|
||||
#else
|
||||
istrstream istr(old_float.c_str());
|
||||
#endif
|
||||
//#else
|
||||
// istrstream istr(old_float.c_str());
|
||||
//#endif
|
||||
|
||||
LyXLex nylex(0, 0);
|
||||
nylex.setStream(istr);
|
||||
@ -1261,6 +1265,12 @@ bool Buffer::writeFile(string const & fname, bool flag) const
|
||||
fname);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LOCALE
|
||||
// Use the standard "C" locale for file output.
|
||||
ofs.imbue(locale::classic());
|
||||
#endif
|
||||
|
||||
// The top of the file should not be written by params.
|
||||
|
||||
// write out a comment in the top of the file
|
||||
@ -1268,8 +1278,13 @@ bool Buffer::writeFile(string const & fname, bool flag) const
|
||||
<< " created this file. For more info see http://www.lyx.org/\n";
|
||||
ofs.setf(ios::showpoint|ios::fixed);
|
||||
ofs.precision(2);
|
||||
#ifndef HAVE_LOCALE
|
||||
char dummy_format[512];
|
||||
sprintf(dummy_format, "%.2f", LYX_FORMAT);
|
||||
ofs << "\\lyxformat " << dummy_format << "\n";
|
||||
#else
|
||||
ofs << "\\lyxformat " << setw(4) << LYX_FORMAT << "\n";
|
||||
|
||||
#endif
|
||||
// now write out the buffer paramters.
|
||||
params.writeFile(ofs);
|
||||
|
||||
@ -1428,19 +1443,19 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
c = par->GetChar(i);
|
||||
if (c == LyXParagraph::META_INSET) {
|
||||
if ((inset = par->GetInset(i))) {
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream ost;
|
||||
inset->Ascii(this, ost);
|
||||
h += ost.str().length();
|
||||
#else
|
||||
ostrstream ost;
|
||||
inset->Ascii(this, ost);
|
||||
ost << '\0';
|
||||
char * tmp = ost.str();
|
||||
string tstr(tmp);
|
||||
h += tstr.length();
|
||||
delete [] tmp;
|
||||
#endif
|
||||
//#else
|
||||
// ostrstream ost;
|
||||
// inset->Ascii(this, ost);
|
||||
// ost << '\0';
|
||||
// char * tmp = ost.str();
|
||||
// string tstr(tmp);
|
||||
// h += tstr.length();
|
||||
// delete [] tmp;
|
||||
//#endif
|
||||
}
|
||||
} else if (c == LyXParagraph::META_NEWLINE) {
|
||||
if (clen[j] < h)
|
||||
@ -2135,24 +2150,24 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
|
||||
{
|
||||
bool was_title = false;
|
||||
bool already_title = false;
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream ftnote;
|
||||
#else
|
||||
char * tmpholder = 0;
|
||||
#endif
|
||||
//#else
|
||||
// char * tmpholder = 0;
|
||||
//#endif
|
||||
TexRow ft_texrow;
|
||||
int ftcount = 0;
|
||||
|
||||
// if only_body
|
||||
while (par != endpar) {
|
||||
#ifndef HAVE_SSTREAM
|
||||
ostrstream ftnote;
|
||||
if (tmpholder) {
|
||||
ftnote << tmpholder;
|
||||
delete [] tmpholder;
|
||||
tmpholder = 0;
|
||||
}
|
||||
#endif
|
||||
//#ifndef HAVE_SSTREAM
|
||||
// ostrstream ftnote;
|
||||
// if (tmpholder) {
|
||||
// ftnote << tmpholder;
|
||||
// delete [] tmpholder;
|
||||
// tmpholder = 0;
|
||||
// }
|
||||
//#endif
|
||||
#ifndef NEW_INSETS
|
||||
if (par->IsDummy())
|
||||
lyxerr[Debug::LATEX] << "Error in latexParagraphs."
|
||||
@ -2204,26 +2219,26 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
|
||||
}
|
||||
ofs << ftnote.str();
|
||||
texrow += ft_texrow;
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
// The extra .c_str() is needed when we use
|
||||
// lyxstring instead of the STL string class.
|
||||
ftnote.str(string().c_str());
|
||||
#else
|
||||
delete [] ftnote.str();
|
||||
#endif
|
||||
//#else
|
||||
// delete [] ftnote.str();
|
||||
//#endif
|
||||
ft_texrow.reset();
|
||||
ftcount = 0;
|
||||
}
|
||||
#ifndef HAVE_SSTREAM
|
||||
else {
|
||||
// I hate strstreams
|
||||
tmpholder = ftnote.str();
|
||||
}
|
||||
#endif
|
||||
//#ifndef HAVE_SSTREAM
|
||||
// else {
|
||||
// // I hate strstreams
|
||||
// tmpholder = ftnote.str();
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
#ifndef HAVE_SSTREAM
|
||||
delete [] tmpholder;
|
||||
#endif
|
||||
//#ifndef HAVE_SSTREAM
|
||||
// delete [] tmpholder;
|
||||
//#endif
|
||||
// It might be that we only have a title in this document
|
||||
if (was_title && !already_title) {
|
||||
ofs << "\\maketitle\n";
|
||||
@ -2597,21 +2612,21 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
if (par->layout != textclasslist
|
||||
.NumberOfLayout(params.textclass,
|
||||
"Caption").second) {
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream ost;
|
||||
#else
|
||||
ostrstream ost;
|
||||
#endif
|
||||
//#else
|
||||
// ostrstream ost;
|
||||
//#endif
|
||||
SimpleDocBookOnePar(ost, extra_par, par,
|
||||
desc_on, depth + 2);
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
tmp_par += ost.str().c_str();
|
||||
#else
|
||||
ost << '\0';
|
||||
char * ctmp = ost.str();
|
||||
tmp_par += ctmp;
|
||||
delete [] ctmp;
|
||||
#endif
|
||||
//#else
|
||||
// ost << '\0';
|
||||
// char * ctmp = ost.str();
|
||||
// tmp_par += ctmp;
|
||||
// delete [] ctmp;
|
||||
//#endif
|
||||
}
|
||||
tmp_par = frontStrip(strip(tmp_par));
|
||||
|
||||
@ -2627,15 +2642,16 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
|
||||
|
||||
// push a tag in a style stack
|
||||
void Buffer::push_tag(ostream & os, char const * tag,
|
||||
void Buffer::push_tag(ostream & os, string const & tag,
|
||||
int & pos, char stack[5][3])
|
||||
{
|
||||
#warning Use a real stack! (Lgb)
|
||||
// pop all previous tags
|
||||
for (int j = pos; j >= 0; --j)
|
||||
os << "</" << stack[j] << ">";
|
||||
|
||||
// add new tag
|
||||
sprintf(stack[++pos], "%s", tag);
|
||||
sprintf(stack[++pos], "%s", tag.c_str());
|
||||
|
||||
// push all tags
|
||||
for (int i = 0; i <= pos; ++i)
|
||||
@ -2643,20 +2659,19 @@ void Buffer::push_tag(ostream & os, char const * tag,
|
||||
}
|
||||
|
||||
|
||||
void Buffer::pop_tag(ostream & os, char const * tag,
|
||||
void Buffer::pop_tag(ostream & os, string const & tag,
|
||||
int & pos, char stack[5][3])
|
||||
{
|
||||
int j;
|
||||
|
||||
#warning Use a real stack! (Lgb)
|
||||
// pop all tags till specified one
|
||||
for (j = pos; (j >= 0) && (strcmp(stack[j], tag)); --j)
|
||||
for (int j = pos; (j >= 0) && (strcmp(stack[j], tag.c_str())); --j)
|
||||
os << "</" << stack[j] << ">";
|
||||
|
||||
// closes the tag
|
||||
os << "</" << tag << ">";
|
||||
|
||||
// push all tags, but the specified one
|
||||
for (j = j + 1; j <= pos; ++j) {
|
||||
for (int j = j + 1; j <= pos; ++j) {
|
||||
os << "<" << stack[j] << ">";
|
||||
strcpy(stack[j-1], stack[j]);
|
||||
}
|
||||
@ -2879,7 +2894,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
|
||||
// Print an error message.
|
||||
void Buffer::LinuxDocError(LyXParagraph * par, int pos,
|
||||
char const * message)
|
||||
string const & message)
|
||||
{
|
||||
// insert an error marker in text
|
||||
InsetError * new_inset = new InsetError(message);
|
||||
@ -3242,18 +3257,18 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
|
||||
|
||||
if (c == LyXParagraph::META_INSET) {
|
||||
Inset * inset = par->GetInset(i);
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream ost;
|
||||
inset->DocBook(this, ost);
|
||||
string tmp_out = ost.str().c_str();
|
||||
#else
|
||||
ostrstream ost;
|
||||
inset->DocBook(this, ost);
|
||||
ost << '\0';
|
||||
char * ctmp = ost.str();
|
||||
string tmp_out(ctmp);
|
||||
delete [] ctmp;
|
||||
#endif
|
||||
//#else
|
||||
// ostrstream ost;
|
||||
// inset->DocBook(this, ost);
|
||||
// ost << '\0';
|
||||
// char * ctmp = ost.str();
|
||||
// string tmp_out(ctmp);
|
||||
// delete [] ctmp;
|
||||
//#endif
|
||||
//
|
||||
// This code needs some explanation:
|
||||
// Two insets are treated specially
|
||||
@ -3661,7 +3676,7 @@ void Buffer::setPaperStuff()
|
||||
|
||||
|
||||
// This function should be in Buffer because it's a buffer's property (ale)
|
||||
string Buffer::getIncludeonlyList(char delim)
|
||||
string const Buffer::getIncludeonlyList(char delim)
|
||||
{
|
||||
string lst;
|
||||
for (inset_iterator it = inset_iterator_begin();
|
||||
@ -3682,7 +3697,7 @@ string Buffer::getIncludeonlyList(char delim)
|
||||
}
|
||||
|
||||
|
||||
vector<string> Buffer::getLabelList()
|
||||
vector<string> const Buffer::getLabelList()
|
||||
{
|
||||
/// if this is a child document and the parent is already loaded
|
||||
/// Use the parent's list instead [ale990407]
|
||||
@ -3703,7 +3718,7 @@ vector<string> Buffer::getLabelList()
|
||||
}
|
||||
|
||||
|
||||
vector<vector<Buffer::TocItem> > Buffer::getTocList()
|
||||
vector<vector<Buffer::TocItem> > const Buffer::getTocList()
|
||||
{
|
||||
vector<vector<TocItem> > l(4);
|
||||
LyXParagraph * par = paragraph;
|
||||
@ -3758,8 +3773,9 @@ vector<vector<Buffer::TocItem> > Buffer::getTocList()
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
// This is also a buffer property (ale)
|
||||
vector<pair<string,string> > Buffer::getBibkeyList()
|
||||
vector<pair<string,string> > const Buffer::getBibkeyList()
|
||||
{
|
||||
/// if this is a child document and the parent is already loaded
|
||||
/// Use the parent's list instead [ale990412]
|
||||
|
27
src/buffer.h
27
src/buffer.h
@ -181,7 +181,7 @@ public:
|
||||
bool nice, bool only_body = false);
|
||||
|
||||
/// returns the main language for the buffer (document)
|
||||
string GetLanguage() const {
|
||||
string const GetLanguage() const {
|
||||
return params.language;
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public:
|
||||
/** A transformed version of the file name, adequate for LaTeX
|
||||
The path is stripped if no_path is true (default)
|
||||
*/
|
||||
string getLatexName(bool no_path = true) const;
|
||||
string const getLatexName(bool no_path = true) const;
|
||||
|
||||
/// Change name of buffer. Updates "read-only" flag.
|
||||
void fileName(string const & newfile);
|
||||
@ -288,9 +288,9 @@ public:
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
||||
///
|
||||
string getIncludeonlyList(char delim = ',');
|
||||
string const getIncludeonlyList(char delim = ',');
|
||||
///
|
||||
std::vector<std::pair<string,string> > getBibkeyList();
|
||||
std::vector<std::pair<string,string> > const getBibkeyList();
|
||||
///
|
||||
struct TocItem {
|
||||
///
|
||||
@ -312,9 +312,9 @@ public:
|
||||
TOC_LOA
|
||||
};
|
||||
///
|
||||
std::vector<std::vector<TocItem> > getTocList();
|
||||
std::vector<std::vector<TocItem> > const getTocList();
|
||||
///
|
||||
std::vector<string> getLabelList();
|
||||
std::vector<string> const getLabelList();
|
||||
|
||||
/** This will clearly have to change later. Later we can have more
|
||||
than one user per buffer. */
|
||||
@ -375,7 +375,8 @@ private:
|
||||
void sgmlCloseTag(std::ostream & os, int depth,
|
||||
string const & latexname) const;
|
||||
///
|
||||
void LinuxDocError(LyXParagraph * par, int pos, char const * message);
|
||||
void LinuxDocError(LyXParagraph * par, int pos,
|
||||
string const & message);
|
||||
///
|
||||
void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par,
|
||||
int desc_on, int const depth);
|
||||
@ -385,11 +386,11 @@ private:
|
||||
int const depth);
|
||||
|
||||
/// LinuxDoc.
|
||||
void push_tag(std::ostream & os, char const * tag,
|
||||
void push_tag(std::ostream & os, string const & tag,
|
||||
int & pos, char stack[5][3]);
|
||||
|
||||
/// LinuxDoc.
|
||||
void pop_tag(std::ostream & os, char const * tag,
|
||||
void pop_tag(std::ostream & os, string const & tag,
|
||||
int & pos, char stack[5][3]);
|
||||
|
||||
/// is save needed
|
||||
@ -459,10 +460,10 @@ public:
|
||||
friend
|
||||
bool operator==(inset_iterator const & iter1,
|
||||
inset_iterator const & iter2);
|
||||
///
|
||||
friend
|
||||
bool operator!=(inset_iterator const & iter1,
|
||||
inset_iterator const & iter2);
|
||||
//
|
||||
//friend
|
||||
//bool operator!=(inset_iterator const & iter1,
|
||||
// inset_iterator const & iter2);
|
||||
private:
|
||||
///
|
||||
void SetParagraph();
|
||||
|
@ -219,7 +219,7 @@ bool BufferList::close(Buffer * buf)
|
||||
}
|
||||
|
||||
|
||||
vector<string> BufferList::getFileNames() const
|
||||
vector<string> const BufferList::getFileNames() const
|
||||
{
|
||||
vector<string> nvec;
|
||||
for(BufferStorage::const_iterator cit = bstore.begin();
|
||||
@ -456,14 +456,11 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
|
||||
// no template, start with empty buffer
|
||||
b->paragraph = new LyXParagraph;
|
||||
}
|
||||
}
|
||||
else { // start with empty buffer
|
||||
} else { // start with empty buffer
|
||||
b->paragraph = new LyXParagraph;
|
||||
}
|
||||
|
||||
#warning Why mark a new document dirty? I deactivate this (Jug)
|
||||
if (!lyxrc.new_ask_filename) {
|
||||
// b->markDirty();
|
||||
if (!isNamed)
|
||||
b->setUnnamed();
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
/// Make a new file (buffer) using a template
|
||||
Buffer * newFile(string const &, string, bool isNamed=false);
|
||||
/// returns a vector with all the buffers filenames
|
||||
std::vector<string> getFileNames() const;
|
||||
std::vector<string> const getFileNames() const;
|
||||
|
||||
///
|
||||
int unlockInset(UpdatableInset *);
|
||||
|
@ -165,7 +165,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
else {
|
||||
os << "\\bulletLaTeX " << i
|
||||
<< "\n\t"
|
||||
<< user_defined_bullets[i].c_str()
|
||||
<< user_defined_bullets[i].getText().c_str()
|
||||
<< "\n\\end_bullet\n";
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ void FontSize(BufferView * bv, string const & size)
|
||||
|
||||
|
||||
// Returns the current font and depth as a message.
|
||||
string CurrentState(BufferView * bv)
|
||||
string const CurrentState(BufferView * bv)
|
||||
{
|
||||
string state;
|
||||
if (bv->available()) {
|
||||
|
@ -68,7 +68,7 @@ extern void Underline(BufferView *);
|
||||
///
|
||||
extern void FontSize(BufferView *, string const &);
|
||||
/// Returns the current font and depth as a message.
|
||||
extern string CurrentState(BufferView *);
|
||||
extern string const CurrentState(BufferView *);
|
||||
///
|
||||
extern void ToggleAndShow(BufferView *, LyXFont const &);
|
||||
#endif
|
||||
|
@ -84,7 +84,7 @@ bool updateBulletForm()
|
||||
fl_set_button(fd_form_bullet->radio_bullet_depth_1, 1);
|
||||
fl_set_input(fd_form_bullet->input_bullet_latex,
|
||||
current_view->buffer()
|
||||
->params.user_defined_bullets[0].c_str());
|
||||
->params.user_defined_bullets[0].getText().c_str());
|
||||
fl_set_choice(fd_form_bullet->choice_bullet_size,
|
||||
current_view->buffer()
|
||||
->params.user_defined_bullets[0].getSize() + 2);
|
||||
@ -149,7 +149,7 @@ void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
|
||||
// convert from 1-6 range to -1-4
|
||||
param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
|
||||
fl_set_input(fd_form_bullet->input_bullet_latex,
|
||||
param.temp_bullets[current_bullet_depth].c_str());
|
||||
param.temp_bullets[current_bullet_depth].getText().c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ void BulletDepthCB(FL_OBJECT * ob, long data)
|
||||
default:
|
||||
current_bullet_depth = data;
|
||||
fl_set_input(fd_form_bullet->input_bullet_latex,
|
||||
param.temp_bullets[data].c_str());
|
||||
param.temp_bullets[data].getText().c_str());
|
||||
fl_set_choice(fd_form_bullet->choice_bullet_size,
|
||||
param.temp_bullets[data].getSize() + 2);
|
||||
}
|
||||
@ -242,5 +242,5 @@ void BulletBMTableCB(FL_OBJECT *ob, long /*data*/ )
|
||||
param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
|
||||
param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
|
||||
fl_set_input(fd_form_bullet->input_bullet_latex,
|
||||
param.temp_bullets[current_bullet_depth].c_str());
|
||||
param.temp_bullets[current_bullet_depth].getText().c_str());
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ bool CharacterSet::loadFile(string const & fname)
|
||||
}
|
||||
|
||||
|
||||
pair<bool, int> CharacterSet::encodeString(string const & str) const
|
||||
pair<bool, int> const CharacterSet::encodeString(string const & str) const
|
||||
{
|
||||
lyxerr[Debug::KBMAP] << "Checking if we know [" << str << "]" << endl;
|
||||
bool ret = false;
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
///
|
||||
string const & getName() const;
|
||||
///
|
||||
std::pair<bool, int> encodeString(string const &) const;
|
||||
std::pair<bool, int> const encodeString(string const &) const;
|
||||
private:
|
||||
///
|
||||
string name_;
|
||||
|
24
src/combox.C
24
src/combox.C
@ -109,28 +109,30 @@ void Combox::remove()
|
||||
}
|
||||
|
||||
|
||||
void Combox::addline(char const* text)
|
||||
void Combox::addline(string const & text)
|
||||
{
|
||||
if (!browser) return;
|
||||
fl_add_browser_line(browser, text);
|
||||
fl_add_browser_line(browser, text.c_str());
|
||||
|
||||
// By default the first item is selected
|
||||
if (!sel) {
|
||||
sel = 1;
|
||||
if (type == FL_COMBOX_INPUT)
|
||||
fl_set_input(label, text);
|
||||
fl_set_input(label, text.c_str());
|
||||
else
|
||||
fl_set_object_label(label, text);
|
||||
fl_set_object_label(label, text.c_str());
|
||||
}
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
|
||||
bool Combox::select_text(char const* t)
|
||||
bool Combox::select_text(string const & t)
|
||||
{
|
||||
if (!browser || !t) return false;
|
||||
for (int i = 1; i <= fl_get_browser_maxline(browser); ++i) {
|
||||
if (!strcmp(t, fl_get_browser_line(browser, i))) {
|
||||
if (!browser || t.empty()) return false;
|
||||
int const maxline = fl_get_browser_maxline(browser);
|
||||
|
||||
for (int i = 1; i <= maxline; ++i) {
|
||||
if (t == fl_get_browser_line(browser, i)) {
|
||||
select(i);
|
||||
return true;
|
||||
}
|
||||
@ -142,7 +144,7 @@ bool Combox::select_text(char const* t)
|
||||
void Combox::select(int i)
|
||||
{
|
||||
if (!browser || !button) return;
|
||||
if (i>0 && i<= fl_get_browser_maxline(browser)) sel = i;
|
||||
if (i > 0 && i <= fl_get_browser_maxline(browser)) sel = i;
|
||||
fl_deactivate_object(button);
|
||||
|
||||
if (type == FL_COMBOX_INPUT)
|
||||
@ -155,7 +157,7 @@ void Combox::select(int i)
|
||||
|
||||
void Combox::add(int x, int y, int w, int hmin, int hmax)
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FL_OBJECT * obj;
|
||||
|
||||
switch(type) {
|
||||
case FL_COMBOX_DROPLIST:
|
||||
@ -311,7 +313,7 @@ void Combox::deactivate()
|
||||
if (label) fl_deactivate_object(label);
|
||||
}
|
||||
|
||||
void Combox::input_cb(FL_OBJECT *ob, long)
|
||||
void Combox::input_cb(FL_OBJECT * ob, long)
|
||||
{
|
||||
Combox * combo = static_cast<Combox*>(ob->u_vdata);
|
||||
|
||||
|
21
src/combox.h
21
src/combox.h
@ -30,6 +30,7 @@
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <cstdlib>
|
||||
#include "LString.h"
|
||||
|
||||
///
|
||||
enum combox_type {
|
||||
@ -63,20 +64,20 @@ public:
|
||||
void add(int x, int y, int w, int hmin, int hmax);
|
||||
|
||||
/// Add lines. Same as for fl_browser object
|
||||
void addline(char const *);
|
||||
void addline(string const &);
|
||||
/// Add lines. Same as for fl_browser object
|
||||
void addto(char const *);
|
||||
void addto(string const &);
|
||||
|
||||
/// Returns the selected item
|
||||
int get();
|
||||
|
||||
/// Returns a pointer to the selected line of text
|
||||
char const * getline();
|
||||
string const getline();
|
||||
|
||||
/// Select an arbitrary item
|
||||
void select(int);
|
||||
///
|
||||
bool select_text(char const *);
|
||||
bool select_text(string const &);
|
||||
|
||||
/// Clear all the list
|
||||
void clear();
|
||||
@ -106,7 +107,7 @@ public:
|
||||
///
|
||||
void deactivate();
|
||||
///
|
||||
void shortcut(char const *, int);
|
||||
void shortcut(string const &, int);
|
||||
///
|
||||
void Redraw();
|
||||
///
|
||||
@ -152,10 +153,10 @@ public:
|
||||
//----------------- Inline methods ---------------------------
|
||||
|
||||
inline
|
||||
void Combox::addto(char const * text)
|
||||
void Combox::addto(string const & text)
|
||||
{
|
||||
if (browser) {
|
||||
fl_addto_browser(browser, text);
|
||||
fl_addto_browser(browser, text.c_str());
|
||||
is_empty = false;
|
||||
}
|
||||
}
|
||||
@ -178,10 +179,10 @@ void Combox::gravity(unsigned g1, unsigned g2)
|
||||
|
||||
|
||||
inline
|
||||
void Combox::shortcut(char const * s, int i)
|
||||
void Combox::shortcut(string const & s, int i)
|
||||
{
|
||||
if (button)
|
||||
fl_set_object_shortcut(button, s, i);
|
||||
fl_set_object_shortcut(button, s.c_str(), i);
|
||||
}
|
||||
|
||||
|
||||
@ -215,7 +216,7 @@ int Combox::get()
|
||||
|
||||
|
||||
inline
|
||||
char const * Combox::getline()
|
||||
string const Combox::getline()
|
||||
{
|
||||
if (type == FL_COMBOX_INPUT)
|
||||
return fl_get_input(label);
|
||||
|
@ -43,7 +43,7 @@ vector<Command> Converter::commands;
|
||||
string Converter::latex_command;
|
||||
|
||||
inline
|
||||
string add_options(string const & command, string const & options)
|
||||
string const add_options(string const & command, string const & options)
|
||||
{
|
||||
string head;
|
||||
string tail = split(command, head, ' ');
|
||||
@ -492,7 +492,7 @@ bool Converter::runLaTeX(Buffer * buffer, string const & command)
|
||||
}
|
||||
|
||||
|
||||
string Converter::dvi_papersize(Buffer * buffer)
|
||||
string const Converter::dvi_papersize(Buffer const * buffer)
|
||||
{
|
||||
char real_papersize = buffer->params.papersize;
|
||||
if (real_papersize == BufferParams::PAPER_DEFAULT)
|
||||
@ -518,7 +518,7 @@ string Converter::dvi_papersize(Buffer * buffer)
|
||||
}
|
||||
|
||||
|
||||
string Converter::dvips_options(Buffer * buffer)
|
||||
string const Converter::dvips_options(Buffer const * buffer)
|
||||
{
|
||||
string result;
|
||||
if (buffer->params.use_geometry
|
||||
|
@ -108,14 +108,15 @@ public:
|
||||
bool Convert(Buffer * buffer, string const & from_file,
|
||||
string const & to_file, string const & using_format,
|
||||
string * view_file = 0);
|
||||
///
|
||||
static
|
||||
string const SplitFormat(string const & str, string & format);
|
||||
///
|
||||
static
|
||||
string dvi_papersize(Buffer * buffer);
|
||||
string const dvi_papersize(Buffer const * buffer);
|
||||
///
|
||||
static
|
||||
string dvips_options(Buffer * buffer);
|
||||
string const dvips_options(Buffer const * buffer);
|
||||
private:
|
||||
///
|
||||
static
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
using std::map;
|
||||
using std::sort;
|
||||
|
||||
@ -427,7 +428,7 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName,
|
||||
|
||||
|
||||
// GetDirectory: gets last dialog directory
|
||||
string LyXFileDlg::GetDirectory() const
|
||||
string const LyXFileDlg::GetDirectory() const
|
||||
{
|
||||
if (!pszDirectory.empty())
|
||||
return pszDirectory;
|
||||
@ -666,7 +667,7 @@ void LyXFileDlg::Force(bool cancel)
|
||||
|
||||
|
||||
// Select: launches dialog and returns selected file
|
||||
string LyXFileDlg::Select(string const & title, string const & path,
|
||||
string const LyXFileDlg::Select(string const & title, string const & path,
|
||||
string const & mask, string const & suggested)
|
||||
{
|
||||
// handles new mask and path
|
||||
|
@ -45,9 +45,9 @@ public:
|
||||
void SetButton(int iIndex, string const & pszName = string(),
|
||||
string const & pszPath = string());
|
||||
/// gets last dialog directory
|
||||
string GetDirectory() const;
|
||||
string const GetDirectory() const;
|
||||
/// launches dialog and returns selected file
|
||||
string Select(string const & pszTitle = string(),
|
||||
string const Select(string const & pszTitle = string(),
|
||||
string const & pszPath = string(),
|
||||
string const & pszMask = string(),
|
||||
string const & pszSuggested = string());
|
||||
|
@ -162,6 +162,7 @@ int lyxfont::signedWidth(string const & s, LyXFont const & f)
|
||||
}
|
||||
|
||||
|
||||
//int lyxfont::width(wstring const & s, int n, LyXFont const & f)
|
||||
int lyxfont::width(XChar2b const * s, int n, LyXFont const & f)
|
||||
{
|
||||
if (!lyxrc.use_gui)
|
||||
@ -187,13 +188,13 @@ int lyxfont::width(XChar2b const * s, int n, LyXFont const & f)
|
||||
}
|
||||
}
|
||||
|
||||
int lyxfont::XTextWidth(LyXFont const & f, char * str, int count)
|
||||
int lyxfont::XTextWidth(LyXFont const & f, char const * str, int count)
|
||||
{
|
||||
return ::XTextWidth(getXFontstruct(f), str, count);
|
||||
}
|
||||
|
||||
|
||||
int lyxfont::XTextWidth16(LyXFont const & f, XChar2b * str, int count)
|
||||
int lyxfont::XTextWidth16(LyXFont const & f, XChar2b const * str, int count)
|
||||
{
|
||||
return ::XTextWidth16(getXFontstruct(f), str, count);
|
||||
}
|
||||
|
@ -68,13 +68,13 @@ struct lyxfont {
|
||||
int signedWidth(string const & s, LyXFont const & f);
|
||||
///
|
||||
static
|
||||
int XTextWidth(LyXFont const & f, char * str, int count);
|
||||
int XTextWidth(LyXFont const & f, char const * str, int count);
|
||||
///
|
||||
static
|
||||
int width(XChar2b const * s, int n, LyXFont const & f);
|
||||
///
|
||||
static
|
||||
int XTextWidth16(LyXFont const & f, XChar2b * str, int count);
|
||||
int XTextWidth16(LyXFont const & f, XChar2b const * str, int count);
|
||||
///
|
||||
static
|
||||
void XSetFont(Display * display, GC gc, LyXFont const & f);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 2000 The LyX Team.
|
||||
* Copyright 2000 The LyX Team.
|
||||
*
|
||||
* @author Jürgen Vigna
|
||||
*
|
||||
@ -63,6 +63,7 @@ C_GENERICCB(FormDocument, BulletDepthCB)
|
||||
C_GENERICCB(FormDocument, InputBulletLaTeXCB)
|
||||
C_GENERICCB(FormDocument, ChoiceBulletSizeCB)
|
||||
|
||||
|
||||
FormDocument::FormDocument(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), paper_(0), class_(0), language_(0), options_(0),
|
||||
bullets_(0), lv_(lv), d_(d), u_(0), h_(0),
|
||||
@ -78,12 +79,14 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
|
||||
current_bullet_panel = 0;
|
||||
}
|
||||
|
||||
|
||||
FormDocument::~FormDocument()
|
||||
{
|
||||
free();
|
||||
delete bc_;
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::build()
|
||||
{
|
||||
int n;
|
||||
@ -267,6 +270,7 @@ void FormDocument::build()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::show()
|
||||
{
|
||||
if (!dialog_)
|
||||
@ -286,6 +290,7 @@ void FormDocument::show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::hide()
|
||||
{
|
||||
if (dialog_->form->visible) {
|
||||
@ -295,15 +300,13 @@ void FormDocument::hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::apply()
|
||||
{
|
||||
if (!lv_->view()->available() || !dialog_)
|
||||
return;
|
||||
|
||||
bool
|
||||
redo;
|
||||
|
||||
redo = class_apply();
|
||||
bool redo = class_apply();
|
||||
paper_apply();
|
||||
redo = language_apply() || redo;
|
||||
redo = options_apply() || redo;
|
||||
@ -441,10 +444,10 @@ bool FormDocument::class_apply()
|
||||
return redo;
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::paper_apply()
|
||||
{
|
||||
BufferParams
|
||||
¶ms = lv_->buffer()->params;
|
||||
BufferParams & params = lv_->buffer()->params;
|
||||
|
||||
params.papersize2 = fl_get_choice(paper_->choice_papersize2)-1;
|
||||
params.paperpackage = fl_get_choice(paper_->choice_paperpackage)-1;
|
||||
@ -465,12 +468,11 @@ void FormDocument::paper_apply()
|
||||
lv_->buffer()->setPaperStuff();
|
||||
}
|
||||
|
||||
|
||||
bool FormDocument::language_apply()
|
||||
{
|
||||
BufferParams
|
||||
¶ms = lv_->buffer()->params;
|
||||
InsetQuotes::quote_language
|
||||
lga = InsetQuotes::EnglishQ;
|
||||
BufferParams & params = lv_->buffer()->params;
|
||||
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
|
||||
bool redo = false;
|
||||
|
||||
switch(fl_get_choice(language_->choice_quotes_language) - 1) {
|
||||
@ -522,12 +524,11 @@ bool FormDocument::language_apply()
|
||||
return redo;
|
||||
}
|
||||
|
||||
|
||||
bool FormDocument::options_apply()
|
||||
{
|
||||
BufferParams
|
||||
¶ms = lv_->buffer()->params;
|
||||
bool
|
||||
redo = false;
|
||||
BufferParams & params = lv_->buffer()->params;
|
||||
bool redo = false;
|
||||
|
||||
params.graphicsDriver =
|
||||
fl_get_choice_text(options_->choice_postscript_driver);
|
||||
@ -546,6 +547,7 @@ bool FormDocument::options_apply()
|
||||
return redo;
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::bullets_apply()
|
||||
{
|
||||
/* update the bullet settings */
|
||||
@ -558,6 +560,7 @@ void FormDocument::bullets_apply()
|
||||
param.user_defined_bullets[3] = param.temp_bullets[3];
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::cancel()
|
||||
{
|
||||
// this avoids confusion when reopening
|
||||
@ -568,6 +571,7 @@ void FormDocument::cancel()
|
||||
param.temp_bullets[3] = param.user_defined_bullets[3];
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::update()
|
||||
{
|
||||
if (!dialog_)
|
||||
@ -575,8 +579,7 @@ void FormDocument::update()
|
||||
|
||||
checkReadOnly();
|
||||
|
||||
BufferParams
|
||||
const & params = lv_->buffer()->params;
|
||||
BufferParams const & params = lv_->buffer()->params;
|
||||
|
||||
class_update(params);
|
||||
paper_update(params);
|
||||
@ -585,12 +588,13 @@ void FormDocument::update()
|
||||
bullets_update(params);
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::class_update(BufferParams const & params)
|
||||
{
|
||||
if (!class_)
|
||||
return;
|
||||
LyXTextClass
|
||||
const & tclass = textclasslist.TextClass(params.textclass);
|
||||
|
||||
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
||||
|
||||
#ifdef USE_CLASS_COMBO
|
||||
combo_doc_class->select_text(
|
||||
@ -679,6 +683,7 @@ void FormDocument::class_update(BufferParams const & params)
|
||||
fl_set_input(class_->input_doc_extra, "");
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::language_update(BufferParams const & params)
|
||||
{
|
||||
if (!language_)
|
||||
@ -695,6 +700,7 @@ void FormDocument::language_update(BufferParams const & params)
|
||||
fl_set_button(language_->radio_double, 1);
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::options_update(BufferParams const & params)
|
||||
{
|
||||
if (!options_)
|
||||
@ -712,6 +718,7 @@ void FormDocument::options_update(BufferParams const & params)
|
||||
fl_set_input(options_->input_float_placement, "");
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::paper_update(BufferParams const & params)
|
||||
{
|
||||
if (!paper_)
|
||||
@ -738,6 +745,7 @@ void FormDocument::paper_update(BufferParams const & params)
|
||||
fl_set_focus_object(paper_->form, paper_->choice_papersize2);
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::bullets_update(BufferParams const & params)
|
||||
{
|
||||
if (!bullets_ || ((XpmVersion<4) || (XpmVersion==4 && XpmRevision<7)))
|
||||
@ -763,11 +771,12 @@ void FormDocument::bullets_update(BufferParams const & params)
|
||||
|
||||
fl_set_button(bullets_->radio_bullet_depth_1, 1);
|
||||
fl_set_input(bullets_->input_bullet_latex,
|
||||
params.user_defined_bullets[0].c_str());
|
||||
params.user_defined_bullets[0].getText().c_str());
|
||||
fl_set_choice(bullets_->choice_bullet_size,
|
||||
params.user_defined_bullets[0].getSize() + 2);
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::free()
|
||||
{
|
||||
if (dialog_) {
|
||||
@ -807,39 +816,44 @@ void FormDocument::free()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FormDocument::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signals (u and h) are disconnected even if the
|
||||
// window manager is used to close the popup.
|
||||
FormDocument * pre = (FormDocument*)form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(form->u_vdata);
|
||||
pre->hide();
|
||||
pre->bc_->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->hide();
|
||||
pre->bc_->ok();
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::ApplyCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->bc_->apply();
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->cancel();
|
||||
pre->hide();
|
||||
pre->bc_->cancel();
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::RestoreCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
@ -847,12 +861,14 @@ void FormDocument::RestoreCB(FL_OBJECT * ob, long)
|
||||
pre->bc_->undoAll();
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::InputCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->bc_->valid(pre->CheckDocumentInput(ob,0));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::ComboInputCB(int, void * v, Combox * combox)
|
||||
{
|
||||
FormDocument * pre = static_cast<FormDocument*>(v);
|
||||
@ -861,13 +877,15 @@ void FormDocument::ComboInputCB(int, void * v, Combox * combox)
|
||||
pre->bc_->valid(pre->CheckDocumentInput(0,0));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::ChoiceClassCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->CheckChoiceClass(ob,0);
|
||||
pre->bc_->valid(pre->CheckDocumentInput(ob,0));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::checkReadOnly()
|
||||
{
|
||||
if (bc_->readOnly(lv_->buffer()->isReadonly())) {
|
||||
@ -884,11 +902,10 @@ void FormDocument::checkReadOnly()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::checkMarginValues()
|
||||
{
|
||||
int allEmpty;
|
||||
|
||||
allEmpty = (!strlen(fl_get_input(paper_->input_top_margin)) &&
|
||||
int const allEmpty = (!strlen(fl_get_input(paper_->input_top_margin)) &&
|
||||
!strlen(fl_get_input(paper_->input_bottom_margin)) &&
|
||||
!strlen(fl_get_input(paper_->input_left_margin)) &&
|
||||
!strlen(fl_get_input(paper_->input_right_margin)) &&
|
||||
@ -990,13 +1007,15 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::ChoiceBulletSizeCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->ChoiceBulletSize(ob,0);
|
||||
pre->bc_->valid(pre->CheckDocumentInput(ob,0));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/ )
|
||||
{
|
||||
BufferParams & param = lv_->buffer()->params;
|
||||
@ -1004,16 +1023,18 @@ void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/ )
|
||||
// convert from 1-6 range to -1-4
|
||||
param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
|
||||
fl_set_input(bullets_->input_bullet_latex,
|
||||
param.temp_bullets[current_bullet_depth].c_str());
|
||||
param.temp_bullets[current_bullet_depth].getText().c_str());
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::InputBulletLaTeXCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->InputBulletLaTeX(ob,0);
|
||||
pre->bc_->valid(pre->CheckDocumentInput(ob,0));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
|
||||
{
|
||||
BufferParams & param = lv_->buffer()->params;
|
||||
@ -1022,12 +1043,14 @@ void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
|
||||
setText(fl_get_input(bullets_->input_bullet_latex));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::BulletDepthCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->BulletDepth(ob,0);
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::BulletDepth(FL_OBJECT * ob, long data)
|
||||
{
|
||||
/* Should I do the following: */
|
||||
@ -1047,18 +1070,20 @@ void FormDocument::BulletDepth(FL_OBJECT * ob, long data)
|
||||
default:
|
||||
current_bullet_depth = data;
|
||||
fl_set_input(bullets_->input_bullet_latex,
|
||||
param.temp_bullets[data].c_str());
|
||||
param.temp_bullets[data].getText().c_str());
|
||||
fl_set_choice(bullets_->choice_bullet_size,
|
||||
param.temp_bullets[data].getSize() + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::BulletPanelCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->BulletPanel(ob,data);
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, long data)
|
||||
{
|
||||
/* Here we have to change the background pixmap to that selected */
|
||||
@ -1106,13 +1131,15 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, long data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::BulletBMTableCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDocument * pre = (FormDocument*)ob->form->u_vdata;
|
||||
FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
|
||||
pre->BulletBMTable(ob,0);
|
||||
pre->bc_->valid(pre->CheckDocumentInput(ob,0));
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/ )
|
||||
{
|
||||
/* handle the user input by setting the current bullet depth's pixmap */
|
||||
@ -1127,9 +1154,10 @@ void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/ )
|
||||
param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
|
||||
param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
|
||||
fl_set_input(bullets_->input_bullet_latex,
|
||||
param.temp_bullets[current_bullet_depth].c_str());
|
||||
param.temp_bullets[current_bullet_depth].getText().c_str());
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
||||
{
|
||||
if (!ob)
|
||||
@ -1137,7 +1165,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
||||
|
||||
ProhibitInput(lv_->view());
|
||||
int tc;
|
||||
const char * tct;
|
||||
string tct;
|
||||
|
||||
#ifdef USE_CLASS_COMBO
|
||||
tc = combo_doc_class->get();
|
||||
@ -1170,6 +1198,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
|
||||
AllowInput(lv_->view());
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::UpdateLayoutDocument(BufferParams const & params)
|
||||
{
|
||||
if (!dialog_)
|
||||
|
@ -63,7 +63,7 @@ void Toolbar::Pimpl::toolbarItem::clean() {
|
||||
|
||||
|
||||
Toolbar::Pimpl::toolbarItem &
|
||||
Toolbar::Pimpl::toolbarItem::operator=(const toolbarItem & ti) {
|
||||
Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti) {
|
||||
// Are we assigning the object onto itself?
|
||||
if (this == &ti)
|
||||
return *this;
|
||||
|
@ -26,21 +26,21 @@
|
||||
using std::endl;
|
||||
using std::ios;
|
||||
|
||||
|
||||
EPS_Renderer::EPS_Renderer()
|
||||
: Renderer()
|
||||
{}
|
||||
|
||||
EPS_Renderer::~EPS_Renderer()
|
||||
{}
|
||||
|
||||
bool EPS_Renderer::renderImage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool EPS_Renderer::isImageFormatOK(string const & filename) const
|
||||
{
|
||||
std::ifstream is(filename.c_str(), ios::in);
|
||||
std::ifstream is(filename.c_str());
|
||||
|
||||
// The signature of the file without the spaces.
|
||||
static const char str[] = "%!PS";
|
||||
|
@ -23,12 +23,9 @@ class EPS_Renderer : public Renderer {
|
||||
public:
|
||||
/// c-tor.
|
||||
EPS_Renderer();
|
||||
/// d-tor.
|
||||
virtual ~EPS_Renderer();
|
||||
|
||||
/// Load the EPS image and create a pixmap out of it.
|
||||
virtual bool renderImage();
|
||||
|
||||
private:
|
||||
/// Verify that filename is really an EPS file.
|
||||
virtual bool isImageFormatOK(string const & filename) const;
|
||||
|
@ -25,12 +25,12 @@ GraphicsCache * GraphicsCache::singleton = 0;
|
||||
GraphicsCache *
|
||||
GraphicsCache::getInstance()
|
||||
{
|
||||
if (! singleton) {
|
||||
singleton = new GraphicsCache;
|
||||
if (!singleton) {
|
||||
singleton = new GraphicsCache;
|
||||
Assert(singleton != 0);
|
||||
}
|
||||
}
|
||||
|
||||
return singleton;
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
@ -38,34 +38,37 @@ GraphicsCache::~GraphicsCache()
|
||||
{
|
||||
// Free the map.
|
||||
//std::foreach(map.begin(), map.end(), ...);
|
||||
#warning This is a bogus reason to not clean up after your self. (Lgb)
|
||||
// Clean up and be done with it. (Lgb)
|
||||
|
||||
// This is not really needed, it will only happen on program close and in
|
||||
// any case the OS will release those resources (not doing it may have
|
||||
// a good effect on closing time).
|
||||
|
||||
delete singleton;
|
||||
|
||||
delete singleton;
|
||||
}
|
||||
|
||||
|
||||
GraphicsCacheItem *
|
||||
GraphicsCache::addFile(string const & filename)
|
||||
{
|
||||
CacheType::const_iterator it = cache.find(filename);
|
||||
|
||||
if (it != cache.end()) {
|
||||
return new GraphicsCacheItem( *((*it).second) );
|
||||
}
|
||||
CacheType::const_iterator it = cache.find(filename);
|
||||
|
||||
if (it != cache.end()) {
|
||||
return new GraphicsCacheItem( *((*it).second) );
|
||||
}
|
||||
|
||||
GraphicsCacheItem * cacheItem = new GraphicsCacheItem();
|
||||
if (cacheItem == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
cacheItem->setFilename(filename);
|
||||
|
||||
|
||||
cache[filename] = cacheItem;
|
||||
|
||||
|
||||
// We do not want to return the main cache object, otherwise when the
|
||||
// will destroy their copy they will destroy the main copy.
|
||||
return new GraphicsCacheItem( *cacheItem );
|
||||
return new GraphicsCacheItem( *cacheItem );
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,32 +30,32 @@
|
||||
*/
|
||||
class GraphicsCache : public noncopyable {
|
||||
public:
|
||||
/// Get the instance of the class.
|
||||
static GraphicsCache * getInstance();
|
||||
/// Get the instance of the class.
|
||||
static GraphicsCache * getInstance();
|
||||
|
||||
/// Add a file to the cache.
|
||||
GraphicsCacheItem * addFile(string const & filename);
|
||||
/// Add a file to the cache.
|
||||
GraphicsCacheItem * addFile(string const & filename);
|
||||
|
||||
private:
|
||||
/// Remove a cache item if it's count has gone to zero.
|
||||
void removeFile(string const & filename);
|
||||
|
||||
/// Private c-tor so we can control how many objects are instantiated.
|
||||
GraphicsCache() {}
|
||||
|
||||
/// Private d-tor so that no-one will destroy us.
|
||||
~GraphicsCache();
|
||||
|
||||
/// Holder of the single instance of the class.
|
||||
static GraphicsCache * singleton;
|
||||
///
|
||||
typedef std::map<string, GraphicsCacheItem *> CacheType;
|
||||
///
|
||||
CacheType cache;
|
||||
|
||||
// We need this so that an Item can tell the cache that it should be
|
||||
// deleted. (to call removeFile).
|
||||
// It also helps removing a warning gcc emits.
|
||||
/// Remove a cache item if it's count has gone to zero.
|
||||
void removeFile(string const & filename);
|
||||
|
||||
/// Private c-tor so we can control how many objects are instantiated.
|
||||
GraphicsCache() {}
|
||||
|
||||
/// Private d-tor so that no-one will destroy us.
|
||||
~GraphicsCache();
|
||||
|
||||
/// Holder of the single instance of the class.
|
||||
static GraphicsCache * singleton;
|
||||
///
|
||||
typedef std::map<string, GraphicsCacheItem *> CacheType;
|
||||
///
|
||||
CacheType cache;
|
||||
|
||||
/** We need this so that an Item can tell the cache that it should be
|
||||
deleted. (to call removeFile).
|
||||
It also helps removing a warning gcc emits. */
|
||||
friend class GraphicsCacheItem;
|
||||
};
|
||||
#endif
|
||||
|
@ -19,17 +19,20 @@
|
||||
#include "graphics/GraphicsCacheItem.h"
|
||||
#include "graphics/GraphicsCacheItem_pimpl.h"
|
||||
|
||||
|
||||
GraphicsCacheItem::GraphicsCacheItem()
|
||||
: pimpl(new GraphicsCacheItem_pimpl)
|
||||
{
|
||||
pimpl->refCount = 1;
|
||||
}
|
||||
|
||||
|
||||
GraphicsCacheItem::~GraphicsCacheItem()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GraphicsCacheItem::setFilename(string const & filename)
|
||||
{
|
||||
@ -37,20 +40,21 @@ GraphicsCacheItem::setFilename(string const & filename)
|
||||
return pimpl->setFilename(filename);
|
||||
}
|
||||
|
||||
|
||||
GraphicsCacheItem::GraphicsCacheItem(GraphicsCacheItem const & gci)
|
||||
{
|
||||
pimpl = 0;
|
||||
copy(gci);
|
||||
}
|
||||
|
||||
GraphicsCacheItem const &
|
||||
GraphicsCacheItem &
|
||||
GraphicsCacheItem::operator=(GraphicsCacheItem const & gci)
|
||||
{
|
||||
// Are we trying to copy the object onto itself.
|
||||
if (this == &gci)
|
||||
return *this;
|
||||
|
||||
// Destory old copy
|
||||
// Destroy old copy
|
||||
destroy();
|
||||
|
||||
// And then copy new object.
|
||||
@ -59,6 +63,7 @@ GraphicsCacheItem::operator=(GraphicsCacheItem const & gci)
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GraphicsCacheItem::copy(GraphicsCacheItem const & gci)
|
||||
{
|
||||
@ -66,6 +71,7 @@ GraphicsCacheItem::copy(GraphicsCacheItem const & gci)
|
||||
++(pimpl->refCount);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GraphicsCacheItem::destroy()
|
||||
{
|
||||
@ -79,14 +85,18 @@ GraphicsCacheItem::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GraphicsCacheItem::ImageStatus
|
||||
GraphicsCacheItem::getImageStatus() const { return pimpl->imageStatus_; }
|
||||
|
||||
|
||||
int
|
||||
GraphicsCacheItem::getHeight() const { return pimpl->height_; }
|
||||
|
||||
|
||||
|
||||
int
|
||||
GraphicsCacheItem::getWidth() const { return pimpl->width_; }
|
||||
|
||||
|
||||
Pixmap
|
||||
GraphicsCacheItem::getImage() const { return pimpl->pixmap_; }
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
/// copy c-tor.
|
||||
GraphicsCacheItem(GraphicsCacheItem const &);
|
||||
/// Assignment operator.
|
||||
GraphicsCacheItem const & operator=(GraphicsCacheItem const &);
|
||||
GraphicsCacheItem & operator=(GraphicsCacheItem const &);
|
||||
|
||||
/// Get the height of the image. Returns -1 on error.
|
||||
int getHeight() const;
|
||||
|
@ -11,6 +11,12 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <unistd.h> // unlink
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
@ -23,11 +29,6 @@
|
||||
#include "support/filetools.h"
|
||||
#include "debug.h"
|
||||
#include "support/LAssert.h"
|
||||
#include <unistd.h> // unlink
|
||||
|
||||
#include <map>
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
using std::endl;
|
||||
using std::map;
|
||||
@ -38,6 +39,7 @@ GraphicsCacheItem_pimpl::GraphicsCacheItem_pimpl()
|
||||
pixmap_(0), renderer(0), refCount(0)
|
||||
{}
|
||||
|
||||
|
||||
GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl()
|
||||
{
|
||||
if (imageStatus_ == GraphicsCacheItem::Loaded) {
|
||||
@ -47,6 +49,7 @@ GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl()
|
||||
delete renderer;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GraphicsCacheItem_pimpl::setFilename(string const & filename)
|
||||
{
|
||||
@ -59,15 +62,17 @@ GraphicsCacheItem_pimpl::setFilename(string const & filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*** Callback method ***/
|
||||
|
||||
typedef map<string, GraphicsCacheItem_pimpl*> CallbackMap;
|
||||
static CallbackMap callbackMap;
|
||||
|
||||
|
||||
void
|
||||
callback(string cmd, int retval)
|
||||
{
|
||||
lyxerr << "callback, cmd="<<cmd<<", retval="<<retval<<endl;
|
||||
lyxerr << "callback, cmd=" << cmd << ", retval=" << retval << endl;
|
||||
|
||||
GraphicsCacheItem_pimpl * item = callbackMap[cmd];
|
||||
callbackMap.erase(cmd);
|
||||
@ -75,10 +80,11 @@ callback(string cmd, int retval)
|
||||
item->imageConverted(retval);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GraphicsCacheItem_pimpl::imageConverted(int retval)
|
||||
{
|
||||
lyxerr << "imageConverted, retval="<<retval<<endl;
|
||||
lyxerr << "imageConverted, retval=" << retval << endl;
|
||||
|
||||
if (retval) {
|
||||
imageStatus_ = GraphicsCacheItem::ErrorConverting;
|
||||
@ -102,7 +108,7 @@ GraphicsCacheItem_pimpl::renderXPM(string const & filename)
|
||||
|
||||
// Take only the filename part of the file, without path or extension.
|
||||
string temp = OnlyFilename(filename);
|
||||
temp = ChangeExtension(filename , string());
|
||||
temp = ChangeExtension(filename, string());
|
||||
|
||||
// Add some stuff to have it a unique temp file.
|
||||
xpmfile = TmpFileName(string(), temp);
|
||||
@ -117,19 +123,20 @@ GraphicsCacheItem_pimpl::renderXPM(string const & filename)
|
||||
// There is a problem with running it asyncronously, it doesn't return
|
||||
// to call the callback, so until the Systemcalls mechanism is fixed
|
||||
// I use the syncronous method.
|
||||
lyxerr << "Launching convert to xpm, command="<<command<<endl;
|
||||
lyxerr << "Launching convert to xpm, command=" << command << endl;
|
||||
// syscall.startscript(Systemcalls::DontWait, command, &callback);
|
||||
syscall.startscript(Systemcalls::Wait, command, &callback);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// This function gets called from the callback after the image has been
|
||||
// converted successfully.
|
||||
void
|
||||
GraphicsCacheItem_pimpl::loadXPMImage()
|
||||
{
|
||||
if (! renderer->setFilename(xpmfile)) {
|
||||
if (!renderer->setFilename(xpmfile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -59,13 +59,13 @@ public:
|
||||
/// Is the pixmap ready for display?
|
||||
ImageStatus getImageStatus() const;
|
||||
|
||||
/// Get a notification when the image conversion is done.
|
||||
/// used by an internal callback mechanism.
|
||||
/** Get a notification when the image conversion is done.
|
||||
used by an internal callback mechanism. */
|
||||
void imageConverted(int retval);
|
||||
|
||||
private:
|
||||
/// Private c-tor so that only GraphicsCache can create an instance.
|
||||
GraphicsCacheItem_pimpl();
|
||||
/// Private c-tor so that only GraphicsCache can create an instance.
|
||||
GraphicsCacheItem_pimpl();
|
||||
|
||||
/// Set the filename this item will be pointing too.
|
||||
bool setFilename(string const & filename);
|
||||
@ -76,8 +76,8 @@ private:
|
||||
/// Load the image from XPM to memory Pixmap
|
||||
void loadXPMImage();
|
||||
|
||||
///
|
||||
friend class GraphicsCacheItem;
|
||||
///
|
||||
friend class GraphicsCacheItem;
|
||||
|
||||
/// The file name of the XPM file.
|
||||
string xpmfile;
|
||||
|
@ -23,12 +23,14 @@
|
||||
Renderer::Renderer()
|
||||
: width_(0), height_(0), pixmapLoaded_(false)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Renderer::~Renderer()
|
||||
{
|
||||
freePixmap();
|
||||
}
|
||||
|
||||
|
||||
bool Renderer::setFilename(string const & filename)
|
||||
{
|
||||
// Make sure file exists and is readable.
|
||||
@ -45,17 +47,21 @@ bool Renderer::setFilename(string const & filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Renderer::renderImage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Renderer::isImageFormatOK(string const & /*filename*/) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Renderer::setPixmap(Pixmap pixmap, unsigned int width, unsigned int height)
|
||||
|
||||
void Renderer::setPixmap(Pixmap pixmap,
|
||||
unsigned int width, unsigned int height)
|
||||
{
|
||||
freePixmap();
|
||||
|
||||
@ -65,17 +71,30 @@ void Renderer::setPixmap(Pixmap pixmap, unsigned int width, unsigned int height)
|
||||
pixmapLoaded_ = true;
|
||||
}
|
||||
|
||||
|
||||
Pixmap Renderer::getPixmap() const
|
||||
{ return pixmap_; }
|
||||
{
|
||||
return pixmap_;
|
||||
}
|
||||
|
||||
|
||||
unsigned int Renderer::getWidth() const
|
||||
{ return width_; }
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
|
||||
unsigned int Renderer::getHeight() const
|
||||
{ return height_; }
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
|
||||
string const & Renderer::getFilename() const
|
||||
{ return filename_; }
|
||||
{
|
||||
return filename_;
|
||||
}
|
||||
|
||||
|
||||
void Renderer::freePixmap()
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ bool XPM_Renderer::renderImage()
|
||||
|
||||
bool XPM_Renderer::isImageFormatOK(string const & filename) const
|
||||
{
|
||||
std::ifstream is(filename.c_str(), ios::in);
|
||||
std::ifstream is(filename.c_str());
|
||||
|
||||
// The signature of the file without the spaces.
|
||||
static const char str[] = "/*XPM*/";
|
||||
|
@ -72,9 +72,9 @@ using std::vector;
|
||||
using std::find;
|
||||
using std::flush;
|
||||
using std::endl;
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
using std::ostringstream;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
extern BufferView * current_view;
|
||||
extern FL_OBJECT * figinset_canvas;
|
||||
@ -538,31 +538,31 @@ void runqueue()
|
||||
ofs.close(); // Don't remove this.
|
||||
|
||||
// gs process - set ghostview environment first
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
ostringstream t2;
|
||||
#else
|
||||
char tbuf2[80];
|
||||
ostrstream t2(tbuf2, sizeof(tbuf2));
|
||||
#endif
|
||||
//#else
|
||||
// char tbuf2[80];
|
||||
// ostrstream t2(tbuf2, sizeof(tbuf2));
|
||||
//#endif
|
||||
t2 << "GHOSTVIEW=" << fl_get_canvas_id(figinset_canvas)
|
||||
<< ' ' << p->data->bitmap;
|
||||
#ifndef HAVE_SSTREAM
|
||||
t2 << '\0';
|
||||
#endif
|
||||
//#ifndef HAVE_SSTREAM
|
||||
// t2 << '\0';
|
||||
//#endif
|
||||
// now set up ghostview property on a window
|
||||
// #warning BUG seems that the only bug here
|
||||
// might be the hardcoded dpi.. Bummer!
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
ostringstream t1;
|
||||
#else
|
||||
char tbuf[384];
|
||||
ostrstream t1(tbuf, sizeof(tbuf));
|
||||
#endif
|
||||
//#else
|
||||
// char tbuf[384];
|
||||
// ostrstream t1(tbuf, sizeof(tbuf));
|
||||
//#endif
|
||||
t1 << "0 0 0 0 " << p->data->wid << ' '
|
||||
<< p->data->hgh << " 72 72 0 0 0 0";
|
||||
#ifndef HAVE_SSTREAM
|
||||
t1 << '\0';
|
||||
#endif
|
||||
//#ifndef HAVE_SSTREAM
|
||||
// t1 << '\0';
|
||||
//#endif
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Will set GHOSTVIEW property to ["
|
||||
@ -613,7 +613,7 @@ void runqueue()
|
||||
::sleep(1);
|
||||
XGrabServer(tempdisp);
|
||||
}
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp, "GHOSTVIEW", false),
|
||||
@ -621,25 +621,25 @@ void runqueue()
|
||||
8, PropModeAppend,
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str().c_str())),
|
||||
t1.str().size());
|
||||
#else
|
||||
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp, "GHOSTVIEW", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeAppend,
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str())),
|
||||
::strlen(t1.str()));
|
||||
#endif
|
||||
//#else
|
||||
//
|
||||
// XChangeProperty(tempdisp,
|
||||
// fl_get_canvas_id(figinset_canvas),
|
||||
// XInternAtom(tempdisp, "GHOSTVIEW", false),
|
||||
// XInternAtom(tempdisp, "STRING", false),
|
||||
// 8, PropModeAppend,
|
||||
// reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str())),
|
||||
// ::strlen(t1.str()));
|
||||
//#endif
|
||||
XUngrabServer(tempdisp);
|
||||
XFlush(tempdisp);
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
ostringstream t3;
|
||||
#else
|
||||
//char tbuf[384];
|
||||
ostrstream t3(tbuf, sizeof(tbuf));
|
||||
#endif
|
||||
//#else
|
||||
// //char tbuf[384];
|
||||
// ostrstream t3(tbuf, sizeof(tbuf));
|
||||
//#endif
|
||||
switch (p->data->flags & 3) {
|
||||
case 0: t3 << 'H'; break; // Hidden
|
||||
case 1: t3 << 'M'; break; // Mono
|
||||
@ -654,12 +654,12 @@ void runqueue()
|
||||
|
||||
t3 << ' ' << BlackPixelOfScreen(DefaultScreenOfDisplay(tempdisp))
|
||||
<< ' ' << background_pixel;
|
||||
#ifndef HAVE_SSTREAM
|
||||
t3 << '\0';
|
||||
#endif
|
||||
//#ifndef HAVE_SSTREAM
|
||||
// t3 << '\0';
|
||||
//#endif
|
||||
|
||||
XGrabServer(tempdisp);
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp,
|
||||
@ -668,16 +668,16 @@ void runqueue()
|
||||
8, PropModeReplace,
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str().c_str())),
|
||||
t3.str().size());
|
||||
#else
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp,
|
||||
"GHOSTVIEW_COLORS", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeReplace,
|
||||
reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str())),
|
||||
::strlen(t3.str()));
|
||||
#endif
|
||||
//#else
|
||||
// XChangeProperty(tempdisp,
|
||||
// fl_get_canvas_id(figinset_canvas),
|
||||
// XInternAtom(tempdisp,
|
||||
// "GHOSTVIEW_COLORS", false),
|
||||
// XInternAtom(tempdisp, "STRING", false),
|
||||
// 8, PropModeReplace,
|
||||
// reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str())),
|
||||
// ::strlen(t3.str()));
|
||||
//#endif
|
||||
XUngrabServer(tempdisp);
|
||||
XFlush(tempdisp);
|
||||
|
||||
@ -691,14 +691,14 @@ void runqueue()
|
||||
++ne;
|
||||
typedef char * char_p;
|
||||
env = new char_p[ne + 2];
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
string tmp = t2.str().c_str();
|
||||
env[0] = new char[tmp.size() + 1];
|
||||
std::copy(tmp.begin(), tmp.end(), env[0]);
|
||||
env[0][tmp.size()] = '\0';
|
||||
#else
|
||||
env[0] = tbuf2;
|
||||
#endif
|
||||
//#else
|
||||
// env[0] = tbuf2;
|
||||
//#endif
|
||||
::memcpy(&env[1], environ, sizeof(char*) * (ne + 1));
|
||||
environ = env;
|
||||
|
||||
@ -1250,7 +1250,7 @@ bool InsetFig::Deletable() const
|
||||
}
|
||||
|
||||
|
||||
char const * InsetFig::EditMessage() const
|
||||
string const InsetFig::EditMessage() const
|
||||
{
|
||||
return _("Opened figure");
|
||||
}
|
||||
@ -1957,7 +1957,7 @@ void InsetFig::RestoreForm()
|
||||
}
|
||||
|
||||
|
||||
void InsetFig::Preview(char const * p)
|
||||
void InsetFig::Preview(string const & p)
|
||||
{
|
||||
int pid = fork();
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
|
||||
/// what appears in the minibuffer when opening
|
||||
char const * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
@ -62,7 +62,7 @@ public:
|
||||
///
|
||||
void CallbackFig(long arg);
|
||||
///
|
||||
void Preview(char const * p);
|
||||
void Preview(string const & p);
|
||||
/// browse for file
|
||||
void BrowseFile();
|
||||
|
||||
|
@ -64,13 +64,13 @@ void Inset::Edit(BufferView *, int, int, unsigned int)
|
||||
}
|
||||
|
||||
|
||||
LyXFont Inset::ConvertFont(LyXFont const & font) const
|
||||
LyXFont const Inset::ConvertFont(LyXFont const & font) const
|
||||
{
|
||||
return LyXFont(font);
|
||||
}
|
||||
|
||||
|
||||
char const * Inset::EditMessage() const
|
||||
string const Inset::EditMessage() const
|
||||
{
|
||||
return _("Opened inset");
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void InsetBibKey::Read(Buffer const *, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
string InsetBibKey::getScreenLabel() const
|
||||
string const InsetBibKey::getScreenLabel() const
|
||||
{
|
||||
if (! getOptions().empty())
|
||||
return getOptions();
|
||||
@ -214,7 +214,7 @@ InsetBibtex::~InsetBibtex()
|
||||
}
|
||||
|
||||
|
||||
string InsetBibtex::getScreenLabel() const
|
||||
string const InsetBibtex::getScreenLabel() const
|
||||
{
|
||||
return _("BibTeX Generated References");
|
||||
}
|
||||
@ -262,7 +262,7 @@ int InsetBibtex::Latex(Buffer const *, ostream & os,
|
||||
|
||||
|
||||
// This method returns a comma separated list of Bibtex entries
|
||||
vector<pair<string,string> > InsetBibtex::getKeys() const
|
||||
vector<pair<string, string> > const InsetBibtex::getKeys() const
|
||||
{
|
||||
// This hack is copied from InsetBibtex::Latex.
|
||||
// Is it still needed? Probably yes.
|
||||
@ -397,7 +397,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
||||
|
||||
|
||||
// ale070405
|
||||
string bibitemWidest(BufferView * bv)
|
||||
string const bibitemWidest(BufferView * bv)
|
||||
{
|
||||
int w = 0;
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
///
|
||||
void Read(Buffer const *, LyXLex & lex);
|
||||
///
|
||||
virtual string getScreenLabel() const;
|
||||
virtual string const getScreenLabel() const;
|
||||
///
|
||||
void Edit(BufferView *, int x, int y, unsigned int button);
|
||||
///
|
||||
@ -84,7 +84,7 @@ public:
|
||||
///
|
||||
Inset * Clone() const { return new InsetBibtex(params(), owner); }
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
string const getScreenLabel() const;
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -95,7 +95,7 @@ public:
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool freespace) const;
|
||||
///
|
||||
std::vector<std::pair<string,string> > getKeys() const;
|
||||
std::vector<std::pair<string,string> > const getKeys() const;
|
||||
///
|
||||
bool addDatabase(string const &);
|
||||
///
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
protected:
|
||||
/// This should provide the text for the button
|
||||
virtual string getScreenLabel() const = 0;
|
||||
virtual string const getScreenLabel() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@ InsetCitation::InsetCitation(InsetCommandParams const & p)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
string InsetCitation::getScreenLabel() const
|
||||
string const InsetCitation::getScreenLabel() const
|
||||
{
|
||||
string keys(getContents());
|
||||
|
||||
@ -56,6 +56,7 @@ string InsetCitation::getScreenLabel() const
|
||||
return '[' + label + ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::Edit(BufferView * bv, int, int, unsigned int)
|
||||
{
|
||||
bv->owner()->getDialogs()->showCitation( this );
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
Inset * Clone() const { return new InsetCitation(params()); }
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
string const getScreenLabel() const;
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
|
@ -33,7 +33,7 @@ InsetCommandParams::InsetCommandParams( string const & n,
|
||||
{}
|
||||
|
||||
|
||||
string InsetCommandParams::getAsString() const
|
||||
string const InsetCommandParams::getAsString() const
|
||||
{
|
||||
string b(cmdname);
|
||||
b += "|++|" + options + "|++|" + contents;
|
||||
@ -66,19 +66,14 @@ void InsetCommandParams::setFromString( string const & b )
|
||||
|
||||
bool InsetCommandParams::operator==(InsetCommandParams const & o) const
|
||||
{
|
||||
if( cmdname != o.cmdname ) return false;
|
||||
if( contents != o.contents ) return false;
|
||||
if( options != o.options ) return false;
|
||||
return true;
|
||||
if (cmdname == o.cmdname && contents == o.contents && options == o.options) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool InsetCommandParams::operator!=(InsetCommandParams const & o) const
|
||||
{
|
||||
if( cmdname != o.cmdname ) return true;
|
||||
if( contents != o.contents ) return true;
|
||||
if( options != o.options ) return true;
|
||||
return false;
|
||||
return !(*this == o);
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +168,7 @@ void InsetCommandParams::Write(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
string InsetCommandParams::getCommand() const
|
||||
string const InsetCommandParams::getCommand() const
|
||||
{
|
||||
string s;
|
||||
if (!getCmdName().empty()) s += "\\"+getCmdName();
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
///
|
||||
void Write(std::ostream &) const;
|
||||
/// Build the complete LaTeX command
|
||||
string getCommand() const;
|
||||
string const getCommand() const;
|
||||
///
|
||||
string const & getCmdName() const { return cmdname; }
|
||||
///
|
||||
@ -64,7 +64,7 @@ public:
|
||||
///
|
||||
void setContents(string const & c) { contents = c; }
|
||||
///
|
||||
string getAsString() const;
|
||||
string const getAsString() const;
|
||||
///
|
||||
void setFromString( string const & );
|
||||
private:
|
||||
@ -111,9 +111,9 @@ public:
|
||||
confusion with lyxinset::getLabel(int), but I've seen that
|
||||
it wasn't. I hope you never confuse again both methods. (ale)
|
||||
*/
|
||||
virtual string getScreenLabel() const = 0;
|
||||
virtual string const getScreenLabel() const = 0;
|
||||
///
|
||||
string getCommand() const { return p_.getCommand(); }
|
||||
string const getCommand() const { return p_.getCommand(); }
|
||||
///
|
||||
string const & getCmdName() const { return p_.getCmdName(); }
|
||||
///
|
||||
|
@ -162,7 +162,7 @@ void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
|
||||
}
|
||||
|
||||
|
||||
char const * InsetError::EditMessage() const
|
||||
string const InsetError::EditMessage() const
|
||||
{
|
||||
return _("Opened error");
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
///
|
||||
bool AutoDelete() const;
|
||||
/// what appears in the minibuffer when opening
|
||||
char const * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
///
|
||||
void Edit(BufferView *, int x, int y, unsigned int button);
|
||||
///
|
||||
|
@ -54,7 +54,7 @@ Inset * InsetERT::Clone() const
|
||||
}
|
||||
|
||||
|
||||
char const * InsetERT::EditMessage() const
|
||||
string const InsetERT::EditMessage() const
|
||||
{
|
||||
return _("Opened ERT Inset");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
///
|
||||
Inset * Clone() const;
|
||||
///
|
||||
char const * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
///
|
||||
bool InsertInset(BufferView *, Inset *) { return false; }
|
||||
///
|
||||
|
@ -245,10 +245,10 @@ void InsetExternal::cancelCB(FL_OBJECT * ob, long)
|
||||
}
|
||||
|
||||
|
||||
char const * InsetExternal::EditMessage() const
|
||||
string const InsetExternal::EditMessage() const
|
||||
{
|
||||
ExternalTemplate const & et = getTemplate(templatename);
|
||||
return doSubstitution(0, et.guiName).c_str();
|
||||
return doSubstitution(0, et.guiName);
|
||||
}
|
||||
|
||||
|
||||
@ -402,7 +402,7 @@ Inset * InsetExternal::Clone() const
|
||||
}
|
||||
|
||||
|
||||
string InsetExternal::getScreenLabel() const
|
||||
string const InsetExternal::getScreenLabel() const
|
||||
{
|
||||
if (templatename.empty()) {
|
||||
return _("External");
|
||||
@ -469,7 +469,7 @@ void InsetExternal::automaticUpdate(BufferView const * bv) const
|
||||
}
|
||||
|
||||
|
||||
string InsetExternal::doSubstitution(Buffer const * buffer,
|
||||
string const InsetExternal::doSubstitution(Buffer const * buffer,
|
||||
string const & s) const
|
||||
{
|
||||
string result;
|
||||
@ -506,13 +506,13 @@ string InsetExternal::doSubstitution(Buffer const * buffer,
|
||||
}
|
||||
|
||||
|
||||
string InsetExternal::getCurrentTemplate() const
|
||||
string const InsetExternal::getCurrentTemplate() const
|
||||
{
|
||||
return getTemplateName(fl_get_choice(form_external->templatechoice));
|
||||
}
|
||||
|
||||
|
||||
ExternalTemplate InsetExternal::getTemplate(string const & name) const
|
||||
ExternalTemplate const InsetExternal::getTemplate(string const & name) const
|
||||
{
|
||||
ExternalTemplateManager::Templates::const_iterator i =
|
||||
ExternalTemplateManager::get().getTemplates().find(name);
|
||||
@ -543,7 +543,7 @@ int InsetExternal::getTemplateNumber(string const & name) const
|
||||
}
|
||||
|
||||
|
||||
string InsetExternal::getTemplateName(int i) const
|
||||
string const InsetExternal::getTemplateName(int i) const
|
||||
{
|
||||
ExternalTemplateManager::Templates::const_iterator i1;
|
||||
i1 = ExternalTemplateManager::get().getTemplates().begin();
|
||||
@ -554,7 +554,7 @@ string InsetExternal::getTemplateName(int i) const
|
||||
}
|
||||
|
||||
|
||||
string InsetExternal::getTemplateString() const
|
||||
string const InsetExternal::getTemplateString() const
|
||||
{
|
||||
string result;
|
||||
bool first = true;
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
virtual ~InsetExternal();
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual char const * EditMessage() const;
|
||||
virtual string const EditMessage() const;
|
||||
///
|
||||
virtual void Edit(BufferView *, int x, int y, unsigned int button);
|
||||
///
|
||||
@ -62,7 +62,7 @@ public:
|
||||
virtual Inset * Clone() const;
|
||||
|
||||
/// returns the text of the button
|
||||
virtual string getScreenLabel() const;
|
||||
virtual string const getScreenLabel() const;
|
||||
|
||||
/// Callback function for the template drop-down
|
||||
static void templateCB(FL_OBJECT *, long);
|
||||
@ -106,27 +106,27 @@ private:
|
||||
void doView(BufferView const *) const;
|
||||
|
||||
/// Substitute meta-variables in this string
|
||||
string doSubstitution(Buffer const *, string const & s) const;
|
||||
string const doSubstitution(Buffer const *, string const & s) const;
|
||||
|
||||
/** Get the LyX name of the currently selected
|
||||
template in the choice list
|
||||
*/
|
||||
string getCurrentTemplate() const;
|
||||
string const getCurrentTemplate() const;
|
||||
|
||||
/// Get a certain template from a LyX name
|
||||
ExternalTemplate getTemplate(string const & lyxname) const;
|
||||
ExternalTemplate const getTemplate(string const & lyxname) const;
|
||||
|
||||
/**
|
||||
* Get the number starting from 1 of a template with a
|
||||
* specific LyX name for the choice list
|
||||
Get the number starting from 1 of a template with a
|
||||
specific LyX name for the choice list
|
||||
*/
|
||||
int getTemplateNumber(string const & guiname) const;
|
||||
|
||||
/// Get the LyX name of a template with a given number starting from 1
|
||||
string getTemplateName(int n) const;
|
||||
string const getTemplateName(int n) const;
|
||||
|
||||
/// Get a string with all the GUI template names separated by |
|
||||
string getTemplateString() const;
|
||||
string const getTemplateString() const;
|
||||
|
||||
///
|
||||
struct Holder {
|
||||
|
@ -146,7 +146,7 @@ Inset * InsetFloat::Clone() const
|
||||
}
|
||||
|
||||
|
||||
char const * InsetFloat::EditMessage() const
|
||||
string const InsetFloat::EditMessage() const
|
||||
{
|
||||
return _("Opened Float Inset");
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
|
||||
///
|
||||
const char * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
///
|
||||
bool InsertInsetAllowed(Inset * inset) const;
|
||||
///
|
||||
|
@ -45,7 +45,7 @@ Inset * InsetFoot::Clone() const
|
||||
}
|
||||
|
||||
|
||||
char const * InsetFoot::EditMessage() const
|
||||
string const InsetFoot::EditMessage() const
|
||||
{
|
||||
return _("Opened Footnote Inset");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
|
||||
///
|
||||
const char * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
///
|
||||
bool InsertInsetAllowed(Inset * inset) const;
|
||||
};
|
||||
|
@ -368,8 +368,9 @@ void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
|
||||
updateInset();
|
||||
}
|
||||
|
||||
static void formatResize(ostream & os, char const *key,
|
||||
InsetGraphicsParams::Resize resizeType, double size)
|
||||
static
|
||||
void formatResize(ostream & os, string const & key,
|
||||
InsetGraphicsParams::Resize resizeType, double size)
|
||||
{
|
||||
switch (resizeType) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE:
|
||||
@ -423,11 +424,11 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
// Calculate the options part of the command, we must do it to a string
|
||||
// stream since we might have a trailing comma that we would like to remove
|
||||
// before writing it to the output stream.
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream options;
|
||||
#else
|
||||
ostrstream options;
|
||||
#endif
|
||||
//#else
|
||||
// ostrstream options;
|
||||
//#endif
|
||||
|
||||
formatResize(options, "width", params.widthResize, params.widthSize);
|
||||
formatResize(options, "height", params.heightResize, params.heightSize);
|
||||
@ -543,14 +544,14 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
string opts(options.str().c_str());
|
||||
#else
|
||||
options << '\0';
|
||||
char * tmp = options.str();
|
||||
string opts(tmp);
|
||||
delete [] tmp;
|
||||
#endif
|
||||
//#else
|
||||
// options << '\0';
|
||||
// char * tmp = options.str();
|
||||
// string opts(tmp);
|
||||
// delete [] tmp;
|
||||
//#endif
|
||||
opts = strip(opts, ',');
|
||||
|
||||
|
||||
|
@ -36,11 +36,10 @@ class Dialogs;
|
||||
///
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
class InsetGraphics : public Inset, public SigC::Object
|
||||
{
|
||||
#else
|
||||
class InsetGraphics : public Inset, public Object
|
||||
#endif
|
||||
{
|
||||
#endif
|
||||
public:
|
||||
///
|
||||
InsetGraphics();
|
||||
@ -66,8 +65,8 @@ public:
|
||||
void Read(Buffer const *, LyXLex & lex);
|
||||
|
||||
/** returns the number of rows (\n's) of generated tex code.
|
||||
fragile == true means, that the inset should take care about
|
||||
fragile commands by adding a \protect before.
|
||||
#fragile == true# means, that the inset should take care about
|
||||
fragile commands by adding a #\protect# before.
|
||||
*/
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
@ -79,8 +78,8 @@ public:
|
||||
int DocBook(Buffer const *, std::ostream &) const;
|
||||
|
||||
/** Tell LyX what the latex features you need i.e. what latex packages
|
||||
* you need to be included.
|
||||
*/
|
||||
you need to be included.
|
||||
*/
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
@ -89,16 +88,18 @@ public:
|
||||
///
|
||||
Inset * Clone() const;
|
||||
|
||||
/// Set the inset parameters, used by the GUIndependent dialog.
|
||||
/// Return true of new params are different from what was so far.
|
||||
/** Set the inset parameters, used by the GUIndependent dialog.
|
||||
Return true of new params are different from what was so far.
|
||||
*/
|
||||
bool setParams(InsetGraphicsParams const & params);
|
||||
|
||||
/// Get the inset parameters, used by the GUIndependent dialog.
|
||||
InsetGraphicsParams getParams() const;
|
||||
|
||||
/// This signal is connected by our dialog and called when the inset
|
||||
/// is deleted.
|
||||
Signal0 < void > hide;
|
||||
/** This signal is connected by our dialog and called when the inset
|
||||
is deleted.
|
||||
*/
|
||||
Signal0 <void> hide;
|
||||
private:
|
||||
/// Update the inset after parameter change.
|
||||
void updateInset();
|
||||
|
@ -94,8 +94,8 @@ InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
|
||||
copy(igp);
|
||||
}
|
||||
|
||||
InsetGraphicsParams const &
|
||||
InsetGraphicsParams::operator=(InsetGraphicsParams const ¶ms)
|
||||
InsetGraphicsParams &
|
||||
InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
|
||||
{
|
||||
// Are we assigning the object into itself?
|
||||
if (this == ¶ms)
|
||||
@ -197,7 +197,9 @@ bool operator==(InsetGraphicsParams const & left,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void writeResize(ostream & os, char const * key,
|
||||
|
||||
static
|
||||
void writeResize(ostream & os, string const & key,
|
||||
InsetGraphicsParams::Resize resize, double size)
|
||||
{
|
||||
os << ' ' << key << "Resize ";
|
||||
|
@ -71,8 +71,8 @@ struct InsetGraphicsParams
|
||||
REFERENCE_POINT = LEFTBASELINE
|
||||
};
|
||||
|
||||
/// The resize of the image, is it the default size, in cm, inch or
|
||||
/// percentage of the page/column width/height
|
||||
/** The resize of the image, is it the default size, in cm, inch or
|
||||
percentage of the page/column width/height */
|
||||
enum Resize {
|
||||
DEFAULT_SIZE,
|
||||
CM,
|
||||
@ -85,24 +85,25 @@ struct InsetGraphicsParams
|
||||
/// Keep the ratio between height and width when resizing.
|
||||
bool keepAspectRatio;
|
||||
|
||||
// What width resize to do?
|
||||
/// What width resize to do?
|
||||
Resize widthResize;
|
||||
// Value of width resize
|
||||
/// Value of width resize
|
||||
float widthSize;
|
||||
// What height resize to do?
|
||||
/// What height resize to do?
|
||||
Resize heightResize;
|
||||
// Value of height resize
|
||||
/// Value of height resize
|
||||
float heightSize;
|
||||
|
||||
// Origin point of rotation
|
||||
/// Origin point of rotation
|
||||
Origin rotateOrigin;
|
||||
// Rotation angle.
|
||||
/// Rotation angle.
|
||||
int rotateAngle;
|
||||
|
||||
///
|
||||
InsetGraphicsParams();
|
||||
|
||||
///
|
||||
InsetGraphicsParams(InsetGraphicsParams const &);
|
||||
InsetGraphicsParams const & operator=(InsetGraphicsParams const &);
|
||||
///
|
||||
InsetGraphicsParams & operator=(InsetGraphicsParams const &);
|
||||
|
||||
/// Save the parameters in the LyX format stream.
|
||||
void Write(Buffer const * buf, ostream & os) const;
|
||||
@ -121,6 +122,7 @@ private:
|
||||
void copy(InsetGraphicsParams const & params);
|
||||
};
|
||||
|
||||
bool operator==(InsetGraphicsParams const&, InsetGraphicsParams const &);
|
||||
///
|
||||
bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
||||
|
||||
#endif
|
||||
|
@ -190,23 +190,24 @@ void include_cb(FL_OBJECT *, long arg)
|
||||
}
|
||||
|
||||
|
||||
static string unique_id() {
|
||||
static inline
|
||||
string unique_id() {
|
||||
static unsigned int seed=1000;
|
||||
|
||||
#ifdef HAVE_SSTREAM
|
||||
//#ifdef HAVE_SSTREAM
|
||||
std::ostringstream ost;
|
||||
ost << "file" << ++seed;
|
||||
|
||||
// Needed if we use lyxstring.
|
||||
return ost.str().c_str();
|
||||
#else
|
||||
char ctmp[16];
|
||||
ostrstream ost(ctmp,16);
|
||||
ost << "file" << ++seed << '\0';
|
||||
|
||||
// Needed if we use lyxstring.
|
||||
return ost.str();
|
||||
#endif
|
||||
//#else
|
||||
// char ctmp[16];
|
||||
// ostrstream ost(ctmp,16);
|
||||
// ost << "file" << ++seed << '\0';
|
||||
//
|
||||
// // Needed if we use lyxstring.
|
||||
// return ost.str();
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
@ -313,7 +314,7 @@ bool InsetInclude::display() const
|
||||
}
|
||||
|
||||
|
||||
string InsetInclude::getScreenLabel() const
|
||||
string const InsetInclude::getScreenLabel() const
|
||||
{
|
||||
string temp;
|
||||
if (isInput())
|
||||
@ -333,14 +334,14 @@ string InsetInclude::getScreenLabel() const
|
||||
}
|
||||
|
||||
|
||||
string InsetInclude::getFileName() const
|
||||
string const InsetInclude::getFileName() const
|
||||
{
|
||||
return MakeAbsPath(getContents(),
|
||||
OnlyPath(getMasterFilename()));
|
||||
}
|
||||
|
||||
|
||||
string InsetInclude::getMasterFilename() const
|
||||
string const InsetInclude::getMasterFilename() const
|
||||
{
|
||||
return master->fileName();
|
||||
}
|
||||
@ -535,7 +536,7 @@ void InsetInclude::Validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
vector<string> InsetInclude::getLabelList() const
|
||||
vector<string> const InsetInclude::getLabelList() const
|
||||
{
|
||||
vector<string> l;
|
||||
string parentname;
|
||||
@ -551,7 +552,7 @@ vector<string> InsetInclude::getLabelList() const
|
||||
}
|
||||
|
||||
|
||||
vector<pair<string,string> > InsetInclude::getKeys() const
|
||||
vector<pair<string,string> > const InsetInclude::getKeys() const
|
||||
{
|
||||
vector<pair<string,string> > keys;
|
||||
|
||||
|
@ -35,9 +35,9 @@ public:
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
|
||||
/// This returns the list of labels on the child buffer
|
||||
std::vector<string> getLabelList() const;
|
||||
std::vector<string> const getLabelList() const;
|
||||
/// This returns the list of bibkeys on the child buffer
|
||||
std::vector< std::pair<string,string> > getKeys() const;
|
||||
std::vector< std::pair<string,string> > const getKeys() const;
|
||||
///
|
||||
void Edit(BufferView *, int x, int y, unsigned int button);
|
||||
///
|
||||
@ -63,11 +63,11 @@ public:
|
||||
*/
|
||||
bool display() const;
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
string const getScreenLabel() const;
|
||||
///
|
||||
string getMasterFilename() const;
|
||||
string const getMasterFilename() const;
|
||||
///
|
||||
string getFileName() const;
|
||||
string const getFileName() const;
|
||||
|
||||
/// In "input" mode uses \input instead of \include.
|
||||
bool isInput() const { return flag == InsetInclude::INPUT; }
|
||||
|
@ -15,7 +15,7 @@ InsetIndex::InsetIndex(InsetCommandParams const & p)
|
||||
{}
|
||||
|
||||
|
||||
string InsetIndex::getScreenLabel() const
|
||||
string const InsetIndex::getScreenLabel() const
|
||||
{
|
||||
return _("Idx");
|
||||
}
|
||||
@ -31,7 +31,7 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
string InsetPrintIndex::getScreenLabel() const
|
||||
string const InsetPrintIndex::getScreenLabel() const
|
||||
{
|
||||
return _("Index");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
Inset * Clone() const { return new InsetIndex(params());}
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
string const getScreenLabel() const;
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -54,7 +54,7 @@ public:
|
||||
///
|
||||
Inset::Code LyxCode() const;
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
string const getScreenLabel() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -193,7 +193,7 @@ void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
|
||||
}
|
||||
|
||||
|
||||
char const * InsetInfo::EditMessage() const
|
||||
string const InsetInfo::EditMessage() const
|
||||
{
|
||||
return _("Opened note");
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
///
|
||||
int DocBook(Buffer const *, std::ostream &) const;
|
||||
/// what appears in the minibuffer when opening
|
||||
char const * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
|
@ -33,7 +33,7 @@ InsetLabel::InsetLabel(InsetCommandParams const & p)
|
||||
{}
|
||||
|
||||
|
||||
vector<string> InsetLabel::getLabelList() const
|
||||
vector<string> const InsetLabel::getLabelList() const
|
||||
{
|
||||
return vector<string>(1,getContents());
|
||||
}
|
||||
@ -96,7 +96,7 @@ int InsetLabel::DocBook(Buffer const *, ostream & os) const
|
||||
|
||||
// This function escapes 8-bit characters and other problematic characters
|
||||
// It's exactly the same code as in insetref.C.
|
||||
string InsetLabel::escape(string const & lab) const {
|
||||
string const InsetLabel::escape(string const & lab) const {
|
||||
char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
string enc;
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
Inset * Clone() const { return new InsetLabel(params()); }
|
||||
///
|
||||
string getScreenLabel() const { return getContents(); }
|
||||
string const getScreenLabel() const { return getContents(); }
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -33,7 +33,7 @@ public:
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
std::vector<string> getLabelList() const;
|
||||
std::vector<string> const getLabelList() const;
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
@ -45,7 +45,7 @@ public:
|
||||
int DocBook(Buffer const *, std::ostream &) const;
|
||||
private:
|
||||
/// This function escapes 8-bit characters
|
||||
string escape(string const &) const;
|
||||
string const escape(string const &) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ Inset * InsetList::Clone() const
|
||||
}
|
||||
|
||||
|
||||
char const * InsetList::EditMessage() const
|
||||
string const InsetList::EditMessage() const
|
||||
{
|
||||
return _("Opened List Inset");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
|
||||
///
|
||||
const char * EditMessage() const;
|
||||
string const EditMessage() const;
|
||||
///
|
||||
bool InsertInsetAllowed(Inset * inset) const;
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user