using std::endl;
// this one is not "C" because combox callbacks are really C++ %-|
-extern void LayoutsCB(int, void *);
+extern void LayoutsCB(int, void *, Combox *);
extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
extern LyXAction lyxaction;
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;
+
+ // If we already have an icon, release it.
+ clean();
+
// do we have to check icon too?
action = ti.action;
icon = 0; // locally we need to get the icon anew
void Toolbar::Pimpl::activate()
{
ToolbarList::const_iterator p = toollist.begin();
- for (; p != toollist.end(); ++p) {
+ ToolbarList::const_iterator end = toollist.end();
+ for (; p != end; ++p) {
if (p->icon) {
fl_activate_object(p->icon);
}
void Toolbar::Pimpl::deactivate()
{
ToolbarList::const_iterator p = toollist.begin();
- for (; p != toollist.end(); ++p) {
+ ToolbarList::const_iterator end = toollist.end();
+ for (; p != end; ++p) {
if (p->icon) {
fl_deactivate_object(p->icon);
}
void Toolbar::Pimpl::update()
{
ToolbarList::const_iterator p = toollist.begin();
- for (; p != toollist.end(); ++p) {
+ ToolbarList::const_iterator end = toollist.end();
+ for (; p != end; ++p) {
if (p->icon) {
int status = owner->getLyXFunc()->getStatus(p->action);
if (status & LyXFunc::ToggleOn) {
LyXTextClass const & tc =
textclasslist.TextClass(owner->buffer()->
params.textclass);
+ LyXTextClass::const_iterator end = tc.end();
for (LyXTextClass::const_iterator cit = tc.begin();
- cit != tc.end(); ++cit) {
+ cit != end; ++cit) {
if ((*cit).obsoleted_by().empty())
- combox->addline(_((*cit).name().c_str()));
+ combox->addline(_((*cit).name()));
else
- combox->addline(("@N" + string(_((*cit).name().c_str()))).c_str());
+ combox->addline("@N" + _((*cit).name()));
}
}
// we need to do this.
combox->Redraw();
}
+
void Toolbar::Pimpl::clearLayoutList()
{
if (combox) {
}
}
+
void Toolbar::Pimpl::openLayoutList()
{
if (combox)
combox->Show();
}
+
static
void ToolbarCB(FL_OBJECT * ob, long ac)
{
ToolbarCB(ob, data);
}
+
#if 0
// What are we supposed to do with that??
int Toolbar::get_toolbar_func(string const & func)
{
- int action = lyxaction.LookupFunc(func.c_str());
+ int action = lyxaction.LookupFunc(func);
if (action == -1) {
if (func == "separator"){
action = TOOL_SEPARATOR;
}
if (act == LFUN_INSERT_MATH && !arg.empty()) {
- lyxerr[Debug::GUI] << "Using mathed-provided icon" << endl;
char const ** pixmap = get_pixmap_from_symbol(arg.c_str(),
buttonwidth,
height);
- fl_set_pixmapbutton_data(obj, const_cast<char **>(pixmap));
- return;
+ if (pixmap) {
+ lyxerr[Debug::GUI] << "Using mathed-provided icon"
+ << endl;
+ fl_set_pixmapbutton_data(obj,
+ const_cast<char **>(pixmap));
+ return;
+ }
}
lyxerr << "Unable to find icon `" << xpm_name << "'" << endl;
#endif
ToolbarList::iterator item = toollist.begin();
- for (; item != toollist.end(); ++item) {
+ ToolbarList::iterator end = toollist.end();
+ for (; item != end; ++item) {
switch(item->action){
case ToolbarDefaults::SEPARATOR:
xpos += sepspace;
fl_freeze_form(owner->getForm());
ToolbarList::iterator p = toollist.begin();
- for (; p != toollist.end(); ++p) {
+ ToolbarList::iterator end = toollist.end();
+ for (; p != end; ++p) {
p->clean();
}