diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp index 055244a6a..598c1c8a4 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp @@ -38,7 +38,6 @@ #include #include -#include #include using namespace Gui; @@ -422,11 +421,9 @@ void TaskOrthoViews::pagesize(std::string& page_template) if (found != std::string::npos) { temp_line = line.substr(7+found); - found = temp_line.find("\""); - temp_line = temp_line.substr(0,found); - std::stringstream num_str(temp_line); - num_str >> pagewidth; + sscanf (temp_line.c_str(), "%f", &pagewidth); pagewidth -= 2*margin; + if (done) { file.close(); @@ -435,17 +432,15 @@ void TaskOrthoViews::pagesize(std::string& page_template) else done = true; } - + found = line.find("height="); if (found != std::string::npos) { temp_line = line.substr(8+found); - found = temp_line.find("\""); - temp_line = temp_line.substr(0,found); - std::stringstream num_str_2(temp_line); - num_str_2 >> pageh1; + sscanf (temp_line.c_str(), "%f", &pageh1); pageh1 -= 2*margin; pageh2 = pageh1; + if (done) { file.close(); @@ -454,7 +449,7 @@ void TaskOrthoViews::pagesize(std::string& page_template) else done = true; } - + if (line.find("metadata") != std::string::npos) //give up if we meet a metadata tag break; } @@ -483,7 +478,7 @@ void TaskOrthoViews::autodims(float s1_x, float s1_y, float s2_x, float s2_y) width += (s2_x != 0) * views[2]->width; height += (s2_y != 0) * views[2]->height; - int pageheight; //allow extra page height if view arrangement avoids the information box on the bottom right + float pageheight; //allow extra page height if view arrangement avoids the information box on the bottom right if (((s1_x + s1_y + s2_x + s2_y) == 2) && (views[0]->width <= width/2)) pageheight = pageh1; else diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.h b/src/Mod/Drawing/Gui/TaskOrthoViews.h index 1e97d4169..eae284a9d 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.h +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.h @@ -117,7 +117,7 @@ private: int proj; //first (=-1) or third (=1) angle projection float scale; //scale of drawing bool autoscale; //whether or not to run autodims - int pagewidth, pageh1, pageh2; //these are actually the available width and height, calculated in constructor. + float pagewidth, pageh1, pageh2; //these are actually the available width and height, calculated in constructor. int margin; int min_space; //minimum space between views, and page edge };