+2000-07-20 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * src/lyxfunc.C (Dispatch): use LyXView::ShowState instead of
+ setting explicitely the minibuffer.
+ * src/BufferView_pimpl.C (workAreaButtonRelease): ditto.
+
+ * src/LyXView.C (showState): new function. Shows font information
+ in minibuffer and update toolbar state.
+ (LyXView): call Toolbar::update after creating the
+ view.
+
+ * src/toolbar.C: change toollist to be a vector instead of a
+ linked list.
+ (BubbleTimerCB): get help string directly from the callback
+ argument of the corresponding icon (which is the action)
+ (set): remove unnecessary ugliness.
+ (update): new function. update the icons (depressed, disabled)
+ depending of the status of the corresponding action.
+
+ * src/toolbar.h: remove help in toolbarItem
+
2000-07-19 Dekel Tsur <dekel@math.tau.ac.il>
* src/Painter.C (text): Added code for using symbol glyphs from
+++ /dev/null
-/* XPM */
-static char const * unknown_xpm[] = {
-/* width height num_colors chars_per_pixel */
-" 20 20 2 1",
-/* colors */
-". c #000000000000",
-"# c #befbbefbbefb",
-/* pixels */
-"####################",
-"####################",
-"####################",
-"####################",
-"####################",
-"########.....#######",
-"#######..##..#######",
-"#######..##..#######",
-"##########..########",
-"########...#########",
-"########..##########",
-"####################",
-"########..##########",
-"########..##########",
-"####################",
-"####################",
-"####################",
-"####################",
-"####################",
-"####################"
-};
-
-
-
--- /dev/null
+/* XPM */
+static char const * unknown_xpm[] = {
+/* width height num_colors chars_per_pixel */
+" 20 20 2 1",
+/* colors */
+". c #000000000000",
+"# c #befbbefbbefb",
+/* pixels */
+"####################",
+"####################",
+"####################",
+"####################",
+"####################",
+"########.....#######",
+"#######..##..#######",
+"#######..##..#######",
+"##########..########",
+"########...#########",
+"########..##########",
+"####################",
+"########..##########",
+"########..##########",
+"####################",
+"####################",
+"####################",
+"####################",
+"####################",
+"####################"
+};
+
+
+
if (button >= 2) return;
bv_->setState();
- owner_->getMiniBuffer()->Set(CurrentState(bv_));
+ owner_->showState();
// Did we hit an editable inset?
if (inset_hit != 0) {
#include "menus.h"
#include "frontends/Dialogs.h"
#include "lyx_gui_misc.h" // [update,Close]AllBufferRelatedDialogs
+#include "bufferview_funcs.h" // CurrentState()
using std::endl;
lyxfunc = new LyXFunc(this);
intl = new Intl;
+ // Make sure the buttons are disabled if needed.
+ toolbar->update();
+
dialogs_ = new Dialogs(this);
// temporary until all dialogs moved into Dialogs.
dialogs_->updateBufferDependent
last_title = title;
}
}
+
+
+void LyXView::showState()
+{
+ getMiniBuffer()->Set(CurrentState(view()));
+ getToolbar()->update();
+}
/// Updates the title of the window
void updateWindowTitle();
+
+ /// Show state (toolbar and font in minibuffer)
+ void showState();
+
/// Reset autosave timer
void resetAutosaveTimer();
private:
/* ---> Everytime the cursor is moved, show the current font state. */
// should this too me moved out of this func?
- //owner->getMiniBuffer()->Set(CurrentState());
+ //owner->showState();
owner->view()->setState();
}
owner->view()->unlockInset(tli);
owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
} else {
tli->UnlockInsetInInset(owner->view(),
tli->GetLockingInset(),true);
case LFUN_BREAKLINE:
owner->view()->text->CursorRight(owner->view());
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_RIGHT:
if (!owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
- owner->getMiniBuffer()->
- Set(CurrentState(owner->view()));
+ owner->showState();
}
return string();
case LFUN_LEFT:
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
- owner->getMiniBuffer()->
- Set(CurrentState(owner->view()));
+ owner->showState();
}
return string();
case LFUN_DOWN:
owner->view()->text->CursorDown(owner->view());
moveCursorUpdate(false);
- owner->getMiniBuffer()->
- Set(CurrentState(owner->view()));
+ owner->showState();
return string();
default:
break;
case LFUN_FREE:
Free(owner->view());
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_TEX:
Tex(owner->view());
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
#ifndef NEW_INSETS
case LFUN_MELT:
case LFUN_LANGUAGE:
Lang(owner->view(), argument);
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_EMPH:
Emph(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_BOLD:
Bold(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_NOUN:
Noun(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_CODE:
Code(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_SANS:
Sans(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_ROMAN:
Roman(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_DEFAULT:
StyleReset(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_UNDERLINE:
Underline(owner->view());
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_FONT_SIZE:
FontSize(owner->view(), argument);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_FONT_STATE:
tmptext->CursorRight(owner->view(), false);
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
}
break;
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
}
break;
owner->view()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_DOWN:
owner->view()->text->CursorDown(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_UP_PARAGRAPH:
owner->view()->text->CursorUpParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_DOWN_PARAGRAPH:
owner->view()->text->CursorDownParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_PRIOR:
owner->view()->cursorPrevious();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_NEXT:
owner->view()->cursorNext();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_HOME:
owner->view()->text->CursorHome(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_END:
owner->view()->text->CursorEnd(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_SHIFT_TAB:
owner->view()->text->CursorTab(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_WORDRIGHT:
owner->view()->text->CursorRightOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_WORDLEFT:
owner->view()->text->CursorLeftOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_BEGINNINGBUF:
owner->view()->text->CursorTop(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_ENDBUF:
owner->view()->text->CursorBottom(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
owner->view()->text->CursorRight(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_LEFTSEL:
owner->view()->text->CursorLeft(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_UPSEL:
owner->view()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_DOWNSEL:
owner->view()->text->CursorDown(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_UP_PARAGRAPHSEL:
owner->view()->text->CursorUpParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_DOWN_PARAGRAPHSEL:
owner->view()->text->CursorDownParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_PRIORSEL:
owner->view()->cursorPrevious();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_NEXTSEL:
owner->view()->cursorNext();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_HOMESEL:
owner->view()->text->CursorHome(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_ENDSEL:
owner->view()->text->CursorEnd(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_WORDRIGHTSEL:
owner->view()->text->CursorRightOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_WORDLEFTSEL:
owner->view()->text->CursorLeftOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_BEGINNINGBUFSEL:
owner->view()->text->CursorTop(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
case LFUN_ENDBUFSEL:
owner->view()->text->CursorBottom(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
// --- text changing commands ------------------------
owner->view()->cut();
}
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
owner->view()->setState();
break;
owner->view()->text->DeleteWordForward(owner->view());
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
/* -------> Delete word backward. */
owner->view()->text->DeleteWordBackward(owner->view());
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
/* -------> Kill to end of line. */
} else {
owner->view()->cut();
}
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
owner->view()->setState();
}
break;
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
}
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
break;
}
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->text->sel_cursor = cursor;
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ owner->showState();
}
break;
void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
{
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
- char * help = static_cast<char*>(ob->u_vdata);
- fl_show_oneliner(help, ob->form->x + ob->x,
+ // The trick we use to get the help text is to read the
+ // argument of the callback that has been registered for
+ // ToolBarCB. (JMarc)
+ string help = lyxaction.helpText(ob->argument);
+ fl_show_oneliner(help.c_str(), ob->form->x + ob->x,
ob->form->y + ob->y + ob->h);
}
FL_Coord /*mx*/, FL_Coord /*my*/,
int /*key*/, void */*xev*/)
{
- string help = static_cast<char *>(ob->u_vdata);
- Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
+ Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_vdata);
- if(event == FL_ENTER && !help.empty()){
+ // We do not test for empty help here, since this can never happen
+ if(event == FL_ENTER){
fl_set_object_callback(t->bubble_timer,
C_Toolbar_BubbleTimerCB,
reinterpret_cast<long>(ob));
void Toolbar::activate()
{
- toolbarItem * tmp= 0;
- toolbarItem * item = toollist;
- while(item){
- tmp = item->next;
- if (item->icon) {
- fl_activate_object(item->icon);
+ ToolbarList::const_iterator p = toollist.begin();
+ for (; p != toollist.end(); ++p) {
+ if (p->icon) {
+ fl_activate_object(p->icon);
}
- item = tmp;
}
}
void Toolbar::deactivate()
{
- toolbarItem * tmp= 0;
- toolbarItem * item = toollist;
- while(item){
- tmp = item->next;
- if (item->icon) {
- fl_deactivate_object(item->icon);
+ ToolbarList::const_iterator p = toollist.begin();
+ for (; p != toollist.end(); ++p) {
+ if (p->icon) {
+ fl_deactivate_object(p->icon);
+ }
+ }
+}
+
+void Toolbar::update()
+{
+ ToolbarList::const_iterator p = toollist.begin();
+ for (; p != toollist.end(); ++p) {
+ if (p->icon) {
+ int status = owner->getLyXFunc()->getStatus(p->action);
+ if (status & LyXFunc::ToggleOn) {
+ // I'd like to use a different color
+ // here, but then the problem is to
+ // know how to use transparency with
+ // Xpm library. It seems pretty
+ // complicated to me (JMarc)
+ fl_set_object_boxtype(p->icon, FL_DOWN_BOX);
+ } else {
+ fl_set_object_boxtype(p->icon, FL_UP_BOX);
+ }
+
+ if (status & LyXFunc::Disabled) {
+ // Is there a way here to specify a
+ // mask in order to show that the
+ // button is disabled? (JMarc)
+ fl_deactivate_object(p->icon);
+ }
+ else
+ fl_activate_object(p->icon);
}
- item = tmp;
}
}
void Toolbar::ToolbarCB(FL_OBJECT * ob, long ac)
{
-#if FL_REVISION >= 89
Toolbar * t = static_cast<Toolbar*>(ob->u_vdata);
-#else
- Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
-#endif
string res = t->owner->getLyXFunc()->Dispatch(int(ac));
if(!res.empty())
if (!cleaned) return;
FL_OBJECT * obj;
- toolbarItem * item = toollist;
if (!doingmain) {
fl_freeze_form(owner->getForm());
xpos, ypos, 0, 0, "Timer");
#endif
- while(item != 0) {
+ ToolbarList::iterator item = toollist.begin();
+ for (; item != toollist.end(); ++item) {
switch(item->action){
case TOOL_SEPARATOR:
xpos += sepspace;
- item = item->next;
break;
case TOOL_LAYOUTS:
xpos += standardspacing;
combox->setcallback(LayoutsCB);
combox->resize(FL_RESIZE_ALL);
combox->gravity(NorthWestGravity, NorthWestGravity);
- item = item->next;
xpos += 135;
break;
default:
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));
+ fl_set_object_color(obj, FL_MCOL, FL_BLUE);
// Remove the blue feedback rectangle
fl_set_pixmapbutton_focus_outline(obj, 0);
- // set the bubble-help (Matthias)
-#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;
-
-
+#if FL_REVISION >= 89
+ string help = lyxaction.helpText(action);
+ fl_set_object_helper(obj, help.c_str());
#else
-#ifdef WITH_WARNINGS
-#warning This is dangerous!
-#endif
- 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);
-
fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
#endif
+ // The toolbar that this object belongs too.
+ obj->u_vdata = this;
+
setPixmap(obj, item->action, buttonwidth, height);
- item = item->next;
// we must remember to update the positions
xpos += buttonwidth;
// ypos is constant
// Should be safe to do this here.
owner->updateLayoutChoice();
}
-
+
+ // set the state of the icons
+ //update();
+
cleaned = false;
}
if (!doclean && owner) {
// first "hide" the toolbar buttons. This is not a real hide
// actually it deletes and frees the button altogether.
- lyxerr << "Toolbar::add: \"hide\" the toolbar buttons." << endl;
- toolbarItem * tmp= 0;
- toolbarItem * item = toollist;
+ lyxerr << "Toolbar::add: \"hide\" the toolbar buttons."
+ << endl;
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;
+
+ ToolbarList::iterator p = toollist.begin();
+ for (; p != toollist.end(); ++p) {
+ p->clean();
}
+
if (combox) {
delete combox;
combox = 0;
// there exist some special actions not part of
// kb_action: SEPARATOR, LAYOUTS
- toolbarItem * newItem, * tmp;
-
- // adds an item to the list
- 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;
- // here is tmp->next == 0
- tmp->next = newItem;
- } else
- toollist = newItem;
+ toolbarItem newItem;
+ newItem.action = action;
+ toollist.push_back(newItem);
}
void Toolbar::clean()
{
- toolbarItem * tmp = 0;
- toolbarItem * item = toollist;
-
- reset();
+ //reset(); // I do not understand what this reset() is, anyway
//now delete all the objects..
if (owner)
fl_freeze_form(owner->getForm());
- while (item) {
- tmp = item->next;
- delete item;
- item = tmp;
- }
+
+ // G++ vector does not have clear defined
+ //toollist.clear();
+ toollist.erase(toollist.begin(), toollist.end());
+
lyxerr[Debug::TOOLBAR] << "Combox: " << combox << endl;
if (combox) {
delete combox;
combox = 0;
}
+
if (owner)
fl_unfreeze_form(owner->getForm());
lyxerr[Debug::TOOLBAR] << "toolbar cleaned" << endl;
lyxerr[Debug::TOOLBAR] << "Toolbar::push: trying to trigger no `"
<< nth << '\'' << endl;
- if (nth == 0) return;
-
- int count = 0;
- toolbarItem * tmp = toollist;
- while (tmp) {
- ++count;
- if (count == nth) {
- fl_trigger_object(tmp->icon);
- return;
- }
- tmp = tmp->next;
+ if (nth <= 0 || nth >= int(toollist.size())) {
+ // item nth not found...
+ LyXBell();
+ return;
}
- // item nth not found...
- LyXBell();
+
+ fl_trigger_object(toollist[nth - 1].icon);
}
void Toolbar::reset()
{
- toollist = 0;
+ //toollist = 0; // what is this supposed to do?
cleaned = false;
lightReset();
}
#pragma interface
#endif
+#include <vector>
#include FORMS_H_LOCATION
#include "lyxfunc.h"
#include "combox.h"
void activate();
/// deactivates the toolbar
void deactivate();
-
+ /// update the state of the icons
+ void update();
///
static void ToolbarCB(FL_OBJECT *, long);
///
struct toolbarItem
{
- ///
- toolbarItem * next;
///
int action;
///
- string help;
- ///
FL_OBJECT * icon;
///
toolbarItem() {
- next = 0;
action = LFUN_NOACTION;
icon = 0;
}
///
- ~toolbarItem() {
+ void clean() {
if (icon) {
fl_delete_object(icon);
fl_free_object(icon);
+ icon = 0;
}
}
+ ///
+ ~toolbarItem() {
+ clean();
+ }
+ toolbarItem & operator=(const toolbarItem & ti) {
+ // do we have to check icon and IsBitmap too?
+ action = ti.action;
+ icon = 0; // locally we need to get the icon anew
+
+ return *this;
+ }
};
- /// a list containing all the buttons
- toolbarItem * toollist;
+ /// typedef to simplify things
+ typedef std::vector<toolbarItem> ToolbarList;
+ /// The list containing all the buttons
+ ToolbarList toollist;
///
LyXView * owner;
#if FL_REVISION < 89