Commit 3ac10108 authored by Johnny Jazeix's avatar Johnny Jazeix

Ajout de doc.

Changement de l'implementation des raccourcis par ligne de commande 
pour la modularité.
Modification d'explication pour les windaubiens.
Le nom des containers est affiché en fonction de l'espace existant.
Quelque chose sur les erreurs mais je sais plus quoi mais ca doit 
marcher.
parent ec1ea793
......@@ -171,72 +171,128 @@ int Interface_console::run(){
int Interface_console::get_state(int argc, char** argv){
switch(argc){
case 1: /* just the name of the program, launch the window interface */
//Error::set_priority_min_printable(Error::_EVERYTHING);
if(argc == 1){
// just the name of the program, launch the window interface
return _STATE_LAUNCH_GRAPHICAL_INTERFACE;
}
case 2: /* There is one argument */
if (strncmp(argv[1], "-h", 2) == 0){
/* display the help message */
return _STATE_DISPLAY_HELP;
}
else{
/* should be a path of a file */
_file_opened = argv[1];/* store the path of the file */
return _STATE_OPEN_FILE;
}
case 3: // open a file
if (strncmp(argv[1], "-f", 2) == 0 || strncmp(argv[1], "-a", 2) == 0){
/* should be a path of a file */
_file_opened = argv[2];/* store the path of the file */
return _STATE_OPEN_FILE;
}
else{
int state = _STATE_DISPLAY_HELP;
for(int i = 1 ; i < argc ; i ++){
if(strncmp(argv[i], "-h", 2) == 0){
// display the help message
return _STATE_DISPLAY_HELP;
}
case 4: // open a file in an interval
if(strncmp(argv[2], "-t", 2) == 0){
_file_opened = argv[1];/* store the path of the file */
extract_times(argv[3]);
return _STATE_OPEN_FILE_IN_AN_INTERVAL;
}
else{
return _STATE_DISPLAY_HELP;
else if(strncmp(argv[i], "-f", 2) == 0 || strncmp(argv[i], "-a", 2) == 0){
// We want to open the file which follow this argument
i ++;
if(i < argc){
_file_opened = argv[i];
state |= _STATE_OPEN_FILE;
}
else{
cerr << "no filename to open" << endl;
return _STATE_UNKNOWN;
}
}
case 5: // export a file
if (strncmp(argv[1], "-f", 2) == 0){
/* should be a path of a file */
_file_opened = argv[2];/* store the path of the file */
if(strncmp(argv[3], "-e", 2) == 0){
_path_to_export = argv[4];
else if(strncmp(argv[i], "-e", 2) == 0){
// We want to export the file which follow this argument
i ++;
if(i < argc){
_path_to_export = argv[i];
state = _STATE_EXPORT_FILE;
}
else{
return _STATE_DISPLAY_HELP;
cerr << "no filename for export" << endl;
return _STATE_UNKNOWN;
}
return _STATE_EXPORT_FILE;
}
else{
return _STATE_DISPLAY_HELP;
else if(strncmp(argv[i], "-t", 2) == 0){
// We want to export the file which follow this argument
extract_times(argv[++ i]);
state |= _STATE_IN_AN_INTERVAL;
}
case 7: // export a piece of trace
if (strncmp(argv[1], "-f", 2) == 0 && strncmp(argv[3], "-e", 2) == 0 && strncmp(argv[5], "-t", 2) == 0) {
/* should be a path of a file */
_file_opened = argv[2];/* store the path of the file */
_path_to_export = argv[4];
extract_times(argv[6]);
return _STATE_EXPORT_FILE_IN_INTERVAL;
else if(argv[i][0] == '-'){
// This is here where we put new options !! (for filters for example or export)
return _STATE_UNKNOWN;
}
else{
return _STATE_DISPLAY_HELP;
else{ // This is a file to open
_file_opened = argv[i];
state |= _STATE_OPEN_FILE;
}
default:
break;
}
return _STATE_UNKNOWN;
return state;
////////////////////////////////////////////////////////////////
// switch(argc){
// case 1: /* just the name of the program, launch the window interface */
// return _STATE_LAUNCH_GRAPHICAL_INTERFACE;
// case 2: /* There is one argument */
// if (strncmp(argv[1], "-h", 2) == 0){
// /* display the help message */
// return _STATE_DISPLAY_HELP;
// }
// else{
// /* should be a path of a file */
// _file_opened = argv[1];/* store the path of the file */
// return _STATE_OPEN_FILE;
// }
// case 3: // open a file
// if (strncmp(argv[1], "-f", 2) == 0 || strncmp(argv[1], "-a", 2) == 0){
// /* should be a path of a file */
// _file_opened = argv[2];/* store the path of the file */
// return _STATE_OPEN_FILE;
// }
// else{
// return _STATE_DISPLAY_HELP;
// }
// case 4: // open a file in an interval
// if(strncmp(argv[2], "-t", 2) == 0){
// _file_opened = argv[1];/* store the path of the file */
// extract_times(argv[3]);
// return _STATE_OPEN_FILE_IN_AN_INTERVAL;
// }
// else{
// return _STATE_DISPLAY_HELP;
// }
// case 5: // export a file
// if (strncmp(argv[1], "-f", 2) == 0){
// /* should be a path of a file */
// _file_opened = argv[2];/* store the path of the file */
// if(strncmp(argv[3], "-e", 2) == 0){
// _path_to_export = argv[4];
// }
// else{
// return _STATE_DISPLAY_HELP;
// }
// return _STATE_EXPORT_FILE;
// }
// else{
// return _STATE_DISPLAY_HELP;
// }
// case 7: // export a piece of trace
// if (strncmp(argv[1], "-f", 2) == 0 && strncmp(argv[3], "-e", 2) == 0 && strncmp(argv[5], "-t", 2) == 0) {
// /* should be a path of a file */
// _file_opened = argv[2];/* store the path of the file */
// _path_to_export = argv[4];
// extract_times(argv[6]);
// return _STATE_EXPORT_FILE_IN_INTERVAL;
// }
// else{
// return _STATE_DISPLAY_HELP;
// }
// default:
// break;
// }
// return _STATE_UNKNOWN;
}
void Interface_console::extract_times(const char *name){
......
......@@ -52,14 +52,14 @@ public:
static const int _STATE_DISPLAY_HELP = 0;
/*!
*\brief A state which corresponds to display the ViTE window.
*\brief A state which corresponds to display the trace within a time.
*/
static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE = 1;
static const int _STATE_IN_AN_INTERVAL = 1;// 2^0
/*!
*\brief A state which corresponds to display a the ViTE window and opening a file.
*/
static const int _STATE_OPEN_FILE = 2;
static const int _STATE_OPEN_FILE = 2;// 2^1
/*!
*\brief A state which corresponds to display the trace within a time.
......@@ -69,7 +69,7 @@ public:
/*!
*\brief A state which corresponds to an export of file.
*/
static const int _STATE_EXPORT_FILE = 4;
static const int _STATE_EXPORT_FILE = 4;// 2^2
/*!
*\brief A state which corresponds to an export of file.
......@@ -96,6 +96,11 @@ public:
*/
static const int _STATE_RENDER_AREA_CHANGE_CONTAINER_SCALE = 9;
/*!
*\brief A state which corresponds to display the ViTE window.
*/
static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE = 10;
/*!
* \brief The size max (hoped) for the current directory name.
* Used for opening a new window with a new trace.
......
......@@ -343,18 +343,23 @@ 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;
}
void Interface_graphic::on_zoom_out_triggered(){
// Faire un _actual_zoom ?
//on_scale_state_valueChanged(_actual_zoom --); // ou -=0.95
cout << "zoom out" << endl;
}
void Interface_graphic::on_goto_start_triggered(){
cout << "goto start" << endl;
on_translate_state_valueChanged(0);
}
void Interface_graphic::on_goto_end_triggered(){
//on_translate_state_valueChanged();
cout << "goto end" << endl;
}
......
......@@ -31,7 +31,7 @@ const string Error::_UNKNOWN_LINK_TYPE = "Unknown link type : ";
const string Error::_UNKNOWN_ENTITY_TYPE = "Unknown entity type : ";
const string Error::_UNKNOWN_ENTITY_VALUE = "Unknown entity value : ";
int Error::_priority_printable_min;
string Error::_content = "";
......@@ -141,3 +141,8 @@ void Error::flush_in_file(const string &filename){
}
}
}
void Error::set_priority_min_printable(const int priority_min){
Error::_priority_printable_min = priority_min;
}
......@@ -20,6 +20,8 @@ private:
Error();
static int _line_error;
static int _priority_printable_min;
static std::queue<std::string> _errors;
static std::queue<std::string> _warnings;
static std::string _content;
......@@ -32,11 +34,18 @@ public:
/*!
* \brief Define the priority _ERROR.
*/
const static int _ERROR = 1;
const static int _EVERYTHING = 0;
/*!
* \brief Define the priority _WARNING.
*/
const static int _WARNING = 2;
const static int _WARNING = 1;
/*!
* \brief Define the priority _ERROR.
*/
const static int _ERROR = 2;
/*
* Kind of errors known
......@@ -175,6 +184,10 @@ public:
* \param filename : a file path
*/
static void flush_in_file(const std::string &filename);
static void set_priority_min_printable(const int priority_min);
};
#endif // ERRORS_HPP
......@@ -217,7 +217,7 @@ void Render_opengl::paintGL(){
glPushMatrix();
{
static float a = 0;
a++;
a ++;
glTranslated(0.0, _render_height, 100.0);
glRotated(180.0, 1.0, 0.0, 0.0);
......@@ -262,10 +262,10 @@ void Render_opengl::paintGL(){
/* Draw container texts */
for (it_txt=_text_value.begin(), it_pos=_text_pos.begin() ; it_txt!=_text_value.end(); it_txt++, it_pos++ ){
for (it_txt=_text_value.begin(), it_pos=_text_pos.begin() ; it_txt!=_text_value.end(); it_txt ++, it_pos ++){
buf_x = *it_pos;
it_pos++;
it_pos ++;
buf_y = *it_pos;
......@@ -278,22 +278,31 @@ void Render_opengl::paintGL(){
glScalef(10.0f/_container_x_max, 50.0f/_container_y_max, 0.0f);
*/
glScalef( (_render_width/_container_x_max)*_x_scale_container_state, (_render_height-_rule_height)/_container_y_max, 0.0f);
glScalef((_render_width/_container_x_max)*_x_scale_container_state, (_render_height-_rule_height)/_container_y_max, 0.0f);
glColor3d(1, 1, 1);
glRasterPos2f(buf_x,buf_y);
glRasterPos2f(buf_x, buf_y);
#ifdef DEBUG_MODE_RENDER_OPENGL
cerr << __FILE__ << " l." << __LINE__ << ":" << endl;
cerr << "Container texts position: (x = " << buf_x << ", y = " << buf_y << ") -> '" << buf_txt << "'" << endl << endl;
#endif
for(unsigned int i=0;i<buf_txt.length();i++){
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, buf_txt.c_str()[i]);
float length = 0;
const unsigned int buf_text_size = buf_txt.length();
const int size_of_container = 20*_x_scale_container_state*_render_width/_container_x_max;
for(unsigned int i = 0 ; i < buf_text_size ; i ++){
const char letter = buf_txt.c_str()[i];
length += glutBitmapWidth(GLUT_BITMAP_HELVETICA_10, letter);
if(length > size_of_container){
cout << "break" << endl;
break;
}
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, letter);
}
glPopMatrix();
}/* end for(...) */
......@@ -302,11 +311,11 @@ void Render_opengl::paintGL(){
glTranslated( _default_entity_x_translate - _state_translate , 0.0f, _z_state);
glScalef( _state_scale*(_render_width/_state_x_max), (_render_height-_rule_height)/_state_y_max, 0.0f);
glScalef(_state_scale*(_render_width/_state_x_max), (_render_height-_rule_height)/_state_y_max, 0.0f);
if (glIsList(_list_states)==GL_FALSE)
if (glIsList(_list_states) == GL_FALSE)
message << "ERROR LIST not exist for states." << Message::ende;
else
glCallList(_list_states);
......@@ -317,9 +326,9 @@ void Render_opengl::paintGL(){
glPushMatrix();
glTranslated(_default_entity_x_translate - _state_translate , 0.0f, _z_counter);
glScalef( _state_scale*(_render_width/_state_x_max), (_render_height-_rule_height)/_container_y_max, 0.0f);
glScalef(_state_scale*(_render_width/_state_x_max), (_render_height-_rule_height)/_container_y_max, 0.0f);
if (glIsList(_list_counters)==GL_FALSE) {
if (glIsList(_list_counters) == GL_FALSE) {
message << "ERROR LIST not exist for counters." << Message::ende;
}
else
......@@ -347,7 +356,7 @@ void Render_opengl::paintGL(){
/* Check the errors */
GLenum glerror;
glerror = glGetError();
if( glerror != GL_NO_ERROR)
if(glerror != GL_NO_ERROR)
message << "Render area : the following OpengGL error occured: " << (char *)gluErrorString(glerror) << Message::endw;
}
......
No preview for this file type
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