Commit 465ec3e7 authored by Mathieu Faverge's avatar Mathieu Faverge

Now it compiles again

parent 6fa63868
......@@ -93,6 +93,10 @@ Session::Session() {
settings = new QSettings( VITE_ORGANISATION_DOMAIN,
VITE_APPLICATION_NAME );
_palette = get_palette("palette", get_current_palette("palette"));
_link_types = get_palette("link_types", get_current_palette("link_types"));
_event_types = get_palette("event_types", get_current_palette("event_types"));
}
Session::~Session() {
......
......@@ -86,8 +86,8 @@
#include "common/Tools.hpp"
#include "common/Session.hpp"
#include "common/Message.hpp"
#include "common/Palette.hpp"
/* -- */
#include "render/Palette.hpp"
#include "render/Geometry.hpp"
#include "render/Hook_event.hpp"
#include "render/Ruler.hpp"
......@@ -1053,9 +1053,6 @@ void Core::launch_action(int state, void* arg) {
if (_render_opengl->unbuild() == false)
message << "Close file : an error occured while cleaning the render." << Message::ende;
_render_opengl->release();
Session::_palette = NULL;
Session::_link_types = NULL;
Session::_event_types = NULL;
_render_opengl->updateGL();
}
break;
......
......@@ -59,9 +59,9 @@
#include "trace/Entitys.hpp"
#include "trace/Trace.hpp"
/* -- */
#include "render/Palette.hpp"
/* -- */
#include "common/Palette.hpp"
#include "common/Session.hpp"
/* -- */
#include "interface/Interface.hpp"
#include "core/Core.hpp"
#include "interface/Settings_window.hpp"
......
......@@ -448,8 +448,9 @@ public:
if(!Session::get_use_palette("link_types")) display = true;
else{
if (link->get_type()){
if(!Session::_link_types)Session::_link_types=Session::get_palette("link_types", Session::get_current_palette("link_types"));
color= Session::_link_types->get_color(link->get_type()->get_name().to_string());
Palette *lt = Session::get_palette("link_types", Session::get_current_palette("link_types"));
color = lt->get_color(link->get_type()->get_name().to_string());
if(color) display=true;
/*for(std::list<std::string>::const_iterator it2= link_types->get_->begin();
......
......@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
......@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
/*!
......@@ -73,7 +73,7 @@ private:
Element_pos _container_height;
Element_pos _container_v_space;
Element_pos _state_height;
Element_pos _state_v_space;
......@@ -88,7 +88,7 @@ public:
_container_height(container_height), _container_v_space(container_v_space),
_state_height(state_height), _state_v_space(state_v_space){
}
/*!
* \fn draw_tree( BinaryTree<E> * tree, const Interval &I)
* \brief Function called to draw on ViTE the elements of a tree
......@@ -99,7 +99,7 @@ public:
Node<E> *node = tree->get_root();
bool b = false;
if (node)
browse_tree(I, node,b);
browse_tree(I, node,b);
}
/*!
......@@ -123,7 +123,7 @@ public:
Element_pos y = _position*(_container_height+_container_v_space) + _container_v_space/2;
_draw_object->draw_state(starttime, endtime, y, _state_height, r, g, b);
}
/*!
* \fn draw_event(double time, double r, double g, double b)
* \brief Draw an event
......@@ -176,45 +176,45 @@ struct DrawNode<D, Event> {
std::map<std::string, Value *>::const_iterator field;
const Event *event = node->get_element();
bool display=false;
const Color *color = NULL;
//if the color has been changed by a palette, we need to know it now.
//if the Event has to be hidden, we can know it (get_color will return NULL), and never disply this event.
if(!Session::get_use_palette("event_types")) display = true;
else{
else{
if (event->get_type()){
if(!Session::_event_types)Session::_event_types=Session::get_palette("event_types", Session::get_current_palette("event_types"));
Palette *et = Session::get_palette("event_types", Session::get_current_palette("event_types"));
//const std::list<std::string> * event_types = Session::get_event_types();
color= Session::_event_types->get_color(event->get_type()->get_name().to_string());
color = et->get_color(event->get_type()->get_name().to_string());
if(color) display=true;
}
}
if(display){
const std::map<std::string, Value *> *extra_fields = event->get_extra_fields();
double time = node->get_element()->get_time().get_value();
// Search the color in the event first
if (color==NULL && extra_fields!=NULL && ((field = extra_fields->find(std::string("Color"))) != extra_fields->end())) {
// Call the object event drawing function with the event color
// Call the object event drawing function with the event color
color = (const Color *)(*field).second;
}
else if(color==NULL && event->get_type()->get_extra_fields()!=NULL && ((field = event->get_type()->get_extra_fields()->find(std::string("Color"))) != event->get_type()->get_extra_fields()->end())) {
// Search in the type after
/* Call the object event drawing function with the event type color */
/* Call the object event drawing function with the event type color */
color = (const Color *)(*field).second;
}
if(color != NULL) {
draw->draw_event(time, color->get_red(), color->get_green(), color->get_blue());
}
else {
/* Call the object event drawing function with default color */
/* Call the object event drawing function with default color */
draw->draw_event(time, 1.0, 1.0, 1.0);
}
}
......@@ -242,30 +242,30 @@ struct DrawNode<D, StateChange> {
const std::map<std::string, Value *> *extra_fields;
const Color *color=NULL;
extra_fields = state->get_value()->get_extra_fields();
bool display=false;
//if the color has been changed by a palette, we need to know it now.
//if the State has to be hidden, we can know it (get_color will return NULL), and never display it.
//if we don't use palettes, display all states.
if(!Session::get_use_palette("palette")) display = true;
else{
else{
if (state->get_type()){
if(!Session::_palette)Session::_palette=Session::get_palette("palette", Session::get_current_palette("palette"));
Palette *sp = Session::get_palette("palette", Session::get_current_palette("palette"));
//const std::list<std::string> * event_types = Session::get_event_types();
color= Session::_palette->get_color(state->get_type()->get_name().to_string());
color = sp->get_color(state->get_type()->get_name().to_string());
if(color) display=true;
}
}
if(display){
// Search the color
if(color==NULL){
if (state->get_value() &&
extra_fields!=NULL &&
extra_fields!=NULL &&
!extra_fields->empty() &&
((field = extra_fields->find(std::string("Color"))) != extra_fields->end())) {
/* Call the object state drawing function with the state color */
/* Call the object state drawing function with the state color */
color = (const Color *)(*field).second;
}else{
color=new Color(0.7, 0.7, 0.75);
......@@ -274,12 +274,12 @@ struct DrawNode<D, StateChange> {
draw->draw_state(interval->_left.get_value(), state->get_end_time().get_value(),
color->get_red(), color->get_green(), color->get_blue());
}
}
}
if (!node->get_element()->get_right_state())
return;
std::map<std::string, Value *>::const_iterator field;
......@@ -287,18 +287,18 @@ struct DrawNode<D, StateChange> {
const std::map<std::string, Value *> *extra_fields;
const Color *color=NULL;
extra_fields = state->get_value()->get_extra_fields();
bool display=false;
if(!Session::get_use_palette("palette")) display = true;
else{
else{
if (state->get_value()){
if(!Session::_palette)Session::_palette=Session::get_palette("palette", Session::get_current_palette("palette"));
Palette * sp = Session::get_palette("palette", Session::get_current_palette("palette"));
//const std::list<std::string> * event_types = Session::get_event_types();
color= Session::_palette->get_color(state->get_value()->get_name().to_string());
color = sp->get_color(state->get_value()->get_name().to_string());
if(color) display=true;
}
}
if(display){
......@@ -312,21 +312,21 @@ struct DrawNode<D, StateChange> {
if(color==NULL){
// Search the color
if (state->get_value() &&
extra_fields!=NULL &&
extra_fields!=NULL &&
!extra_fields->empty() &&
((field = extra_fields->find(std::string("Color"))) != extra_fields->end())) {
/* Call the object state drawing function with the state color */
/* Call the object state drawing function with the state color */
color = (const Color *)(*field).second;
}
else {
/* Call the object state drawing function with default color */
color= new Color (0.7, 0.7, 0.75);
/* Call the object state drawing function with default color */
color= new Color (0.7, 0.7, 0.75);
}
}
draw->draw_state(state->get_start_time().get_value(), max,
color->get_red(), color->get_green(), color->get_blue());
}
}
};
......@@ -356,11 +356,11 @@ void DrawTree<D, E>::browse_tree(const Interval &I, Node<E> *node, bool &b) {
else
n_children = 0;
// If the node is in the interval
Date time = node->get_element()->get_time();
if(time <= I._right && time >= I._left) {
// If the node can be displayed (interval is wide enought)
if (I._right - I._left > _min_size){
// Launching Recursively in children
......@@ -369,31 +369,31 @@ void DrawTree<D, E>::browse_tree(const Interval &I, Node<E> *node, bool &b) {
node->get_left_child(),
b);
if (n_children >= 2)//right
browse_tree(Interval(time, I._right),
browse_tree(Interval(time, I._right),
node->get_right_child(),
b);
// If node's left son has a conflict on it's left side
if(n_children >= 1 && node->get_left_child()->_left_interval) {
// Setting the node's left interval as busy
node->_left_interval = new Interval(node->get_left_child()->_left_interval->_left,
node->get_left_child()->_left_interval->_right);
}
}
// Else no problem on the left (if a leaf, treated later)
else {
node->_left_interval = NULL;
}
// Looking for conflict to display the node
if(n_children >= 2 &&
node->get_left_child()->_right_interval &&
node->get_right_child()->_left_interval) {
// Drawing a crowded area
draw_busy(new Interval(node->get_left_child()->_right_interval->_left,
node->get_right_child()->_left_interval->_right));
displayed = true;
delete node->get_left_child()->_right_interval;
delete node->get_right_child()->_left_interval;
node->get_right_child()->_left_interval = NULL;
......@@ -414,8 +414,8 @@ void DrawTree<D, E>::browse_tree(const Interval &I, Node<E> *node, bool &b) {
delete node->get_right_child()->_left_interval;
node->get_right_child()->_left_interval = NULL;
}
// If node's right son has a conflict on it's right side
if(n_children >= 2 && node->get_right_child()->_right_interval) {
// Setting the node's right interval as busy
......@@ -425,7 +425,7 @@ void DrawTree<D, E>::browse_tree(const Interval &I, Node<E> *node, bool &b) {
else {
node->_right_interval = NULL;
}
// Treating the special case of a leaf
if(n_children == 0){
//If too close of the previous node
......@@ -440,7 +440,7 @@ void DrawTree<D, E>::browse_tree(const Interval &I, Node<E> *node, bool &b) {
}
}
// Making sure node has been displayed
if(!displayed) {
DrawNode<D, E>::draw_node(this, node,b,&I);
......@@ -463,11 +463,10 @@ void DrawTree<D, E>::browse_tree(const Interval &I, Node<E> *node, bool &b) {
// Else he is before
else if (n_children >= 2) {
browse_tree(I, node->get_right_child(),b);
node->_left_interval = NULL;
node->_left_interval = NULL;
node->_right_interval = node->get_right_child()->_right_interval;
}
} // end else is in the interval
}
#endif
......@@ -54,8 +54,7 @@
/* -- */
#include "common/Message.hpp"
#include "common/Session.hpp"
/* -- */
#include "render/Palette.hpp"
#include "common/Palette.hpp"
/* -- */
#include "trace/values/Values.hpp"
#include "trace/tree/Interval.hpp"
......@@ -103,27 +102,6 @@ Trace::Trace(): _max_date(0.0) {
_filter = 0;
_interval_constrained = NULL;
_depth = 0;
#ifndef WITHOUT_QT
if(Session::get_use_palette("palette"))
Session::_palette = Session::get_palette("palette", Session::get_current_palette("palette"));
else
#endif
Session::_palette = NULL;
#ifndef WITHOUT_QT
if(Session::get_use_palette("link_types"))
Session::_link_types = Session::get_palette("link_types", Session::get_current_palette("link_types"));
else
#endif
Session::_link_types = NULL;
#ifndef WITHOUT_QT
if(Session::get_use_palette("event_types"))
Session::_event_types = Session::get_palette("event_types", Session::get_current_palette("event_types"));
else
#endif
Session::_event_types = NULL;
}
template <class T>
......
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