From 9f7bda01cf39837cef4c708d645c8e6a765f7dc4 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Wed, 25 May 2005 15:39:06 +0000 Subject: [PATCH] Get rid of the small table, make much of the code and the UI easier svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=418091 --- kalzium/src/element.cpp | 31 ++++++------------------------- kalzium/src/element.h | 2 +- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index 925c99f..e58d06f 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -286,8 +286,8 @@ QColor Element::currentColor( double temp ) if ( _az == 4 ) color=Prefs::color_artificial(); } - double iButton_melting = melting(); - double iButton_boiling = boiling(); + const double iButton_melting = melting(); + const double iButton_boiling = boiling(); if ( temp < iButton_melting ) { //the element is solid @@ -302,8 +302,8 @@ QColor Element::currentColor( double temp ) { //the element is vaporous color= Prefs::color_vapor(); } - return color; + return color; } void Element::drawHighlight( QPainter* p, int coordinate, bool horizontal ) @@ -332,7 +332,7 @@ void Element::drawHighlight( QPainter* p, int coordinate, bool horizontal ) p->fillRect( X, Y,ELEMENTSIZE,ELEMENTSIZE, Qt::darkRed ); //now draw the elements over the red area - drawSelf( p, false ); + drawSelf( p ); } void Element::drawGradient( QPainter* p, const QString& value, const QColor& c) @@ -371,32 +371,13 @@ void Element::drawGradient( QPainter* p, const QString& value, const QColor& c) p->drawRoundRect( X+1, Y+1,ELEMENTSIZE-2,ELEMENTSIZE-2); } -void Element::drawSelf( QPainter* p, bool useSimpleView ) +void Element::drawSelf( QPainter* p ) { //the height of a "line" inside an element int h_small = 15; //the size for the small units like elementnumber //The X-coordiante - int X = 0; - - if ( useSimpleView ) - {//use the small periodic table without the d- and f-Block - if ( block() == "f" ) - return; - if ( block() == "d" ) - return; - if ( block() == "p" ) - { - X = ( x-1 )*ELEMENTSIZE; - X -= 10*ELEMENTSIZE; - } - if ( block() == "s" ) - { - X = ( x-1 )*ELEMENTSIZE; - } - } - else //use the full table - X = ( x-1 )*ELEMENTSIZE; + int X = ( x-1 )*ELEMENTSIZE; //The Y-coordinate int Y = ( y-1 )*ELEMENTSIZE; diff --git a/kalzium/src/element.h b/kalzium/src/element.h index 1b29e6c..301c8bb 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -351,7 +351,7 @@ class Element{ */ virtual void drawGradient( QPainter* p, const QString& value, const QColor& ); - virtual void drawSelf( QPainter* p, bool showFullInformation ); + virtual void drawSelf( QPainter* p ); /** * Highlight perdiods or groups. -- 2.47.3