mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 06:15:16 +00:00
More cleanups of the toolbar. The buttons are now toggled/disabled when needed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@905 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2984f46a03
commit
2fe7465d03
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
|||||||
|
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>
|
2000-07-19 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
* src/Painter.C (text): Added code for using symbol glyphs from
|
* src/Painter.C (text): Added code for using symbol glyphs from
|
||||||
|
@ -754,7 +754,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
|||||||
if (button >= 2) return;
|
if (button >= 2) return;
|
||||||
|
|
||||||
bv_->setState();
|
bv_->setState();
|
||||||
owner_->getMiniBuffer()->Set(CurrentState(bv_));
|
owner_->showState();
|
||||||
|
|
||||||
// Did we hit an editable inset?
|
// Did we hit an editable inset?
|
||||||
if (inset_hit != 0) {
|
if (inset_hit != 0) {
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "lyx_gui_misc.h" // [update,Close]AllBufferRelatedDialogs
|
#include "lyx_gui_misc.h" // [update,Close]AllBufferRelatedDialogs
|
||||||
|
#include "bufferview_funcs.h" // CurrentState()
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
@ -63,6 +64,9 @@ LyXView::LyXView(int width, int height)
|
|||||||
lyxfunc = new LyXFunc(this);
|
lyxfunc = new LyXFunc(this);
|
||||||
intl = new Intl;
|
intl = new Intl;
|
||||||
|
|
||||||
|
// Make sure the buttons are disabled if needed.
|
||||||
|
toolbar->update();
|
||||||
|
|
||||||
dialogs_ = new Dialogs(this);
|
dialogs_ = new Dialogs(this);
|
||||||
// temporary until all dialogs moved into Dialogs.
|
// temporary until all dialogs moved into Dialogs.
|
||||||
dialogs_->updateBufferDependent
|
dialogs_->updateBufferDependent
|
||||||
@ -440,3 +444,10 @@ void LyXView::updateWindowTitle()
|
|||||||
last_title = title;
|
last_title = title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXView::showState()
|
||||||
|
{
|
||||||
|
getMiniBuffer()->Set(CurrentState(view()));
|
||||||
|
getToolbar()->update();
|
||||||
|
}
|
||||||
|
@ -92,6 +92,10 @@ public:
|
|||||||
/// Updates the title of the window
|
/// Updates the title of the window
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
|
|
||||||
|
|
||||||
|
/// Show state (toolbar and font in minibuffer)
|
||||||
|
void showState();
|
||||||
|
|
||||||
/// Reset autosave timer
|
/// Reset autosave timer
|
||||||
void resetAutosaveTimer();
|
void resetAutosaveTimer();
|
||||||
private:
|
private:
|
||||||
|
111
src/lyxfunc.C
111
src/lyxfunc.C
@ -179,7 +179,7 @@ void LyXFunc::moveCursorUpdate(bool selecting)
|
|||||||
|
|
||||||
/* ---> Everytime the cursor is moved, show the current font state. */
|
/* ---> Everytime the cursor is moved, show the current font state. */
|
||||||
// should this too me moved out of this func?
|
// should this too me moved out of this func?
|
||||||
//owner->getMiniBuffer()->Set(CurrentState());
|
//owner->showState();
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
|
|||||||
owner->view()->unlockInset(tli);
|
owner->view()->unlockInset(tli);
|
||||||
owner->view()->text->CursorRight(owner->view());
|
owner->view()->text->CursorRight(owner->view());
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
} else {
|
} else {
|
||||||
tli->UnlockInsetInInset(owner->view(),
|
tli->UnlockInsetInInset(owner->view(),
|
||||||
tli->GetLockingInset(),true);
|
tli->GetLockingInset(),true);
|
||||||
@ -593,29 +593,26 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_BREAKLINE:
|
case LFUN_BREAKLINE:
|
||||||
owner->view()->text->CursorRight(owner->view());
|
owner->view()->text->CursorRight(owner->view());
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
case LFUN_RIGHT:
|
case LFUN_RIGHT:
|
||||||
if (!owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
if (!owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
||||||
owner->view()->text->CursorRight(owner->view());
|
owner->view()->text->CursorRight(owner->view());
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->
|
owner->showState();
|
||||||
Set(CurrentState(owner->view()));
|
|
||||||
}
|
}
|
||||||
return string();
|
return string();
|
||||||
case LFUN_LEFT:
|
case LFUN_LEFT:
|
||||||
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
|
||||||
owner->view()->text->CursorRight(owner->view());
|
owner->view()->text->CursorRight(owner->view());
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->
|
owner->showState();
|
||||||
Set(CurrentState(owner->view()));
|
|
||||||
}
|
}
|
||||||
return string();
|
return string();
|
||||||
case LFUN_DOWN:
|
case LFUN_DOWN:
|
||||||
owner->view()->text->CursorDown(owner->view());
|
owner->view()->text->CursorDown(owner->view());
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->
|
owner->showState();
|
||||||
Set(CurrentState(owner->view()));
|
|
||||||
return string();
|
return string();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -999,13 +996,13 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_FREE:
|
case LFUN_FREE:
|
||||||
Free(owner->view());
|
Free(owner->view());
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_TEX:
|
case LFUN_TEX:
|
||||||
Tex(owner->view());
|
Tex(owner->view());
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
case LFUN_MELT:
|
case LFUN_MELT:
|
||||||
@ -1228,52 +1225,52 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_LANGUAGE:
|
case LFUN_LANGUAGE:
|
||||||
Lang(owner->view(), argument);
|
Lang(owner->view(), argument);
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_EMPH:
|
case LFUN_EMPH:
|
||||||
Emph(owner->view());
|
Emph(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BOLD:
|
case LFUN_BOLD:
|
||||||
Bold(owner->view());
|
Bold(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_NOUN:
|
case LFUN_NOUN:
|
||||||
Noun(owner->view());
|
Noun(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CODE:
|
case LFUN_CODE:
|
||||||
Code(owner->view());
|
Code(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_SANS:
|
case LFUN_SANS:
|
||||||
Sans(owner->view());
|
Sans(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ROMAN:
|
case LFUN_ROMAN:
|
||||||
Roman(owner->view());
|
Roman(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DEFAULT:
|
case LFUN_DEFAULT:
|
||||||
StyleReset(owner->view());
|
StyleReset(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_UNDERLINE:
|
case LFUN_UNDERLINE:
|
||||||
Underline(owner->view());
|
Underline(owner->view());
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_FONT_SIZE:
|
case LFUN_FONT_SIZE:
|
||||||
FontSize(owner->view(), argument);
|
FontSize(owner->view(), argument);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_FONT_STATE:
|
case LFUN_FONT_STATE:
|
||||||
@ -1381,7 +1378,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
tmptext->CursorRight(owner->view(), false);
|
tmptext->CursorRight(owner->view(), false);
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1417,7 +1414,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1427,7 +1424,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorUp(owner->view());
|
owner->view()->text->CursorUp(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DOWN:
|
case LFUN_DOWN:
|
||||||
@ -1437,7 +1434,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorDown(owner->view());
|
owner->view()->text->CursorDown(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_UP_PARAGRAPH:
|
case LFUN_UP_PARAGRAPH:
|
||||||
@ -1447,7 +1444,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorUpParagraph(owner->view());
|
owner->view()->text->CursorUpParagraph(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DOWN_PARAGRAPH:
|
case LFUN_DOWN_PARAGRAPH:
|
||||||
@ -1457,7 +1454,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorDownParagraph(owner->view());
|
owner->view()->text->CursorDownParagraph(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_PRIOR:
|
case LFUN_PRIOR:
|
||||||
@ -1467,7 +1464,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->cursorPrevious();
|
owner->view()->cursorPrevious();
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_NEXT:
|
case LFUN_NEXT:
|
||||||
@ -1477,7 +1474,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->cursorNext();
|
owner->view()->cursorNext();
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_HOME:
|
case LFUN_HOME:
|
||||||
@ -1487,7 +1484,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorHome(owner->view());
|
owner->view()->text->CursorHome(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_END:
|
case LFUN_END:
|
||||||
@ -1497,7 +1494,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorEnd(owner->view());
|
owner->view()->text->CursorEnd(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_SHIFT_TAB:
|
case LFUN_SHIFT_TAB:
|
||||||
@ -1508,7 +1505,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorTab(owner->view());
|
owner->view()->text->CursorTab(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_WORDRIGHT:
|
case LFUN_WORDRIGHT:
|
||||||
@ -1521,7 +1518,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorRightOneWord(owner->view());
|
owner->view()->text->CursorRightOneWord(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_WORDLEFT:
|
case LFUN_WORDLEFT:
|
||||||
@ -1534,7 +1531,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorLeftOneWord(owner->view());
|
owner->view()->text->CursorLeftOneWord(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BEGINNINGBUF:
|
case LFUN_BEGINNINGBUF:
|
||||||
@ -1544,7 +1541,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorTop(owner->view());
|
owner->view()->text->CursorTop(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ENDBUF:
|
case LFUN_ENDBUF:
|
||||||
@ -1554,7 +1551,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorBottom(owner->view());
|
owner->view()->text->CursorBottom(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@ -1567,7 +1564,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorRight(owner->view());
|
owner->view()->text->CursorRight(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_LEFTSEL:
|
case LFUN_LEFTSEL:
|
||||||
@ -1578,7 +1575,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorLeft(owner->view());
|
owner->view()->text->CursorLeft(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_UPSEL:
|
case LFUN_UPSEL:
|
||||||
@ -1586,7 +1583,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorUp(owner->view());
|
owner->view()->text->CursorUp(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DOWNSEL:
|
case LFUN_DOWNSEL:
|
||||||
@ -1594,7 +1591,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorDown(owner->view());
|
owner->view()->text->CursorDown(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_UP_PARAGRAPHSEL:
|
case LFUN_UP_PARAGRAPHSEL:
|
||||||
@ -1602,7 +1599,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorUpParagraph(owner->view());
|
owner->view()->text->CursorUpParagraph(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DOWN_PARAGRAPHSEL:
|
case LFUN_DOWN_PARAGRAPHSEL:
|
||||||
@ -1610,7 +1607,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorDownParagraph(owner->view());
|
owner->view()->text->CursorDownParagraph(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_PRIORSEL:
|
case LFUN_PRIORSEL:
|
||||||
@ -1618,7 +1615,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->cursorPrevious();
|
owner->view()->cursorPrevious();
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_NEXTSEL:
|
case LFUN_NEXTSEL:
|
||||||
@ -1626,7 +1623,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->cursorNext();
|
owner->view()->cursorNext();
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_HOMESEL:
|
case LFUN_HOMESEL:
|
||||||
@ -1634,7 +1631,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorHome(owner->view());
|
owner->view()->text->CursorHome(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ENDSEL:
|
case LFUN_ENDSEL:
|
||||||
@ -1642,7 +1639,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorEnd(owner->view());
|
owner->view()->text->CursorEnd(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_WORDRIGHTSEL:
|
case LFUN_WORDRIGHTSEL:
|
||||||
@ -1653,7 +1650,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorRightOneWord(owner->view());
|
owner->view()->text->CursorRightOneWord(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_WORDLEFTSEL:
|
case LFUN_WORDLEFTSEL:
|
||||||
@ -1664,7 +1661,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorLeftOneWord(owner->view());
|
owner->view()->text->CursorLeftOneWord(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BEGINNINGBUFSEL:
|
case LFUN_BEGINNINGBUFSEL:
|
||||||
@ -1672,7 +1669,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorTop(owner->view());
|
owner->view()->text->CursorTop(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ENDBUFSEL:
|
case LFUN_ENDBUFSEL:
|
||||||
@ -1680,7 +1677,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->CursorBottom(owner->view());
|
owner->view()->text->CursorBottom(owner->view());
|
||||||
owner->view()->text->FinishUndo();
|
owner->view()->text->FinishUndo();
|
||||||
moveCursorUpdate(true);
|
moveCursorUpdate(true);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// --- text changing commands ------------------------
|
// --- text changing commands ------------------------
|
||||||
@ -1735,7 +1732,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->cut();
|
owner->view()->cut();
|
||||||
}
|
}
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1789,7 +1786,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->DeleteWordForward(owner->view());
|
owner->view()->text->DeleteWordForward(owner->view());
|
||||||
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* -------> Delete word backward. */
|
/* -------> Delete word backward. */
|
||||||
@ -1798,7 +1795,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->DeleteWordBackward(owner->view());
|
owner->view()->text->DeleteWordBackward(owner->view());
|
||||||
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
moveCursorUpdate(false);
|
moveCursorUpdate(false);
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* -------> Kill to end of line. */
|
/* -------> Kill to end of line. */
|
||||||
@ -1843,7 +1840,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
} else {
|
} else {
|
||||||
owner->view()->cut();
|
owner->view()->cut();
|
||||||
}
|
}
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1887,7 +1884,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->sel_cursor =
|
owner->view()->text->sel_cursor =
|
||||||
owner->view()->text->cursor;
|
owner->view()->text->cursor;
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,7 +1896,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->text->sel_cursor =
|
owner->view()->text->sel_cursor =
|
||||||
owner->view()->text->cursor;
|
owner->view()->text->cursor;
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1934,7 +1931,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
owner->view()->text->sel_cursor = cursor;
|
owner->view()->text->sel_cursor = cursor;
|
||||||
owner->view()->setState();
|
owner->view()->setState();
|
||||||
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
|
owner->showState();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
174
src/toolbar.C
174
src/toolbar.C
@ -66,8 +66,11 @@ Toolbar::Toolbar(LyXView * o, int x, int y)
|
|||||||
void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
|
void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
|
||||||
{
|
{
|
||||||
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
|
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
|
||||||
char * help = static_cast<char*>(ob->u_vdata);
|
// The trick we use to get the help text is to read the
|
||||||
fl_show_oneliner(help, ob->form->x + ob->x,
|
// 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);
|
ob->form->y + ob->y + ob->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,10 +86,10 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
|
|||||||
FL_Coord /*mx*/, FL_Coord /*my*/,
|
FL_Coord /*mx*/, FL_Coord /*my*/,
|
||||||
int /*key*/, void */*xev*/)
|
int /*key*/, void */*xev*/)
|
||||||
{
|
{
|
||||||
string help = static_cast<char *>(ob->u_vdata);
|
Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_vdata);
|
||||||
Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
|
|
||||||
|
|
||||||
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,
|
fl_set_object_callback(t->bubble_timer,
|
||||||
C_Toolbar_BubbleTimerCB,
|
C_Toolbar_BubbleTimerCB,
|
||||||
reinterpret_cast<long>(ob));
|
reinterpret_cast<long>(ob));
|
||||||
@ -111,39 +114,58 @@ extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
|
|||||||
|
|
||||||
void Toolbar::activate()
|
void Toolbar::activate()
|
||||||
{
|
{
|
||||||
toolbarItem * tmp= 0;
|
ToolbarList::const_iterator p = toollist.begin();
|
||||||
toolbarItem * item = toollist;
|
for (; p != toollist.end(); ++p) {
|
||||||
while(item){
|
if (p->icon) {
|
||||||
tmp = item->next;
|
fl_activate_object(p->icon);
|
||||||
if (item->icon) {
|
|
||||||
fl_activate_object(item->icon);
|
|
||||||
}
|
}
|
||||||
item = tmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::deactivate()
|
void Toolbar::deactivate()
|
||||||
{
|
{
|
||||||
toolbarItem * tmp= 0;
|
ToolbarList::const_iterator p = toollist.begin();
|
||||||
toolbarItem * item = toollist;
|
for (; p != toollist.end(); ++p) {
|
||||||
while(item){
|
if (p->icon) {
|
||||||
tmp = item->next;
|
fl_deactivate_object(p->icon);
|
||||||
if (item->icon) {
|
}
|
||||||
fl_deactivate_object(item->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)
|
void Toolbar::ToolbarCB(FL_OBJECT * ob, long ac)
|
||||||
{
|
{
|
||||||
#if FL_REVISION >= 89
|
|
||||||
Toolbar * t = static_cast<Toolbar*>(ob->u_vdata);
|
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));
|
string res = t->owner->getLyXFunc()->Dispatch(int(ac));
|
||||||
if(!res.empty())
|
if(!res.empty())
|
||||||
@ -223,7 +245,6 @@ void Toolbar::set(bool doingmain)
|
|||||||
if (!cleaned) return;
|
if (!cleaned) return;
|
||||||
|
|
||||||
FL_OBJECT * obj;
|
FL_OBJECT * obj;
|
||||||
toolbarItem * item = toollist;
|
|
||||||
|
|
||||||
if (!doingmain) {
|
if (!doingmain) {
|
||||||
fl_freeze_form(owner->getForm());
|
fl_freeze_form(owner->getForm());
|
||||||
@ -237,11 +258,11 @@ void Toolbar::set(bool doingmain)
|
|||||||
xpos, ypos, 0, 0, "Timer");
|
xpos, ypos, 0, 0, "Timer");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(item != 0) {
|
ToolbarList::iterator item = toollist.begin();
|
||||||
|
for (; item != toollist.end(); ++item) {
|
||||||
switch(item->action){
|
switch(item->action){
|
||||||
case TOOL_SEPARATOR:
|
case TOOL_SEPARATOR:
|
||||||
xpos += sepspace;
|
xpos += sepspace;
|
||||||
item = item->next;
|
|
||||||
break;
|
break;
|
||||||
case TOOL_LAYOUTS:
|
case TOOL_LAYOUTS:
|
||||||
xpos += standardspacing;
|
xpos += standardspacing;
|
||||||
@ -251,7 +272,6 @@ void Toolbar::set(bool doingmain)
|
|||||||
combox->setcallback(LayoutsCB);
|
combox->setcallback(LayoutsCB);
|
||||||
combox->resize(FL_RESIZE_ALL);
|
combox->resize(FL_RESIZE_ALL);
|
||||||
combox->gravity(NorthWestGravity, NorthWestGravity);
|
combox->gravity(NorthWestGravity, NorthWestGravity);
|
||||||
item = item->next;
|
|
||||||
xpos += 135;
|
xpos += 135;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -261,39 +281,28 @@ void Toolbar::set(bool doingmain)
|
|||||||
xpos, ypos,
|
xpos, ypos,
|
||||||
buttonwidth,
|
buttonwidth,
|
||||||
height, "");
|
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_resize(obj, FL_RESIZE_ALL);
|
||||||
fl_set_object_gravity(obj,
|
fl_set_object_gravity(obj,
|
||||||
NorthWestGravity,
|
NorthWestGravity,
|
||||||
NorthWestGravity);
|
NorthWestGravity);
|
||||||
fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
|
fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
|
||||||
static_cast<long>(item->action));
|
static_cast<long>(item->action));
|
||||||
|
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
|
||||||
// Remove the blue feedback rectangle
|
// Remove the blue feedback rectangle
|
||||||
fl_set_pixmapbutton_focus_outline(obj, 0);
|
fl_set_pixmapbutton_focus_outline(obj, 0);
|
||||||
|
|
||||||
// set the bubble-help (Matthias)
|
|
||||||
#if FL_REVISION >= 89
|
|
||||||
// Set the tooltip
|
// Set the tooltip
|
||||||
fl_set_object_helper(obj, item->help.c_str());
|
#if FL_REVISION >= 89
|
||||||
// The toolbar that this object belongs too.
|
string help = lyxaction.helpText(action);
|
||||||
obj->u_vdata = this;
|
fl_set_object_helper(obj, help.c_str());
|
||||||
|
|
||||||
|
|
||||||
#else
|
#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);
|
fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The toolbar that this object belongs too.
|
||||||
|
obj->u_vdata = this;
|
||||||
|
|
||||||
setPixmap(obj, item->action, buttonwidth, height);
|
setPixmap(obj, item->action, buttonwidth, height);
|
||||||
item = item->next;
|
|
||||||
// we must remember to update the positions
|
// we must remember to update the positions
|
||||||
xpos += buttonwidth;
|
xpos += buttonwidth;
|
||||||
// ypos is constant
|
// ypos is constant
|
||||||
@ -312,6 +321,9 @@ void Toolbar::set(bool doingmain)
|
|||||||
owner->updateLayoutChoice();
|
owner->updateLayoutChoice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the state of the icons
|
||||||
|
//update();
|
||||||
|
|
||||||
cleaned = false;
|
cleaned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,21 +337,18 @@ void Toolbar::add(int action, bool doclean)
|
|||||||
if (!doclean && owner) {
|
if (!doclean && owner) {
|
||||||
// first "hide" the toolbar buttons. This is not a real hide
|
// first "hide" the toolbar buttons. This is not a real hide
|
||||||
// actually it deletes and frees the button altogether.
|
// actually it deletes and frees the button altogether.
|
||||||
lyxerr << "Toolbar::add: \"hide\" the toolbar buttons." << endl;
|
lyxerr << "Toolbar::add: \"hide\" the toolbar buttons."
|
||||||
toolbarItem * tmp= 0;
|
<< endl;
|
||||||
toolbarItem * item = toollist;
|
|
||||||
|
|
||||||
lightReset();
|
lightReset();
|
||||||
|
|
||||||
fl_freeze_form(owner->getForm());
|
fl_freeze_form(owner->getForm());
|
||||||
while(item){
|
|
||||||
tmp = item->next;
|
ToolbarList::iterator p = toollist.begin();
|
||||||
if (item->icon) {
|
for (; p != toollist.end(); ++p) {
|
||||||
fl_delete_object(item->icon);
|
p->clean();
|
||||||
fl_free_object(item->icon);
|
|
||||||
}
|
|
||||||
item = tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (combox) {
|
if (combox) {
|
||||||
delete combox;
|
delete combox;
|
||||||
combox = 0;
|
combox = 0;
|
||||||
@ -351,44 +360,30 @@ void Toolbar::add(int action, bool doclean)
|
|||||||
// there exist some special actions not part of
|
// there exist some special actions not part of
|
||||||
// kb_action: SEPARATOR, LAYOUTS
|
// kb_action: SEPARATOR, LAYOUTS
|
||||||
|
|
||||||
toolbarItem * newItem, * tmp;
|
toolbarItem newItem;
|
||||||
|
newItem.action = action;
|
||||||
// adds an item to the list
|
toollist.push_back(newItem);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Toolbar::clean()
|
void Toolbar::clean()
|
||||||
{
|
{
|
||||||
toolbarItem * tmp = 0;
|
//reset(); // I do not understand what this reset() is, anyway
|
||||||
toolbarItem * item = toollist;
|
|
||||||
|
|
||||||
reset();
|
|
||||||
|
|
||||||
//now delete all the objects..
|
//now delete all the objects..
|
||||||
if (owner)
|
if (owner)
|
||||||
fl_freeze_form(owner->getForm());
|
fl_freeze_form(owner->getForm());
|
||||||
while (item) {
|
|
||||||
tmp = item->next;
|
// G++ vector does not have clear defined
|
||||||
delete item;
|
//toollist.clear();
|
||||||
item = tmp;
|
toollist.erase(toollist.begin(), toollist.end());
|
||||||
}
|
|
||||||
lyxerr[Debug::TOOLBAR] << "Combox: " << combox << endl;
|
lyxerr[Debug::TOOLBAR] << "Combox: " << combox << endl;
|
||||||
if (combox) {
|
if (combox) {
|
||||||
delete combox;
|
delete combox;
|
||||||
combox = 0;
|
combox = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner)
|
if (owner)
|
||||||
fl_unfreeze_form(owner->getForm());
|
fl_unfreeze_form(owner->getForm());
|
||||||
lyxerr[Debug::TOOLBAR] << "toolbar cleaned" << endl;
|
lyxerr[Debug::TOOLBAR] << "toolbar cleaned" << endl;
|
||||||
@ -401,20 +396,13 @@ void Toolbar::push(int nth)
|
|||||||
lyxerr[Debug::TOOLBAR] << "Toolbar::push: trying to trigger no `"
|
lyxerr[Debug::TOOLBAR] << "Toolbar::push: trying to trigger no `"
|
||||||
<< nth << '\'' << endl;
|
<< nth << '\'' << endl;
|
||||||
|
|
||||||
if (nth == 0) return;
|
if (nth <= 0 || nth >= int(toollist.size())) {
|
||||||
|
// item nth not found...
|
||||||
int count = 0;
|
LyXBell();
|
||||||
toolbarItem * tmp = toollist;
|
return;
|
||||||
while (tmp) {
|
|
||||||
++count;
|
|
||||||
if (count == nth) {
|
|
||||||
fl_trigger_object(tmp->icon);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tmp = tmp->next;
|
|
||||||
}
|
}
|
||||||
// item nth not found...
|
|
||||||
LyXBell();
|
fl_trigger_object(toollist[nth - 1].icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -433,7 +421,7 @@ void Toolbar::add(string const & func, bool doclean)
|
|||||||
|
|
||||||
void Toolbar::reset()
|
void Toolbar::reset()
|
||||||
{
|
{
|
||||||
toollist = 0;
|
//toollist = 0; // what is this supposed to do?
|
||||||
cleaned = false;
|
cleaned = false;
|
||||||
lightReset();
|
lightReset();
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "combox.h"
|
#include "combox.h"
|
||||||
@ -69,7 +70,8 @@ public:
|
|||||||
void activate();
|
void activate();
|
||||||
/// deactivates the toolbar
|
/// deactivates the toolbar
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
/// update the state of the icons
|
||||||
|
void update();
|
||||||
///
|
///
|
||||||
static void ToolbarCB(FL_OBJECT *, long);
|
static void ToolbarCB(FL_OBJECT *, long);
|
||||||
|
|
||||||
@ -85,32 +87,41 @@ private:
|
|||||||
///
|
///
|
||||||
struct toolbarItem
|
struct toolbarItem
|
||||||
{
|
{
|
||||||
///
|
|
||||||
toolbarItem * next;
|
|
||||||
///
|
///
|
||||||
int action;
|
int action;
|
||||||
///
|
///
|
||||||
string help;
|
|
||||||
///
|
|
||||||
FL_OBJECT * icon;
|
FL_OBJECT * icon;
|
||||||
///
|
///
|
||||||
toolbarItem() {
|
toolbarItem() {
|
||||||
next = 0;
|
|
||||||
action = LFUN_NOACTION;
|
action = LFUN_NOACTION;
|
||||||
icon = 0;
|
icon = 0;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
~toolbarItem() {
|
void clean() {
|
||||||
if (icon) {
|
if (icon) {
|
||||||
fl_delete_object(icon);
|
fl_delete_object(icon);
|
||||||
fl_free_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
|
/// typedef to simplify things
|
||||||
toolbarItem * toollist;
|
typedef std::vector<toolbarItem> ToolbarList;
|
||||||
|
/// The list containing all the buttons
|
||||||
|
ToolbarList toollist;
|
||||||
///
|
///
|
||||||
LyXView * owner;
|
LyXView * owner;
|
||||||
#if FL_REVISION < 89
|
#if FL_REVISION < 89
|
||||||
|
Loading…
Reference in New Issue
Block a user