Commit 5d104643 authored by Olivier Lagrasse's avatar Olivier Lagrasse

- Modification de la correction du bug au niveau de l'export en ligne de

commande.

IMPLEMENTATION ZOOM HORIZONTAL
- zoom avec molette.
- Possibilite de visualisation d'un intervalle de la trace en dessinant 
avec la souris un rectangle (pas encore precis).
- Menu de choix de zoom a droite de la bar de scrolling (100% correspond 
a l'affichage total de la trace) avec possibilite d'entrer au clavier un 
niveau de zoom (bug si entre un zoom nul).
- CTRL-SHIFT-A permet d'afficher toute la trace.
- Icone de la barre des menus permet l'affichage total de la trace.

SCROLLING HORIZONTAL
- la barre ne marche plus (bug temporaire).
- scrolling via les touches du curseur du clavier.
- Touche Home permet de revenir au debut de la trace.
- Touche End permet d'aller a la fin de la trace.
- Deplacement via les icones de la barre des menus au debut et a la fin 
de la trace.
parent b7d19d28
......@@ -54,16 +54,18 @@ Interface_console::Interface_console(int argc, char ** argv){
_main_window = NULL;
_render_opengl = NULL;
// Init of the times
/* Init of the times */
_time_start = 0;
_time_end = 0;
_state = get_state(argc, argv);
/*
* Suppose that no window will be displayed.
*/
_is_window_displayed = false;
launch_action(_state);
}
......@@ -156,7 +158,15 @@ bool Interface_console::draw_trace(const string & filename, const int format){
int Interface_console::run(){
return app->exec();
/*
* If a window is displayed, enter in the Qt event loop.
*/
if ( true == _is_window_displayed){
return app->exec();
}
else{/* else, quit the application */
return EXIT_SUCCESS;
}
}
......@@ -399,6 +409,7 @@ void Interface_console::launch_action(int state, void* arg){
_render_opengl = new Render_opengl(_main_window);
_main_window->bind_render_area((QGLWidget*)_render_opengl);
_is_window_displayed = true;
break;
case _STATE_OPEN_FILE:
......@@ -413,6 +424,8 @@ void Interface_console::launch_action(int state, void* arg){
if(false==draw_trace(_file_opened, _DRAW_OPENGL))
message << "Draw trace failed" << Message::ende;
_is_window_displayed = true;
break;
......@@ -480,13 +493,21 @@ void Interface_console::launch_action(int state, void* arg){
break;
case _STATE_RENDER_AREA_CHANGE_SCALE:
_render_opengl->change_scale( *((int*)arg) );
_render_opengl->change_scale( *((Element_pos*)arg) );
break;
case _STATE_RENDER_AREA_CHANGE_CONTAINER_SCALE:
_render_opengl->change_scale_container_state( *((int*)arg) );
break;
case _STATE_RENDER_AREA_REPLACE_SCALE:
_render_opengl->replace_scale( *((Element_pos*)arg) );
break;
case _STATE_RENDER_AREA_REPLACE_TRANSLATE:
_render_opengl->replace_translate( *((Element_pos*)arg) );
break;
default:/* like _STATE_UNKNOWN */
display_help();
warning(string("Cannot determine the arguments past. Please check the correct syntax."));
......@@ -549,6 +570,3 @@ const QString* Interface_console::get_runenv() const{
return _run_env;
}
int Interface_console::get_status(){
return _state;
}
......@@ -81,22 +81,22 @@ public:
static const int _STATE_RELEASE_RENDER_AREA = 6;
/*!
*\brief A state which corresponds to release the OpenGL render area (display the wait screen).
*\brief A state which corresponds to change the render area translation.
*/
static const int _STATE_RENDER_AREA_CHANGE_TRANSLATE = 7;
/*!
*\brief A state which corresponds to release the OpenGL render area (display the wait screen).
*\brief A state which corresponds to change the render area scale.
*/
static const int _STATE_RENDER_AREA_CHANGE_SCALE = 8;
/*!
*\brief A state which corresponds to release the OpenGL render area (display the wait screen).
*\brief A state which corresponds to change the render area container/state scale.
*/
static const int _STATE_RENDER_AREA_CHANGE_CONTAINER_SCALE = 9;
/*!
*\brief Informs that a trace has to be parsed and diplayed in the main window.
*\brief Informs that a trace has to be parsed and displayed in the main window.
*/
static const int _DRAW_OPENGL = 10;
......@@ -108,7 +108,17 @@ public:
/*!
*\brief A state which corresponds to display the ViTE window.
*/
static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE = 10;
static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE = 12;
/*!
*\brief A state which corresponds to replace the render area scale.
*/
static const int _STATE_RENDER_AREA_REPLACE_SCALE = 13;
/*!
*\brief A state which corresponds to replace the render area translate.
*/
static const int _STATE_RENDER_AREA_REPLACE_TRANSLATE = 14;
/*!
* \brief Launch an action according to the argument state value.
......@@ -127,6 +137,22 @@ public:
protected:
/***********************************
*
* Control attributes
*
**********************************/
/*!
* \brief Use to know if a window is displayed or not.
*
* This attributes control if the Qt managing event function exec() is executed,
* or if ViTE must quit after some operations without graphical interface
* are processed. (exportation for example)
*/
bool _is_window_displayed;
/***********************************
*
......@@ -175,7 +201,7 @@ protected:
int _time_end;
/*!
*\brief The interface_console state is specified by a command line arguments combinaison which influence the launch. _state is computed by get_state() and retireved by int get_status()
*\brief The interface_console state is specified by a command line arguments combinaison which influence the launch. _state is computed by get_state() and retrieved by int get_status().
*/
int _state;
......@@ -310,11 +336,6 @@ protected:
*/
void selection_information(const std::string) const{
}
/*!
* \brief Return the computed state of ViTE
* \return an integer
*/
int get_status();
};
......
......@@ -29,6 +29,7 @@ Interface_graphic::Interface_graphic(Interface_console* core, QWidget *parent):Q
_no_warning = false;/* display warnings */
load_windows();
setMouseTracking (true);/* to catch mouse events */
}
......@@ -77,6 +78,7 @@ void Interface_graphic::load_windows(){
CKFP(_ui_toolbar_check = qFindChild<QAction*>(this, "toolbar_menu"), "Cannot find the tool bar checker in the .ui file");
CKFP(_ui_toolbar = qFindChild<QToolBar*>(this, "toolBar"), "Cannot find the tool bar in the .ui file");
CKFP(_ui_x_scroll = qFindChild<QScrollBar*>(this, "x_scroll"), "Cannot find the horizontal scroll bar in the .ui file");
/*
......@@ -371,37 +373,49 @@ void Interface_graphic::on_no_warning_triggered(){
void Interface_graphic::on_zoom_in_triggered(){
// Faire un _actual_zoom ?
//on_scale_state_valueChanged(_actual_zoom ++); // ou +=0.95
cout << "zoom in" << endl;
Element_pos t = 1;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &t);
}
void Interface_graphic::on_zoom_out_triggered(){
// Faire un _actual_zoom ?
//on_scale_state_valueChanged(_actual_zoom --); // ou -=0.95
cout << "zoom out" << endl;
Element_pos t = -1;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &t);
}
void Interface_graphic::on_goto_start_triggered(){
on_translate_state_valueChanged(0);
Element_pos new_value = 0;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
}
void Interface_graphic::on_goto_end_triggered(){
//on_translate_state_valueChanged();
cout << "goto end" << endl;
Element_pos new_value = -1;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
}
void Interface_graphic::on_show_all_trace_triggered(){
cout << "show all trace" << endl;
Element_pos new_value = -2;
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
}
void Interface_graphic::on_scale_state_valueChanged(int new_value){
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_SCALE, &new_value);
void Interface_graphic::on_zoom_box_textChanged(QString s){
QRegExp reg_exp_number("^(\\d+)");
QString result;
Element_pos d;
if (-1 != reg_exp_number.indexIn(s)){/* match a number */
result = reg_exp_number.cap(1);/* capture number inside parenthesis in the RegExp */
d = 0.01*result.toDouble();
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_SCALE, &d);
}else if (QString("Entire") == s){
/* Display the whole trace */
}else{
warning(string("Cannot identify zoom box value: ") + s.toStdString());
}
}
void Interface_graphic::on_translate_state_valueChanged(int new_value){
_core->launch_action(Interface_console::_STATE_RENDER_AREA_CHANGE_TRANSLATE, &new_value);
void Interface_graphic::on_x_scroll_valueChanged(int new_value){
_core->launch_action(Interface_console::_STATE_RENDER_AREA_REPLACE_TRANSLATE, &new_value);
}
......@@ -419,4 +433,3 @@ void Interface_graphic::closeEvent(QCloseEvent *event){
const std::string Interface_graphic::get_filename() const{
return _trace_path;
}
......@@ -78,7 +78,12 @@ class Interface_graphic : public QMainWindow, protected Ui::main_window, public
* \brief Layout which will contain the render area.
*/
QVBoxLayout* _ui_render_area_layout;
/*!
* \brief This variable contains the instance of the horizontal scroll bar.
*/
QScrollBar* _ui_x_scroll;
/*!
* \brief Contains the Interface_console parent instance.
*/
......@@ -301,18 +306,18 @@ protected slots:
*/
void on_show_all_trace_triggered();
/*!
* \brief Change the scale of state drawing.
* \param new_value The new scale value.
*/
void on_scale_state_valueChanged(int new_value);/* temporary slot */
*\brief A slot which called when 'zoom_box' widget is triggered.
*
* \arg s The new string value of the zoom box.
*/
void on_zoom_box_textChanged(QString s);
/*!
* \brief Change the x position of camera view for state drawing area.
* \param new_value The new position.
*/
void on_translate_state_valueChanged(int new_value);/* temporary slot */
void on_x_scroll_valueChanged(int new_value);/* temporary slot */
/*!
* \brief Change the percentage taken by container display in the render area.
......@@ -335,7 +340,9 @@ protected slots:
*/
const std::string get_filename() const;
};
#endif
This diff is collapsed.
......@@ -23,8 +23,5 @@
Interface_console console(argc, argv);
if (console.get_status() & console._STATE_EXPORT_FILE)
return 0;
return console.run();
}
This diff is collapsed.
......@@ -129,6 +129,26 @@ class Render_opengl : public QGLWidget, public Render
* \brief Used to store the mouse last y position.
*/
int _mouse_y;
/*!
* \brief Used to store the mouse current x position.
*/
int _new_mouse_x;
/*!
* \brief Used to store the mouse current y position.
*/
int _new_mouse_y;
/*!
* \brief Alpha color of the selection rectangle.
*/
double _selection_rectangle_alpha;
/*!
* \brief Define the minimum width and height to draw the selection rectangle (avoid bas manipulations).
*/
Element_pos _minimum_distance_for_selection;
......@@ -171,7 +191,19 @@ class Render_opengl : public QGLWidget, public Render
* \brief This functions receives all mouse release events.
* \arg event The event triggered by mouse.
*/
void mouseReleaseEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
/*!
* \brief This functions receives all mouse wheel events.
* \arg event The event triggered by the mouse wheel.
*/
void wheelEvent(QWheelEvent * event);
/*!
* \brief This functions receives all keyboard events.
* \arg event The event triggered by the keyboard event.
*/
void keyPressEvent(QKeyEvent * event);
/***********************************
*
......@@ -214,6 +246,11 @@ class Render_opengl : public QGLWidget, public Render
*/
float _wait_angle;
/*!
* \brief Y rotation angle for the wait.
*/
float _wait_angle_y;
/*!
* \brief Time in ms between two frames for the waiting screen.
*/
......@@ -386,18 +423,23 @@ class Render_opengl : public QGLWidget, public Render
/*!
* \brief The percentage taken by container display in the render area.
*/
Element_pos _x_scale_container_state;/* temporary */
Element_pos _x_scale_container_state;
/*!
* \brief the scale of state drawing.
*/
Element_pos _state_scale;/* temporary */
Element_pos _state_scale;
/*!
* \brief The x position of camera view for state drawing area.
*/
Element_pos _state_translate;/* temporary */
Element_pos _state_translate;
/*!
* \brief The x position of the horizontal scroll bar.
*/
Element_pos _x_scroll_pos;
public:
......@@ -439,9 +481,15 @@ class Render_opengl : public QGLWidget, public Render
/*!
* \brief Change the scale of state drawing.
* \param scale The new scale value.
* \param scale_coeff The new coefficient scale value to add to the current scale.
*/
void change_scale(int scale);/* temporary -> to change the scale to view states */
void change_scale(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.
*/
void replace_scale(Element_pos new_scale);
/*!
* \brief Change the x position of camera view for state drawing area.
......@@ -449,6 +497,12 @@ class Render_opengl : public QGLWidget, public Render
*/
void change_translate(int translate);/* temporary -> to change the translate to view states */
/*!
* \brief Replace the current tranlate by a new translate.
* \param new_translate The new translate value to replace the current translate.
*/
void replace_translate(Element_pos new_translate);
/*!
* \brief Change the percentage taken by container display in the render area.
* \param view_size The new percentage (between 0 to 100).
......@@ -782,7 +836,7 @@ inline void Render_opengl::draw_stored_arrows(std::vector<Arrow_> &arrows){
Element_pos start_time, end_time, start_height, end_height;
/* Manage the event drawing size from state size and render area dimensions */
Element_pos arrow_scale_x = _state_scale*(_render_width/_state_x_max);
Element_pos arrow_scale_x = _state_scale*((_render_width-_default_entity_x_translate)/(_state_x_max-_state_x_min));
Element_pos arrow_scale_y = (_render_height-_rule_height)/_container_y_max;
Element_pos angle;
......@@ -862,7 +916,7 @@ inline void Render_opengl::draw_stored_events(std::vector<Event_> &events){
Element_pos time, height, container_height;
/* Manage the event drawing size from state size and render area dimensions */
Element_pos event_scale_x = _state_scale*(_render_width/_state_x_max);
Element_pos event_scale_x = _state_scale*((_render_width-_default_entity_x_translate)/(_state_x_max-_state_x_min));
Element_pos event_scale_y = (_render_height-_rule_height)/_container_y_max;
Element_pos radius;/* the circle radius */
......@@ -968,6 +1022,9 @@ inline void Render_opengl::end_draw_counter(){
}
glEndList();/* close the list */
/* Find the most suitable scale depending of the state x min and x max */
_state_scale = 1;//(_render_width - _default_entity_x_translate)/(_state_x_max - _state_x_min);
}
......
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