X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FToolbar_pimpl.C;h=7c7a58e3bc5b447cf9c310c5280093bff07a7232;hb=14c60d0aaeff364a78f77e163e6eae5fc3dab8c0;hp=db5c7d0a0bccfaca4698faf8f670ea4c3d3d224d;hpb=adaef99e60e28eba8c413a3472cc71e234718af0;p=lyx.git diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index db5c7d0a0b..7c7a58e3bc 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -26,14 +26,13 @@ #include "BufferView.h" #include "buffer.h" #include "LyXAction.h" +#include "MathsSymbols.h" #include "support/filetools.h" +#include "support/lstrings.h" #include "gettext.h" using std::endl; -// this one is not "C" because combox callbacks are really C++ %-| -extern void LayoutsCB(int, void *, Combox *); -extern char const ** get_pixmap_from_symbol(char const * arg, int, int); extern LyXAction lyxaction; // some constants @@ -99,7 +98,7 @@ void BubbleTimerCB(FL_OBJECT *, long data) // 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); + string help = _(lyxaction.helpText(ob->argument)); fl_show_oneliner(help.c_str(), ob->form->x + ob->x, ob->form->y + ob->y + ob->h); } @@ -115,7 +114,7 @@ extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data) static int BubblePost(FL_OBJECT *ob, int event, FL_Coord /*mx*/, FL_Coord /*my*/, - int /*key*/, void */*xev*/) + int /*key*/, void * /*xev*/) { FL_OBJECT * bubble_timer = reinterpret_cast(ob->u_cdata); @@ -142,6 +141,21 @@ extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event, } #endif +// this one is not "C" because combox callbacks are really C++ %-| +void Toolbar::Pimpl::layoutSelectedCB(int sel, void * arg, Combox *) +{ + Toolbar::Pimpl * tb = reinterpret_cast(arg); + + tb->layoutSelected(sel); +} + + +void Toolbar::Pimpl::layoutSelected(int sel) +{ + string const tmp = tostr(sel); + owner->getLyXFunc()->Dispatch(LFUN_LAYOUTNO, tmp); +} + void Toolbar::Pimpl::activate() { @@ -361,7 +375,7 @@ void Toolbar::Pimpl::set(bool doingmain) if (!combox) combox = new Combox(FL_COMBOX_DROPLIST); combox->add(xpos, ypos, 135, height, 400); - combox->setcallback(LayoutsCB); + combox->setcallback(layoutSelectedCB, this); combox->resize(FL_RESIZE_ALL); combox->gravity(NorthWestGravity, NorthWestGravity); xpos += 135; @@ -384,7 +398,7 @@ void Toolbar::Pimpl::set(bool doingmain) // Set the tooltip #if FL_REVISION >= 89 - string help = lyxaction.helpText(item->action); + string help = _(lyxaction.helpText(item->action)); fl_set_object_helper(obj, help.c_str()); #else fl_set_object_posthandler(obj, C_Toolbar_BubblePost);