|
From: sfeam <sf...@us...> - 2014-06-22 20:16:09
|
On Monday, 23 June 2014 04:59:06 AM Tatsuro MATSUOKA wrote: > ----- Original Message ----- > > > From: Tatsuro MATSUOKA > > To: Merritt Ethan ; gnuplot-beta > > Cc: > > Date: 2014/6/23, Mon 04:13 > > Subject: Re: How to get key information from qt terminal to gnuplot > > ----- Original Message ----- > >> From: sfeam > >> To: gnuplot-beta Tatsuro MATSUOKA > >> Cc: > >> Date: 2014/6/23, Mon 01:37 > >> Subject: Re: How to get key information from qt terminal to gnuplot > >> > >> On Sunday, 22 June 2014 05:36:20 PM Tatsuro MATSUOKA wrote: > >>> Hello > >>> > >>> > >> > > http://gnuplot.10905.n7.nabble.com/Spacebar-does-not-raise-command-window-with-wxt-terminal-td18540.html > >>> > >>> > >>> For qt terminal, this feature seems not to be implemented. (Right?) > >>> Although I do not have enough knowledge, I tried to implement it. > >>> I looked into qt_term.cpp and QtGnuplotScene.cpp. > >>> > >>> In QtGnuplotScene.cpp, qt terminal seems to return key information in > >>> > >>> void QtGnuplotScene::keyPressEvent(QKeyEvent* event) > >>> <snip> > >>> live = m_eventHandler->postTermEvent(GE_keypress, > >>> int(m_lastMousePos.x()), int(m_lastMousePos.y()), key, 0, m_widget); > >>> > >>> While in qt_term.cpp, > >>> > >>> /*------------------------------------------------------- > >>> * Communication terminal -> gnuplot > >>> *-------------------------------------------------------*/ > >>> > >>> bool qt_processTermEvent(gp_event_t* event) > >>> <snip> > >>> if ((event->type == GE_keypress) && (paused_for_mouse & > > > >> PAUSE_KEYSTROKE) && (event->par1 > '\0')) > >>> > >>> > >>> However, > >>> 'struct gp_event_t' has no member named 'key' > >>> > >>> > >>> How I do get key information from qt terminal to gnuplot? > >> > >> The simplest way is > >> gnuplot> bind "<key>" "command to execute" > >> > >> No code change to the qt terminal is needed. However there is not > >> currently a "command to execute" that raises the console window. > >> The "raise" command acts on the plot window, not the console > > window. > >> > >> Why does the "raise console" function use different code for each > >> terminal type? The console is the same no matter what terminal is > >> in use. Am I missing something? > >> > >> My current thinking is that the special code to raise the console > >> should be removed from all terminals. > >> Instead we could add a routine in mouse.c that responds to the > >> keystroke after it is passed to the gnuplot core. This would be > >> shared by all terminals. > >> > >> Ethan > > OK. I agree with you. > > Thanks for the pointer. > > > Although I agree with Ethan, it is important to know the code to get information what key pressed > from gnuplot_qt to gnuplot. I will appreciate that some will show the way. %%%%%%%%%%%%%%%%%%%%%%%%%%%%% QtGnuplotScene.cpp (line 965) live = m_eventHandler->postTermEvent(GE_keypress, int(m_lastMousePos.x()), int(m_lastMousePos.y()), key, 0, m_widget); %%%%%%%%%%%%%%%%%%%%%%%%%%%%% QtGnuplotEvent.cpp: bool QtGnuplotEventHandler::postTermEvent(int type, int mx, int my, int par1, int par2, QtGnuplotWidget* widget) { if ((m_socket == 0) || (m_socket->state() != QLocalSocket::ConnectedState) || (widget && !widget->isActive())) return false; gp_event_t event; event.type = type; event.mx = mx; event.my = my; event.par1 = par1; event.par2 = par2; event.winid = 0; // We don't forward any window id to gnuplot m_socket->write((char*) &event, sizeof(gp_event_t)); return true; } %%%%%%%%%%%%%%%%%%%%%%%%%%%% qt_term.cpp: /*------------------------------------------------------- * Communication terminal -> gnuplot *-------------------------------------------------------*/ bool qt_processTermEvent(gp_event_t* event) { [...] do_event(event); %%%%%%%%%%%%%%%%%%%%%%%%%%%%% mouse.c: do_event(struct gp_event_t *ge) case GE_keypress: event_keypress(ge, TRUE); break; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mouse.c: event_keypress() Ethan |