1999-09-27 18:44:28 +00:00
|
|
|
|
/* This file is part of
|
1999-11-15 12:01:38 +00:00
|
|
|
|
* ======================================================
|
1999-10-07 18:44:17 +00:00
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2000-03-16 04:29:22 +00:00
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
1999-10-07 18:44:17 +00:00
|
|
|
|
*
|
|
|
|
|
* This file is Copyright 1996-1998
|
|
|
|
|
* Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
1999-11-15 12:01:38 +00:00
|
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
// Added pseudo-action handling, asierra 180296
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation "toolbar.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "lyx_main.h"
|
|
|
|
|
#include "lyx_gui_misc.h"
|
|
|
|
|
#include "lyx.h"
|
|
|
|
|
#include "toolbar.h"
|
|
|
|
|
#include "lyxfunc.h"
|
|
|
|
|
#include "lyxlex.h"
|
1999-10-07 18:44:17 +00:00
|
|
|
|
#include "debug.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include "combox.h"
|
|
|
|
|
#include "LyXView.h"
|
1999-11-22 16:19:48 +00:00
|
|
|
|
#include "LyXAction.h"
|
1999-10-02 16:21:10 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2000-07-19 10:22:12 +00:00
|
|
|
|
#include "support/filetools.h"
|
2000-03-12 10:35:05 +00:00
|
|
|
|
#include "lyxrc.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
|
using std::endl;
|
2000-02-15 14:28:15 +00:00
|
|
|
|
|
1999-10-19 15:06:30 +00:00
|
|
|
|
// this one is not "C" because combox callbacks are really C++ %-|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
extern void LayoutsCB(int, void *);
|
1999-12-01 00:57:31 +00:00
|
|
|
|
extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
extern LyXAction lyxaction;
|
|
|
|
|
|
|
|
|
|
|
2000-03-12 10:35:05 +00:00
|
|
|
|
Toolbar::Toolbar(LyXView * o, int x, int y)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
: owner(o), sxpos(x), sypos(y)
|
|
|
|
|
{
|
|
|
|
|
combox = 0;
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#if FL_REVISION < 89
|
1999-09-27 18:44:28 +00:00
|
|
|
|
bubble_timer = 0;
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
|
reset();
|
|
|
|
|
|
2000-03-12 10:35:05 +00:00
|
|
|
|
// extracts the default toolbar actions from LyXRC
|
|
|
|
|
for (ToolbarDefaults::const_iterator cit =
|
|
|
|
|
lyxrc.toolbardefaults.begin();
|
|
|
|
|
cit != lyxrc.toolbardefaults.end(); ++cit) {
|
|
|
|
|
add((*cit));
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr[Debug::TOOLBAR] << "tool action: "
|
2000-03-12 10:35:05 +00:00
|
|
|
|
<< (*cit) << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#if FL_REVISION < 89
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// timer-cb for bubble-help (Matthias)
|
1999-10-25 14:18:30 +00:00
|
|
|
|
void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
|
|
|
|
|
{
|
1999-12-01 00:57:31 +00:00
|
|
|
|
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
|
1999-12-16 06:43:25 +00:00
|
|
|
|
char * help = static_cast<char*>(ob->u_vdata);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
fl_show_oneliner(help, ob->form->x + ob->x,
|
|
|
|
|
ob->form->y + ob->y + ob->h);
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
|
|
|
|
|
extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data)
|
1999-10-25 14:18:30 +00:00
|
|
|
|
{
|
|
|
|
|
Toolbar::BubbleTimerCB(ob, data);
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// post_handler for bubble-help (Matthias)
|
|
|
|
|
int Toolbar::BubblePost(FL_OBJECT *ob, int event,
|
1999-12-16 06:43:25 +00:00
|
|
|
|
FL_Coord /*mx*/, FL_Coord /*my*/,
|
|
|
|
|
int /*key*/, void */*xev*/)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
1999-12-01 00:57:31 +00:00
|
|
|
|
string help = static_cast<char *>(ob->u_vdata);
|
|
|
|
|
Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
if(event == FL_ENTER && !help.empty()){
|
|
|
|
|
fl_set_object_callback(t->bubble_timer,
|
1999-12-13 00:05:34 +00:00
|
|
|
|
C_Toolbar_BubbleTimerCB,
|
|
|
|
|
reinterpret_cast<long>(ob));
|
1999-09-27 18:44:28 +00:00
|
|
|
|
fl_set_timer(t->bubble_timer, 1);
|
|
|
|
|
}
|
|
|
|
|
else if(event != FL_MOTION){
|
|
|
|
|
fl_set_timer(t->bubble_timer, 0);
|
|
|
|
|
fl_hide_oneliner();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
|
|
|
|
|
extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
|
1999-12-16 06:43:25 +00:00
|
|
|
|
FL_Coord /*mx*/, FL_Coord /*my*/,
|
|
|
|
|
int key, void * xev)
|
1999-10-25 14:18:30 +00:00
|
|
|
|
{
|
1999-11-15 12:01:38 +00:00
|
|
|
|
return Toolbar::BubblePost(ob, event, 0, 0, key, xev);
|
1999-10-25 14:18:30 +00:00
|
|
|
|
}
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
void Toolbar::activate()
|
|
|
|
|
{
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * tmp= 0;
|
|
|
|
|
toolbarItem * item = toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
while(item){
|
|
|
|
|
tmp = item->next;
|
|
|
|
|
if (item->icon) {
|
|
|
|
|
fl_activate_object(item->icon);
|
|
|
|
|
}
|
|
|
|
|
item = tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::deactivate()
|
|
|
|
|
{
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * tmp= 0;
|
|
|
|
|
toolbarItem * item = toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
while(item){
|
|
|
|
|
tmp = item->next;
|
|
|
|
|
if (item->icon) {
|
|
|
|
|
fl_deactivate_object(item->icon);
|
|
|
|
|
}
|
|
|
|
|
item = tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
void Toolbar::ToolbarCB(FL_OBJECT * ob, long ac)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#if FL_REVISION >= 89
|
|
|
|
|
Toolbar * t = static_cast<Toolbar*>(ob->u_vdata);
|
|
|
|
|
#else
|
1999-12-01 00:57:31 +00:00
|
|
|
|
Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string res = t->owner->getLyXFunc()->Dispatch(int(ac));
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if(!res.empty())
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr[Debug::TOOLBAR] << res << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
|
|
|
|
|
extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data)
|
1999-10-25 14:18:30 +00:00
|
|
|
|
{
|
|
|
|
|
Toolbar::ToolbarCB(ob, data);
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
|
int Toolbar::get_toolbar_func(string const & func)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
int action = lyxaction.LookupFunc(func.c_str());
|
|
|
|
|
if (action == -1) {
|
1999-12-16 06:43:25 +00:00
|
|
|
|
if (func == "separator"){
|
|
|
|
|
action = TOOL_SEPARATOR;
|
|
|
|
|
} else if (func == "layouts"){
|
1999-09-27 18:44:28 +00:00
|
|
|
|
action = TOOL_LAYOUTS;
|
|
|
|
|
} else action = 0;
|
|
|
|
|
}
|
|
|
|
|
return action;
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-19 10:22:12 +00:00
|
|
|
|
static
|
|
|
|
|
void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height) {
|
|
|
|
|
string name, arg, xpm_name;
|
|
|
|
|
kb_action act;
|
|
|
|
|
|
|
|
|
|
if (lyxaction.isPseudoAction(action)) {
|
|
|
|
|
lyxerr[Debug::TOOLBAR] << "Pseudo action " << action << endl;
|
|
|
|
|
|
|
|
|
|
act = lyxaction.retrieveActionArg(action, arg);
|
|
|
|
|
name = lyxaction.getActionName(act);
|
|
|
|
|
xpm_name = subst(name + ' ' + arg, ' ','_');
|
|
|
|
|
} else {
|
|
|
|
|
act = (kb_action)action;
|
|
|
|
|
name = lyxaction.getActionName(action);
|
|
|
|
|
xpm_name = name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lyxerr[Debug::TOOLBAR] << "Icon name for action " << action
|
|
|
|
|
<< " is `" << xpm_name << "'" << endl;
|
|
|
|
|
|
|
|
|
|
string fullname = LibFileSearch("images", xpm_name, "xpm");
|
|
|
|
|
|
|
|
|
|
if (!fullname.empty()) {
|
|
|
|
|
lyxerr[Debug::TOOLBAR] << "Full icon name is `"
|
|
|
|
|
<< fullname << "'" << endl;
|
|
|
|
|
fl_set_pixmapbutton_file(obj, fullname.c_str());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (act == LFUN_INSERT_MATH && !arg.empty()) {
|
|
|
|
|
lyxerr[Debug::TOOLBAR] << "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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lyxerr << "Unable to find icon `" << xpm_name << "'" << endl;
|
|
|
|
|
fullname = LibFileSearch("images", "unknown", "xpm");
|
|
|
|
|
if (!fullname.empty()) {
|
|
|
|
|
lyxerr[Debug::TOOLBAR] << "Using default `unknown' icon"
|
|
|
|
|
<< endl;
|
|
|
|
|
fl_set_pixmapbutton_file(obj, fullname.c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
void Toolbar::set(bool doingmain)
|
|
|
|
|
{
|
|
|
|
|
// we shouldn't set if we have not cleaned
|
|
|
|
|
if (!cleaned) return;
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
FL_OBJECT * obj;
|
|
|
|
|
toolbarItem * item = toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
if (!doingmain) {
|
|
|
|
|
fl_freeze_form(owner->getForm());
|
|
|
|
|
fl_addto_form(owner->getForm());
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#if FL_REVISION < 89
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// add the time if it don't exist
|
1999-10-02 16:21:10 +00:00
|
|
|
|
if (bubble_timer == 0)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
bubble_timer = fl_add_timer(FL_HIDDEN_TIMER,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
xpos, ypos, 0, 0, "Timer");
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
|
while(item != 0) {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
switch(item->action){
|
1999-12-16 06:43:25 +00:00
|
|
|
|
case TOOL_SEPARATOR:
|
|
|
|
|
xpos += sepspace;
|
|
|
|
|
item = item->next;
|
|
|
|
|
break;
|
|
|
|
|
case TOOL_LAYOUTS:
|
|
|
|
|
xpos += standardspacing;
|
|
|
|
|
if (!combox)
|
|
|
|
|
combox = new Combox(FL_COMBOX_DROPLIST);
|
2000-02-08 15:13:01 +00:00
|
|
|
|
combox->add(xpos, ypos, 135, height, 400);
|
1999-12-16 06:43:25 +00:00
|
|
|
|
combox->setcallback(LayoutsCB);
|
|
|
|
|
combox->resize(FL_RESIZE_ALL);
|
|
|
|
|
combox->gravity(NorthWestGravity, NorthWestGravity);
|
|
|
|
|
item = item->next;
|
|
|
|
|
xpos += 135;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
xpos += standardspacing;
|
|
|
|
|
item->icon = obj =
|
|
|
|
|
fl_add_pixmapbutton(FL_NORMAL_BUTTON,
|
|
|
|
|
xpos, ypos,
|
|
|
|
|
buttonwidth,
|
|
|
|
|
height, "");
|
|
|
|
|
fl_set_object_boxtype(obj, FL_UP_BOX);
|
|
|
|
|
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
|
|
|
|
|
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
|
|
|
|
fl_set_object_gravity(obj,
|
|
|
|
|
NorthWestGravity,
|
|
|
|
|
NorthWestGravity);
|
|
|
|
|
fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
|
|
|
|
|
static_cast<long>(item->action));
|
|
|
|
|
// Remove the blue feedback rectangle
|
|
|
|
|
fl_set_pixmapbutton_focus_outline(obj, 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
// set the bubble-help (Matthias)
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#if FL_REVISION >= 89
|
|
|
|
|
// Set the tooltip
|
|
|
|
|
fl_set_object_helper(obj, item->help.c_str());
|
|
|
|
|
// The toolbar that this object belongs too.
|
|
|
|
|
obj->u_vdata = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
1999-12-17 14:16:05 +00:00
|
|
|
|
#ifdef WITH_WARNINGS
|
1999-12-13 00:05:34 +00:00
|
|
|
|
#warning This is dangerous!
|
1999-12-17 14:16:05 +00:00
|
|
|
|
#endif
|
1999-12-16 06:43:25 +00:00
|
|
|
|
obj->u_vdata = const_cast<char*>(item->help.c_str());
|
|
|
|
|
// we need to know what toolbar this item
|
|
|
|
|
// belongs too. (Lgb)
|
|
|
|
|
obj->u_ldata = reinterpret_cast<long>(this);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-12-16 06:43:25 +00:00
|
|
|
|
|
2000-07-19 10:22:12 +00:00
|
|
|
|
setPixmap(obj, item->action, buttonwidth, height);
|
1999-12-16 06:43:25 +00:00
|
|
|
|
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;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-04 09:38:32 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (!doingmain) {
|
|
|
|
|
fl_end_form();
|
|
|
|
|
fl_unfreeze_form(owner->getForm());
|
|
|
|
|
// Should be safe to do this here.
|
|
|
|
|
owner->updateLayoutChoice();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cleaned = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::add(int action, bool doclean)
|
|
|
|
|
{
|
|
|
|
|
if (doclean && !cleaned) clean();
|
|
|
|
|
|
|
|
|
|
// this is what we do if we want to add to an existing
|
|
|
|
|
// toolbar.
|
|
|
|
|
if (!doclean && owner) {
|
2000-07-19 10:22:12 +00:00
|
|
|
|
// first "hide" the toolbar buttons. This is not a real hide
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// actually it deletes and frees the button altogether.
|
2000-07-19 10:22:12 +00:00
|
|
|
|
lyxerr << "Toolbar::add: \"hide\" the toolbar buttons." << endl;
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * tmp= 0;
|
|
|
|
|
toolbarItem * item = toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * newItem, * tmp;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
// adds an item to the list
|
2000-07-19 10:22:12 +00:00
|
|
|
|
newItem = new toolbarItem;
|
|
|
|
|
newItem->action = action;
|
|
|
|
|
newItem->help = lyxaction.helpText(action);
|
|
|
|
|
// the new item is placed at the end of the list
|
|
|
|
|
tmp = toollist;
|
|
|
|
|
if (tmp != 0){
|
|
|
|
|
while(tmp->next != 0)
|
|
|
|
|
tmp = tmp->next;
|
1999-12-16 06:43:25 +00:00
|
|
|
|
// here is tmp->next == 0
|
2000-07-19 10:22:12 +00:00
|
|
|
|
tmp->next = newItem;
|
2000-02-15 14:28:15 +00:00
|
|
|
|
} else
|
|
|
|
|
toollist = newItem;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::clean()
|
|
|
|
|
{
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * tmp = 0;
|
|
|
|
|
toolbarItem * item = toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
reset();
|
|
|
|
|
|
|
|
|
|
//now delete all the objects..
|
|
|
|
|
if (owner)
|
|
|
|
|
fl_freeze_form(owner->getForm());
|
|
|
|
|
while (item) {
|
|
|
|
|
tmp = item->next;
|
|
|
|
|
delete item;
|
|
|
|
|
item = tmp;
|
|
|
|
|
}
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr[Debug::TOOLBAR] << "Combox: " << combox << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (combox) {
|
|
|
|
|
delete combox;
|
|
|
|
|
combox = 0;
|
|
|
|
|
}
|
|
|
|
|
if (owner)
|
|
|
|
|
fl_unfreeze_form(owner->getForm());
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr[Debug::TOOLBAR] << "toolbar cleaned" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
cleaned = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::push(int nth)
|
|
|
|
|
{
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr[Debug::TOOLBAR] << "Toolbar::push: trying to trigger no `"
|
|
|
|
|
<< nth << '\'' << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
if (nth == 0) return;
|
|
|
|
|
|
1999-12-01 00:57:31 +00:00
|
|
|
|
int count = 0;
|
|
|
|
|
toolbarItem * tmp = toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
while (tmp) {
|
1999-12-16 06:43:25 +00:00
|
|
|
|
++count;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (count == nth) {
|
|
|
|
|
fl_trigger_object(tmp->icon);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
// item nth not found...
|
|
|
|
|
LyXBell();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-03-12 10:35:05 +00:00
|
|
|
|
void Toolbar::add(string const & func, bool doclean)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2000-03-12 10:35:05 +00:00
|
|
|
|
int tf = lyxaction.LookupFunc(func);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-03-12 10:35:05 +00:00
|
|
|
|
if (tf == -1) {
|
|
|
|
|
lyxerr << "Toolbar::add: no LyX command called`"
|
|
|
|
|
<< func << "'exists!" << endl;
|
|
|
|
|
} else {
|
|
|
|
|
add(tf, doclean);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-04 00:19:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Toolbar::reset()
|
|
|
|
|
{
|
|
|
|
|
toollist = 0;
|
|
|
|
|
cleaned = false;
|
|
|
|
|
lightReset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// void Toolbar::lightReset()
|
|
|
|
|
// {
|
|
|
|
|
// standardspacing = 2; // the usual space between items
|
|
|
|
|
// sepspace = 6; // extra space
|
|
|
|
|
// xpos = sxpos - standardspacing;
|
|
|
|
|
// ypos = sypos;
|
|
|
|
|
// buttonwidth = 30; // the standard button width
|
|
|
|
|
// height = 30; // the height of all items in the toolbar
|
|
|
|
|
// }
|