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> 2004-09-27 John Spray <spray_john@users.sourceforge.net>
* The Character dialog * The Character dialog

View File

@ -39,7 +39,7 @@ public:
{ {
add(name); add(name);
} }
Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<Glib::ustring> name;
}; };

View File

@ -129,7 +129,7 @@ void GMathPanel::doBuild()
listStore_ = Gtk::ListStore::create(listCols_); listStore_ = Gtk::ListStore::create(listCols_);
functions_->set_model(listStore_); functions_->set_model(listStore_);
functions_->append_column("Functions", listCol_); functions_->append_column("Functions", listCol_);
listSel_ = functions_->get_selection(); listSel_ = functions_->get_selection();
listSel_->signal_changed().connect( listSel_->signal_changed().connect(
sigc::mem_fun(*this, &GMathPanel::onFunctionSelected)); sigc::mem_fun(*this, &GMathPanel::onFunctionSelected));

View File

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

View File

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

View File

@ -29,11 +29,10 @@ namespace frontend {
class ColorCache { class ColorCache {
public: 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 Map::iterator MapIt;
typedef std::map<LColor_color, XftColor *> Map2; typedef std::map<LColor_color, boost::shared_ptr<XftColor> > Map2;
typedef Map2::iterator MapIt2; typedef Map2::iterator MapIt2;
~ColorCache();
Gdk::Color * getColor(LColor_color); Gdk::Color * getColor(LColor_color);
XftColor * getXftColor(LColor_color); XftColor * getXftColor(LColor_color);
void cacheColor(LColor_color, Gdk::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.show();
view.init(); view.init();
// FIXME: some code below needs moving // FIXME: server code below needs moving
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes); lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
lyxsocket = new LyXServerSocket(&view.getLyXFunc(), lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
os::slashify_path(os::getTmpDir() + "/lyxsocket")); os::slashify_path(os::getTmpDir() + "/lyxsocket"));
std::vector<string>::const_iterator cit = files.begin(); for_each(files.begin(), files.end(),
std::vector<string>::const_iterator end = files.end(); bind(&BufferView::loadLyXFile, view.view(), _1, true));
for (; cit != end; ++cit)
view.view()->loadLyXFile(*cit, true);
// handle the batch commands the user asked for // handle the batch commands the user asked for
if (!batch.empty()) { if (!batch.empty()) {