/* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. * * This file is Copyright 1996-1998 * Lars Gullik Bjønnes *
*======================================================*/
// These pixmaps are the same regardless of color: #include"bold_bw.xpm" #include"make_ascii_bw.xpm" #include"make_latex_bw.xpm" #include"run_latex_bw.xpm" #include"sans_bw.xpm" #include"view_dvi_bw.xpm" #include"view_ps_bw.xpm"
// set the bubble-help (Matthias)
obj->u_vdata = (void *) item->help.c_str(); // we need to know what toolbar this item // belongs too. (Lgb)
obj->u_ldata = (long) this;
fl_set_object_posthandler(obj, BubblePost);
fl_set_pixmapbutton_data(obj,item->pixmap);
item = item->next; // we must remember to update the positions
xpos += buttonwidth; // ypos is constant /* Here will come a check to see if the new * pos is within the bounds of the main frame, * and perhaps wrap the toolbar if not.
*/ break;
}
} #if FL_REVISION <86 // Reset borderwidth to its default value.
fl_set_border_width(bw); #endif if (!doingmain) {
fl_end_form();
fl_unfreeze_form(owner->getForm()); // Should be safe to do this here.
owner->updateLayoutChoice();
}
cleaned = false;
}
char **Toolbar::getPixmap(kb_action action, LString const & arg)
{ char **pixmap = unknown_xpm; //NULL switch(action){ case LFUN_MENUOPEN: pixmap = open_xpm; break; case LFUN_CLOSEBUFFER: pixmap = close_xpm; break; case LFUN_MENUPRINT: pixmap = print1_xpm; break; case LFUN_MENUWRITE: pixmap = save_xpm; break; case LFUN_EMPH: pixmap = emph_xpm; break; case LFUN_NOUN: pixmap = noun_xpm; break; case LFUN_FREE: pixmap = free_xpm; break; case LFUN_FOOTMELT: pixmap = foot_xpm; break; case LFUN_DEPTH: pixmap = depth_xpm; break; case LFUN_COPY: pixmap = copy_xpm; break; case LFUN_CUT: pixmap = cut_xpm; break; case LFUN_PASTE: pixmap = paste_xpm; break; case LFUN_TEX: pixmap = tex_xpm; break; case LFUN_MATH_MODE: pixmap = math_xpm; break; case LFUN_MARGINMELT: pixmap = margin_xpm; break; case LFUN_FIGURE: pixmap = fig_xpm; break; case LFUN_TABLE: pixmap = tab_xpm; break; case LFUN_MELT: pixmap = melt_xpm; break; case LFUN_QUIT: pixmap = quit_xpm; break; case LFUN_RUNDVIPS: pixmap = update_ps_xpm; break; case LFUN_EXPORT:
{ if (arg == "ascii")
pixmap = make_ascii_xpm; elseif (arg == "latex")
pixmap = make_latex_xpm;
} break; case LFUN_BOLD : pixmap = bold_xpm; break; case LFUN_SANS: pixmap = sans_xpm; break; case LFUN_RUNLATEX: pixmap = run_latex_xpm; break; case LFUN_PREVIEWPS: pixmap = view_ps_xpm; break; case LFUN_PREVIEW: pixmap = view_dvi_xpm; break; case LFUN_INSERT_MATH:
{ if (!arg.empty())
pixmap = get_pixmap_from_symbol(arg.c_str(),
buttonwidth,
height);
} break; default: //pixmap = unknown_xpm; break;
} return pixmap;
}
// this is what we do if we want to add to an existing // toolbar. if (!doclean && owner) { // first «hide» the toolbar buttons. This is not a real hide // actually it deletes and frees the button altogether.
lyxerr.print("Toolbar::add: «hide» the toolbar buttons.");
toolbarItem *item, *tmp=NULL;
item = toollist;
lightReset();
fl_freeze_form(owner->getForm()); while(item){
tmp = item->next; if (item->icon) {
fl_delete_object(item->icon);
fl_free_object(item->icon);
}
item = tmp;
} if (combox) { delete combox;
combox = 0;
}
fl_unfreeze_form(owner->getForm());
cleaned = true; // this is not completely true, but OK anyway
}
// there exist some special actions not part of // kb_action: SEPARATOR, LAYOUTS char **pixmap = NULL;
LString help;
toolbarItem *newItem,*tmp;
if (lyxaction.isPseudoAction(action)) { charconst *arg;
kb_action act = (kb_action)lyxaction.retrieveActionArg(action, &arg);
pixmap = getPixmap(act, arg);
help = lyxaction.helpText(act);
help += " ";
help += arg;
lyxerr.debug(LString("Pseudo action ") + int(action));
} else {
pixmap = getPixmap((kb_action)action);
help = lyxaction.helpText((kb_action)action);
}
// adds an item to the list if (pixmap != NULL
|| action == TOOL_SEPARATOR
|| action == TOOL_LAYOUTS)
{
newItem = new toolbarItem;
newItem->action = action;
newItem->pixmap = pixmap;
newItem->help = help; // the new item is placed at the end of the list
tmp = toollist; if (tmp != NULL){ while(tmp->next != NULL)
tmp = tmp->next; // here is tmp->next == NULL
tmp->next = newItem;
} else
toollist = newItem;
} //if (action == TOOL_LAYOUTS) { // combox = new Combox(FL_COMBOX_DROPLIST); //}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.