no change logs, sorry

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3232 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-12-18 03:30:35 +00:00
parent 8ddb8f993b
commit a45afb24a4
11 changed files with 61 additions and 81 deletions

View File

@ -9,6 +9,7 @@ src/converter.C
src/CutAndPaste.C
src/debug.C
src/exporter.C
src/ext_l10n.h
src/figure_form.C
src/figureForm.C
src/FontLoader.C

View File

@ -367,7 +367,9 @@ int BufferView::Pimpl::resizeCurrentBuffer()
bv_->theLockingInset(the_locking_inset);
}
bv_->text->first = screen_->topCursorVisible(bv_->text);
#if 0
buffer_->resizeInsets(bv_);
#endif
// this will scroll the screen such that the cursor becomes visible
updateScrollbar();
redraw();
@ -1554,7 +1556,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_PASTESELECTION:
{
bool asPara = false;
if (argument == "paragraph") asPara = true;
if (argument == "paragraph")
asPara = true;
pasteClipboard(asPara);
}
break;

View File

@ -108,7 +108,6 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
// the color closest to the one we want.
Visual * vi = DefaultVisual(display, DefaultScreen(display));
//XColor * cmap = new XColor[vi->map_entries];
boost::scoped_array<XColor> cmap(new XColor[vi->map_entries]);
for (int i = 0; i < vi->map_entries; ++i) {
@ -154,7 +153,6 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
<< _("Pixel [") << closest_pixel << _("] is used.")
<< endl;
val.foreground = cmap[closest_pixel].pixel;
//delete[] cmap;
}
val.function = GXcopy;

View File

@ -9,24 +9,25 @@
* ====================================================== */
#include <config.h>
#include <cmath> // fabs()
#ifdef __GNUG__
#pragma implementation "FontInfo.h"
#pragma implementation
#endif
#include "FontInfo.h"
#include "debug.h"
#include "lyxrc.h" // lyxrc.use_scalable_fonts
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include "frontends/GUIRunTime.h"
using std::endl;
#include <cmath> // abs()
using std::endl;
using std::abs;
#ifndef CXX_GLOBAL_CSTD
using std::fabs;
#endif
/// Load font close to this size
string const FontInfo::getFontname(int size)
@ -44,8 +45,8 @@ string const FontInfo::getFontname(int size)
lyxerr[Debug::FONT] << "Exact font match with\n"
<< strings[i] << endl;
return strings[i];
} else if (fabs(sizes[i] - size - 0.1) < error) {
error = fabs(sizes[i] - size - 0.1);
} else if (abs(sizes[i] - size - 0.1) < error) {
error = abs(sizes[i] - size - 0.1);
closestind = i;
}
}
@ -98,7 +99,6 @@ string const FontInfo::resize(string const & font, int size) const
/// Set new pattern
void FontInfo::setPattern(string const & pat)
{
release();
init();
pattern = pat;
}
@ -125,11 +125,10 @@ void FontInfo::query()
if (list == 0) {
// No fonts matched
scalable = false;
sizes = 0;
sizes.reset();
} else {
release();
sizes = new int[matches];
strings = new string[matches];
sizes.reset(new int[matches]);
strings.reset(new string[matches]);
// We have matches. Run them through
for (int i = 0; i < matches; ++i) {
@ -153,24 +152,10 @@ void FontInfo::query()
void FontInfo::init()
{
sizes = 0;
strings = 0;
sizes.reset();
strings.reset();
matches = 0;
queried = false;
scalable = false;
scaleindex = -1;
}
/// Release allocated stuff
void FontInfo::release()
{
if (sizes) {
delete [] sizes;
sizes = 0;
}
if (strings) {
delete [] strings;
strings = 0;
}
}

View File

@ -18,6 +18,8 @@
#include "LString.h"
#include <boost/smart_ptr.hpp>
/** This class manages a font.
The idea is to create a FontInfo object with a font name pattern with a
wildcard at the size field. Then this object can host request for font-
@ -35,9 +37,6 @@ public:
explicit FontInfo(string const & pat)
: pattern(pat) { init(); }
/// Destructor
~FontInfo() { release(); }
/// Does any font match our pattern?
bool exist() {
query();
@ -51,7 +50,7 @@ public:
}
/// Get existing pattern
string const getPattern() const { return pattern; }
string const & getPattern() const { return pattern; }
/// Set new pattern
void setPattern(string const & pat);
@ -64,10 +63,10 @@ private:
string pattern;
/// Available size list
int * sizes;
boost::scoped_array<int> sizes;
/// Corresponding name list
string * strings;
boost::scoped_array<string> strings;
/// Number of matches
int matches;
@ -84,9 +83,6 @@ private:
/// Initialize empty record
void init();
/// Release allocated stuff
void release();
/// Ask X11 about this font pattern
void query();

View File

@ -32,13 +32,10 @@
#include <cctype>
using std::endl;
using std::abs;
FL_OBJECT * figinset_canvas;
// needed to make the c++ compiler find the correct version of abs.
// This is at least true for g++.
//using std::abs;
namespace {
inline
@ -83,7 +80,7 @@ WorkArea::WorkArea(int xpos, int ypos, int width, int height)
<< width << 'x' << height << endl;
//
FL_OBJECT * obj;
int const bw = int(std::abs(float(fl_get_border_width())));
int const bw = int(abs(fl_get_border_width()));
// We really want to get rid of figinset_canvas.
::figinset_canvas = figinset_canvas = obj =
@ -205,7 +202,7 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
{
fl_freeze_all_forms();
int const bw = int(std::abs(float(fl_get_border_width())));
int const bw = int(abs(fl_get_border_width()));
// a box
fl_set_object_geometry(backgroundbox, xpos, ypos, width - 15, height);

View File

@ -14,14 +14,16 @@
#pragma implementation
#endif
#include <cctype>
#include "font.h"
#include "FontLoader.h"
#include "lyxrc.h"
#include "encoding.h"
#include "language.h"
#include <boost/smart_ptr.hpp>
#include <cctype>
namespace {
inline
@ -110,16 +112,13 @@ int lyxfont::width(char const * s, size_t n, LyXFont const & f)
return n;
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) {
XChar2b * xs = new XChar2b[n];
boost::scoped_array<XChar2b> xs(new XChar2b[n]);
Encoding const * encoding = f.language()->encoding();
//LyXFont const * font = &f;
LyXFont font(f);
if (f.isSymbolFont()) {
#ifdef USE_UNICODE_FOR_SYMBOLS
//LyXFont font2 = f;
font.setFamily(LyXFont::ROMAN_FAMILY);
font.setShape(LyXFont::UP_SHAPE);
//font = &font2;
#endif
encoding = encodings.symbol_encoding();
}
@ -128,8 +127,7 @@ int lyxfont::width(char const * s, size_t n, LyXFont const & f)
xs[i].byte1 = c >> 8;
xs[i].byte2 = c & 0xff;
}
int result = width(xs, n, font);
delete[] xs;
int result = width(xs.get(), n, font);
return result;
}

View File

@ -16,6 +16,8 @@
#include "LString.h"
#include <boost/smart_ptr.hpp>
#ifdef ENABLE_NLS
# if HAVE_GETTEXT
@ -40,17 +42,17 @@ string const _(string const & str)
{
if (!str.empty()) {
int const s = str.length();
char * tmp = new char[s + 1];
str.copy(tmp, s);
boost::scoped_array<char> tmp(new char[s + 1]);
str.copy(tmp.get(), s);
tmp[s] = '\0';
string const ret(gettext(tmp));
delete [] tmp;
string const ret(gettext(tmp.get()));
return ret;
} else {
return string();
}
}
void locale_init()
{
# ifdef HAVE_LC_MESSAGES
@ -60,6 +62,7 @@ void locale_init()
setlocale(LC_NUMERIC, "C");
}
void gettext_init(string const & localedir)
{
bindtextdomain(PACKAGE, localedir.c_str());
@ -74,6 +77,7 @@ void locale_init()
setlocale(LC_NUMERIC, "C");
}
void gettext_init(string const &)
{
}

View File

@ -62,7 +62,7 @@ string user_lyxdir; // Default $HOME/.lyx
// Should this be kept global? Asger says Yes.
DebugStream lyxerr;
LastFiles * lastfiles;
boost::scoped_ptr<LastFiles> lastfiles;
// This is the global bufferlist object
BufferList bufferlist;
@ -77,10 +77,6 @@ boost::scoped_ptr<kb_keymap> toplevel_keymap;
LyX::LyX(int * argc, char * argv[])
{
// Prevent crash with --help
lyxGUI = 0;
lastfiles = 0;
// Here we need to parse the command line. At least
// we need to parse for "-dbg" and "-help"
bool gui = easyParse(argc, argv);
@ -92,7 +88,7 @@ LyX::LyX(int * argc, char * argv[])
// Make the GUI object, and let it take care of the
// command line arguments that concerns it.
lyxerr[Debug::INIT] << "Initializing LyXGUI..." << endl;
lyxGUI = new LyXGUI(this, argc, argv, gui);
lyxGUI.reset(new LyXGUI(this, argc, argv, gui));
lyxerr[Debug::INIT] << "Initializing LyXGUI...done" << endl;
// Now the GUI and LyX have taken care of their arguments, so
@ -181,8 +177,6 @@ LyX::LyX(int * argc, char * argv[])
// A destructor is always necessary (asierra-970604)
LyX::~LyX()
{
delete lastfiles;
delete lyxGUI;
}
@ -491,9 +485,9 @@ void LyX::init(bool gui)
// load the lastfiles mini-database
lyxerr[Debug::INIT] << "Reading lastfiles `"
<< lyxrc.lastfiles << "'..." << endl;
lastfiles = new LastFiles(lyxrc.lastfiles,
lyxrc.check_lastfiles,
lyxrc.num_lastfiles);
lastfiles.reset(new LastFiles(lyxrc.lastfiles,
lyxrc.check_lastfiles,
lyxrc.num_lastfiles));
// start up the lyxserver. (is this a bit early?) (Lgb)
// 0.12 this will be way to early, we need the GUI to be initialized
@ -887,8 +881,8 @@ bool LyX::easyParse(int * argc, char * argv[])
}
else if (arg == "-i" || arg == "--import") {
if (i + 1 < *argc) {
string type(argv[i+1]);
string file(argv[i+2]);
string const type(argv[i+1]);
string const file(argv[i+2]);
removeargs = 3;
batch_command = "buffer-import " + type + " " + file;

View File

@ -22,6 +22,8 @@
#include <csignal>
#include "LString.h"
#include <boost/smart_ptr.hpp>
#include <boost/utility.hpp>
class LyXGUI;
@ -37,8 +39,9 @@ extern string user_lyxdir;
///
extern string system_tempdir;
///
extern LastFiles * lastfiles; /* we should hopefully be able to move this
* inside the LyX class */
extern boost::scoped_ptr<LastFiles> lastfiles;
/* we should hopefully be able to move this
* inside the LyX class */
/**
@ -56,7 +59,7 @@ public:
private:
/// Should be a maximum of 1 LyXGUI.
LyXGUI * lyxGUI;
boost::scoped_ptr<LyXGUI> lyxGUI;
/// does this user start lyx for the first time?
bool first_start;
///

View File

@ -4,20 +4,21 @@
#pragma implementation
#endif
#include <fstream>
#include "vc-backend.h"
#include "debug.h"
#include "buffer.h"
#include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include "support/FileInfo.h"
#include "support/LRegex.h"
#include "support/LSubstring.h"
#include "support/path.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "buffer.h"
#include "BufferView.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include <fstream>
using std::endl;
using std::ifstream;