Commit 4c48e5e0 authored by Olivier Lagrasse's avatar Olivier Lagrasse

- Selection avec la souris utilise aussi l'axe vertical (celui des y)

- L'ensemble des commandes (avec la molette de la souris ou via les 
touches du menu) de zoom sur les X sont les memes sur Y en maintenant 
toutefois Alt appuye (A NOTER : il faut prealablement cliquer sur la 
zone de dessin pour ensuite que la touche Alt soit reconnue)
- Utilisation de la classe Info pour des variables utilisees par la 
render area et l'interface graphique.

- BUG : avec + et - pour un clavier de portable (pas teste sur clavier 
avec pave numerique).
parent deb83ba3
......@@ -6,9 +6,6 @@
#define INFO_HPP
struct Info;
/*!
* \brief Class used to store informations.
*
......@@ -66,6 +63,61 @@ public:
};
/*!
* \brief Sub structure to store render area informations.
*/
struct Render{
/*!
* \brief Contains the state of tke ALT key.
* true -> key pushed.
* false -> key released.
*/
static bool _key_alt;
/*!
* \brief To show the x beginning of the trace.
*/
static const int X_TRACE_BEGINNING = 0;
/*!
* \brief To show the y beginning of the trace.
*/
static const int Y_TRACE_BEGINNING = 1;
/*!
* \brief To show the x ending of the trace.
*/
static const int X_TRACE_ENDING = 2;
/*!
* \brief To show the y ending of the trace.
*/
static const int Y_TRACE_ENDING = 3;
/*!
* \brief To show the horizontal entire trace.
*/
static const int X_TRACE_ENTIRE = 4;
/*!
* \brief To show the vertical entire trace.
*/
static const int Y_TRACE_ENTIRE = 5;
/*!
* \brief To show the left screen of the current view.
*/
static const int X_SCREEN_LEFT_MOVE = 6;
/*!
* \brief To show the right screen of the current view.
*/
static const int X_SCREEN_RIGHT_MOVE = 7;
};
};
......
......@@ -514,6 +514,10 @@ void Interface_console::launch_action(int state, void* arg){
_render_opengl->change_scale( *((Element_pos*)arg) );
break;
case _STATE_RENDER_AREA_CHANGE_SCALE_Y:
_render_opengl->change_scale_y( *((Element_pos*)arg) );
break;
case _STATE_RENDER_AREA_CHANGE_CONTAINER_SCALE:
_render_opengl->change_scale_container_state( *((int*)arg) );
break;
......@@ -530,6 +534,10 @@ void Interface_console::launch_action(int state, void* arg){
_render_opengl->replace_translate_y( *((Element_pos*)arg) );
break;
case _STATE_RENDER_AREA_REGISTERED_TRANSLATE:
_render_opengl->registered_translate( *((int*)arg) );
break;
default:/* like _STATE_UNKNOWN */
display_help();
warning(string("Cannot determine the arguments past. Please check the correct syntax."));
......
......@@ -125,6 +125,16 @@ public:
*/
static const int _STATE_RENDER_AREA_REPLACE_TRANSLATE_Y = 15;
/*!
*\brief A state which corresponds to the registered render area translate.
*/
static const int _STATE_RENDER_AREA_REGISTERED_TRANSLATE = 16;
/*!
*\brief A state which corresponds to change the render area scale.
*/
static const int _STATE_RENDER_AREA_CHANGE_SCALE_Y = 17;
/*!
* \brief Launch an action according to the argument state value.
* \arg state : an integer corresponding to a kind of action which must be executed.
......
......@@ -396,27 +396,49 @@ void Interface_graphic::on_no_warning_triggered(){
void Interface_graphic::on_zoom_in_triggered(){
Element_pos t = 1;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &t);
if (true==Info::Render::_key_alt)/* on Y axe */
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE_Y, &t);
else/* on X axe */
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &t);
}
void Interface_graphic::on_zoom_out_triggered(){
Element_pos t = -1;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &t);
if (true==Info::Render::_key_alt)/* on Y axe */
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE_Y, &t);
else/* on X axe */
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &t);
}
void Interface_graphic::on_goto_start_triggered(){
Element_pos new_value = 0;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
int id;
if (true==Info::Render::_key_alt)/* on Y axe */
id = Info::Render::Y_TRACE_BEGINNING;
else/* on X axe */
id = Info::Render::X_TRACE_BEGINNING;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
}
void Interface_graphic::on_goto_end_triggered(){
Element_pos new_value = -1;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
int id;
if (true==Info::Render::_key_alt)/* on Y axe */
id = Info::Render::Y_TRACE_ENDING;
else/* on X axe */
id = Info::Render::X_TRACE_ENDING;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
}
void Interface_graphic::on_show_all_trace_triggered(){
Element_pos new_value = -2;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
int id = Info::Render::X_TRACE_ENTIRE;/* on X axe */
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
id = Info::Render::Y_TRACE_ENTIRE;/* on Y axe */
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
}
void Interface_graphic::on_zoom_box_textChanged(QString s){
......
......@@ -9,8 +9,12 @@
class Interface_graphic;
#include "../ui_main_window.h"/* the main window graphical interface */
/* Global informations */
#include "info/info.hpp"
#include "interface.hpp"
#include "interface_console.hpp"
......
......@@ -10,6 +10,9 @@
#include <QApplication>
/* Global informations */
#include "info/info.hpp"
#include "interface/interface_console.hpp"
/*!
......@@ -20,6 +23,8 @@
Q_INIT_RESOURCE(vite);
Info::Render::_key_alt = false;/* no CTRL key pushed */
Interface_console console(argc, argv);
......
......@@ -17,6 +17,8 @@
/*!
* \brief unity for count elements such as number of states or events... NOT USED YET
*/
......@@ -38,6 +40,7 @@ typedef double Times;
/* Message management */
#include "message/Message.hpp"
......
This diff is collapsed.
......@@ -12,6 +12,8 @@
class Render_opengl;
/* Global informations */
#include "info/info.hpp"
#include "render.hpp"
......@@ -159,7 +161,8 @@ class Render_opengl : public QGLWidget, public Render
* \brief Define the scrolling factor when CTRL key is pressed.
*/
static const int _ctrl_zoom_factor = 3;
/***********************************
......@@ -215,6 +218,13 @@ class Render_opengl : public QGLWidget, public Render
*/
void keyPressEvent(QKeyEvent * event);
/*!
* \brief This functions receives all keyboard release events.
* \arg event The event triggered by a keyboard release.
*/
void keyReleaseEvent(QKeyEvent * event);
/***********************************
*
* The wait screen drawing.
......@@ -487,22 +497,61 @@ class Render_opengl : public QGLWidget, public Render
virtual ~Render_opengl();
/***********************************
*
* Building functions.
* Pre register translate values.
*
**********************************/
/*!
* \brief This function draws the trace.
* \arg trace the trace which be displayed.
*/
bool build();
// /*!
// * \brief To show the x beginning of the trace.
// */
// static const int X_TRACE_BEGINNING = 0;
// /*!
// * \brief To show the y beginning of the trace.
// */
// static const int Y_TRACE_BEGINNING = 1;
// /*!
// * \brief To show the x ending of the trace.
// */
// static const int X_TRACE_ENDING = 2;
// /*!
// * \brief To show the y ending of the trace.
// */
// static const int Y_TRACE_ENDING = 3;
// /*!
// * \brief To show the horizontal entire trace.
// */
// static const int X_TRACE_ENTIRE = 4;
// /*!
// * \brief To show the vertical entire trace.
// */
// static const int Y_TRACE_ENTIRE = 5;
// /*!
// * \brief To show the left screen of the current view.
// */
// static const int X_SCREEN_LEFT_MOVE = 6;
// /*!
// * \brief To show the right screen of the current view.
// */
// static const int X_SCREEN_RIGHT_MOVE = 7;
/*!
* \brief This function releases the trace.
*/
bool unbuild();
/***********************************
*
* Scaling and scrolling functions.
*
**********************************/
/*!
* \brief Change the scale of state drawing.
......@@ -510,6 +559,12 @@ class Render_opengl : public QGLWidget, public Render
*/
void change_scale(Element_pos scale_coeff);
/*!
* \brief Change the scale of the y state drawing.
* \param scale_coeff The new coefficient scale value to add to the current scale.
*/
void change_scale_y(Element_pos scale_coeff);
/*!
* \brief Replace the current scale by a new scale.
* \param new_scale The new scale value to replace the current scale.
......@@ -540,13 +595,37 @@ class Render_opengl : public QGLWidget, public Render
*/
void replace_translate_y(Element_pos new_translate);
/*!
* \brief Pre registered translation values (for x or y translate).
* \param id The pre registered translation id.
*/
void registered_translate(int id);
/*!
* \brief Change the percentage taken by container display in the render area.
* \param view_size The new percentage (between 0 to 100).
*/
void change_scale_container_state(int view_size);/* temporary -> to change the size of container view */
/***********************************
*
* Building functions.
*
**********************************/
/*!
* \brief This function draws the trace.
* \arg trace the trace which be displayed.
*/
bool build();
/*!
* \brief This function releases the trace.
*/
bool unbuild();
/*!
* \brief Proceeds with the initialization of the OpenGL draw functions.
*/
......@@ -884,8 +963,8 @@ inline void Render_opengl::draw_stored_arrows(std::vector<Arrow_> &arrows){
start_time = arrows[i].start_time*arrow_scale_x + _default_entity_x_translate -_state_translate;
end_time = arrows[i].end_time*arrow_scale_x + _default_entity_x_translate - _state_translate;
start_height = arrows[i].start_height*arrow_scale_y;
end_height = arrows[i].end_height*arrow_scale_y;
start_height = arrows[i].start_height*arrow_scale_y;// + _y_state_translate;
end_height = arrows[i].end_height*arrow_scale_y;// + _y_state_translate;
/* DEBUG */
// std::cerr << "Arrow draw: (" << start_time << ", " << start_height << ") to (" << end_time << ", " << end_height << ")" << std::endl;
......@@ -965,7 +1044,7 @@ inline void Render_opengl::draw_stored_events(std::vector<Event_> &events){
for (long i=0 ; i<(long)events.size() ; i++){
time = events[i].time*event_scale_x + _default_entity_x_translate -_state_translate;
height = events[i].height*event_scale_y;
height = events[i].height*event_scale_y +_y_state_translate;
container_height = events[i].container_height*event_scale_y;
......
......@@ -17,6 +17,8 @@ INCLUDEPATH += . interface message trace trace/values parser
HEADERS += message/Message.hpp \
message/Errors.hpp \
main_resource.hpp \
# Info header
info/info.hpp \
# Interface headers
interface/interface.hpp \
interface/interface_console.hpp \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment