some small changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9017 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-09-27 19:04:17 +00:00
parent de8a7a9214
commit fa371fa1eb
7 changed files with 32 additions and 30 deletions

View File

@ -1,3 +1,21 @@
2004-09-27 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyx_gui.C (start): change comment
(start): use for_each instead of explicit loop
* GWorkArea.h: store shared_ptr in the Maps.
* GWorkArea.C (~ColorCache): delete
(getColor): adjust
(getXftColor): adjust
(cacheColor): adjust
(cacheXftColor): adjust
(clear): simplify
* GView.C (GView): use show_all() instead of explict loop
* GMathPanel.C (doBuild): ws change
2004-09-27 John Spray <spray_john@users.sourceforge.net>
* The Character dialog

View File

@ -76,10 +76,7 @@ GView::GView()
// Make all Boxes visible.
top_box_.show();
BoxStore::iterator it = box_store_.begin();
BoxStore::iterator const end = box_store_.end();
for (; it != end; ++it)
(*it)->show();
top_box_.show_all();
// Define the components making up the window.
menubar_.reset(new GMenubar(this, menubackend));

View File

@ -19,6 +19,8 @@
#include "funcrequest.h"
#include "LColor.h"
using boost::shared_ptr;
using std::string;
namespace lyx {
@ -27,47 +29,35 @@ namespace frontend {
ColorCache colorCache;
ColorCache::~ColorCache()
{
clear();
}
Gdk::Color * ColorCache::getColor(LColor_color clr)
{
MapIt it = cache_.find(clr);
return it == cache_.end() ? 0 : it->second;
return it == cache_.end() ? 0 : it->second.get();
}
XftColor * ColorCache::getXftColor(LColor_color clr)
{
MapIt2 it = cache2_.find(clr);
return it == cache2_.end() ? 0 : it->second;
return it == cache2_.end() ? 0 : it->second.get();
}
void ColorCache::cacheColor(LColor_color clr, Gdk::Color * gclr)
{
cache_[clr] = gclr;
cache_[clr] = shared_ptr<Gdk::Color>(gclr);
}
void ColorCache::cacheXftColor(LColor_color clr, XftColor * xclr)
{
cache2_[clr] = xclr;
cache2_[clr] = shared_ptr<XftColor>(xclr);
}
void ColorCache::clear()
{
MapIt it = cache_.begin();
for (; it != cache_.end(); ++it)
delete it->second;
cache_.clear();
MapIt2 it2 = cache2_.begin();
for (; it2 != cache2_.end(); ++it2)
delete it2->second;
cache2_.clear();
}

View File

@ -29,11 +29,10 @@ namespace frontend {
class ColorCache {
public:
typedef std::map<LColor_color, Gdk::Color *> Map;
typedef std::map<LColor_color, boost::shared_ptr<Gdk::Color> > Map;
typedef Map::iterator MapIt;
typedef std::map<LColor_color, XftColor *> Map2;
typedef std::map<LColor_color, boost::shared_ptr<XftColor> > Map2;
typedef Map2::iterator MapIt2;
~ColorCache();
Gdk::Color * getColor(LColor_color);
XftColor * getXftColor(LColor_color);
void cacheColor(LColor_color, Gdk::Color *);

View File

@ -336,16 +336,14 @@ void lyx_gui::start(string const & batch, std::vector<string> const & files)
view.show();
view.init();
// FIXME: some code below needs moving
// FIXME: server code below needs moving
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
os::slashify_path(os::getTmpDir() + "/lyxsocket"));
std::vector<string>::const_iterator cit = files.begin();
std::vector<string>::const_iterator end = files.end();
for (; cit != end; ++cit)
view.view()->loadLyXFile(*cit, true);
for_each(files.begin(), files.end(),
bind(&BufferView::loadLyXFile, view.view(), _1, true));
// handle the batch commands the user asked for
if (!batch.empty()) {