[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
committed by
WandererFan
parent
a207d11fa4
commit
e92ed45df9
@@ -42,7 +42,7 @@ using namespace DrawingGui;
|
||||
using namespace std;
|
||||
namespace bp = boost::placeholders;
|
||||
|
||||
#if 0// needed for Qt's lupdate utility
|
||||
#if 0 // needed for Qt's lupdate utility
|
||||
qApp->translate("QObject", "Make axonometric...");
|
||||
qApp->translate("QObject", "Edit axonometric settings...");
|
||||
qApp->translate("QObject", "Make orthographic");
|
||||
@@ -51,12 +51,12 @@ namespace bp = boost::placeholders;
|
||||
|
||||
void pagesize(string& page_template, int dims[4], int block[4])
|
||||
{
|
||||
dims[0] = 10;// default to A4_Landscape with 10mm margins
|
||||
dims[0] = 10; // default to A4_Landscape with 10mm margins
|
||||
dims[1] = 10;
|
||||
dims[2] = 287;
|
||||
dims[3] = 200;
|
||||
|
||||
block[0] = block[1] = 0;// default to no title block
|
||||
block[0] = block[1] = 0; // default to no title block
|
||||
block[2] = block[3] = 0;
|
||||
|
||||
int t0, t1, t2, t3 = 0;
|
||||
@@ -65,8 +65,8 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
Base::FileInfo fi(page_template);
|
||||
if (!fi.isReadable()) {
|
||||
fi.setFile(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName());
|
||||
if (!fi.isReadable()) {// if so then really shouldn't have been able to get this far, but
|
||||
// just in case...
|
||||
if (!fi.isReadable()) { // if so then really shouldn't have been able to get this far, but
|
||||
// just in case...
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
&dims[0],
|
||||
&dims[1],
|
||||
&dims[2],
|
||||
&dims[3]);// eg " <!-- Working space 10 10 410 287 -->"
|
||||
&dims[3]); // eg " <!-- Working space 10 10 410 287 -->"
|
||||
getline(file, line);
|
||||
|
||||
if (line.find("<!-- Title block") != string::npos) {
|
||||
@@ -92,13 +92,13 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
&t0,
|
||||
&t1,
|
||||
&t2,
|
||||
&t3);// eg " <!-- Working space 10 10 410 287 -->"
|
||||
&t3); // eg " <!-- Working space 10 10 410 287 -->"
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (line.find("metadata") != string::npos) {// give up if we meet a metadata tag
|
||||
if (line.find("metadata") != string::npos) { // give up if we meet a metadata tag
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,26 +108,26 @@ void pagesize(string& page_template, int dims[4], int block[4])
|
||||
|
||||
|
||||
if (t3 != 0) {
|
||||
block[2] = t2 - t0;// block width
|
||||
block[3] = t3 - t1;// block height
|
||||
block[2] = t2 - t0; // block width
|
||||
block[3] = t3 - t1; // block height
|
||||
|
||||
if (t0 <= dims[0]) {// title block on left
|
||||
if (t0 <= dims[0]) { // title block on left
|
||||
block[0] = -1;
|
||||
}
|
||||
else if (t2 >= dims[2]) {// title block on right
|
||||
else if (t2 >= dims[2]) { // title block on right
|
||||
block[0] = 1;
|
||||
}
|
||||
|
||||
if (t1 <= dims[1]) {// title block at top
|
||||
if (t1 <= dims[1]) { // title block at top
|
||||
block[1] = 1;
|
||||
}
|
||||
else if (t3 >= dims[3]) {// title block at bottom
|
||||
else if (t3 >= dims[3]) { // title block at bottom
|
||||
block[1] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
dims[2] -= dims[0];// width
|
||||
dims[3] -= dims[1];// height
|
||||
dims[2] -= dims[0]; // width
|
||||
dims[3] -= dims[1]; // height
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ void orthoview::set_data(int r_x, int r_y)
|
||||
rel_y = r_y;
|
||||
|
||||
char label[15];
|
||||
sprintf(label, "Ortho_%i_%i", rel_x, rel_y);// label name for view, based on relative position
|
||||
sprintf(label, "Ortho_%i_%i", rel_x, rel_y); // label name for view, based on relative position
|
||||
|
||||
this_view->Label.setValue(label);
|
||||
ortho = ((rel_x * rel_y) == 0);
|
||||
@@ -288,7 +288,7 @@ OrthoViews::OrthoViews(App::Document* doc, const char* pagename, const char* par
|
||||
Gui::Application::Instance->showViewProvider(page);
|
||||
load_page();
|
||||
|
||||
min_space = 15;// should be preferenced
|
||||
min_space = 15; // should be preferenced
|
||||
|
||||
min_r_x = max_r_x = 0;
|
||||
min_r_y = max_r_y = 0;
|
||||
@@ -357,15 +357,15 @@ void OrthoViews::load_page()
|
||||
title = true;
|
||||
|
||||
// max vertical space avoiding title block
|
||||
small_v[1] = large[1]; // y margin same as large page
|
||||
small_v[3] = large[3]; // y size same as large page
|
||||
small_v[2] = large[2] - block[2];// x width same as large width - block width
|
||||
small_v[1] = large[1]; // y margin same as large page
|
||||
small_v[3] = large[3]; // y size same as large page
|
||||
small_v[2] = large[2] - block[2]; // x width same as large width - block width
|
||||
if (block[0] == -1) {
|
||||
small_v[0] = large[0] + block[2];// x margin same as large + block width
|
||||
small_v[0] = large[0] + block[2]; // x margin same as large + block width
|
||||
horiz = &min_r_x;
|
||||
}
|
||||
else {
|
||||
small_v[0] = large[0];// x margin same as large
|
||||
small_v[0] = large[0]; // x margin same as large
|
||||
horiz = &max_r_x;
|
||||
}
|
||||
|
||||
@@ -387,8 +387,8 @@ void OrthoViews::load_page()
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::calc_layout_size()// calculate the real world size of given view layout, assuming
|
||||
// no space
|
||||
void OrthoViews::calc_layout_size() // calculate the real world size of given view layout, assuming
|
||||
// no space
|
||||
{
|
||||
// note that views in relative positions x = -4, -2, 0 , 2 etc etc
|
||||
// have width = orientated part width
|
||||
@@ -403,44 +403,44 @@ void OrthoViews::calc_layout_size()// calculate the real world size of given vie
|
||||
layout_height += (ceil(max_r_y / 2.0) + ceil(-min_r_y / 2.0)) * depth;
|
||||
}
|
||||
|
||||
void OrthoViews::choose_page()// chooses which bit of page space to use depending upon layout &
|
||||
// titleblock
|
||||
void OrthoViews::choose_page() // chooses which bit of page space to use depending upon layout &
|
||||
// titleblock
|
||||
{
|
||||
int h = abs(
|
||||
*horiz);// how many views in direction of title block (horiz points to min_r_x or max_r_x)
|
||||
int h = abs(*horiz); // how many views in direction of title block (horiz points to min_r_x or
|
||||
// max_r_x)
|
||||
int v = abs(*vert);
|
||||
float layout_corner_width = (1 + floor(h / 2.0)) * width
|
||||
+ ceil(h / 2.0) * depth;// from (0, 0) view inclusively, how wide and tall is the layout in
|
||||
// the direction of the title block
|
||||
+ ceil(h / 2.0) * depth; // from (0, 0) view inclusively, how wide and tall is the layout
|
||||
// in the direction of the title block
|
||||
float layout_corner_height = (1 + floor(v / 2.0)) * height + ceil(v / 2.0) * depth;
|
||||
float rel_space_x = layout_corner_width / layout_width
|
||||
- 1.0 * block[2] / large[2];// relative to respective sizes, how much space between (0, 0)
|
||||
// and title block,
|
||||
- 1.0 * block[2] / large[2]; // relative to respective sizes, how much space between (0, 0)
|
||||
// and title block,
|
||||
float rel_space_y = layout_corner_height / layout_height
|
||||
- 1.0 * block[3]
|
||||
/ large[3];// can be -ve if block extends into / beyond (0, 0) view
|
||||
- 1.0 * block[3] / large[3]; // can be -ve if block extends into /
|
||||
// beyond (0, 0) view
|
||||
float view_x, view_y, v_x_r, v_y_r;
|
||||
bool interferes = false;
|
||||
float a, b;
|
||||
|
||||
for (int i = min_r_x; i <= max_r_x; i++) {
|
||||
for (int j = min_r_y; j <= max_r_y; j++) {
|
||||
if (index(i, j) != -1)// is there a view in this position?
|
||||
if (index(i, j) != -1) // is there a view in this position?
|
||||
{
|
||||
a = i * block[0]
|
||||
* 0.5;// reflect i and j so as +ve is in direction of title block ##
|
||||
* 0.5; // reflect i and j so as +ve is in direction of title block ##
|
||||
b = j * block[1] * 0.5;
|
||||
view_x = ceil(a + 0.5) * width
|
||||
+ ceil(a) * depth;// extreme coords of view in direction of block, measured from
|
||||
// far corner of (0, 0) view,
|
||||
+ ceil(a) * depth; // extreme coords of view in direction of block, measured
|
||||
// from far corner of (0, 0) view,
|
||||
view_y = ceil(b + 0.5) * height
|
||||
+ ceil(b) * depth;// can be -ve if view is on opposite side
|
||||
// of (0, 0) from title block
|
||||
v_x_r = view_x / layout_width;// make relative
|
||||
+ ceil(b) * depth; // can be -ve if view is on opposite
|
||||
// side of (0, 0) from title block
|
||||
v_x_r = view_x / layout_width; // make relative
|
||||
v_y_r = view_y / layout_height;
|
||||
if (v_x_r > rel_space_x
|
||||
&& v_y_r > rel_space_y) {// ## so that can use > in this condition regardless of
|
||||
// position of block
|
||||
&& v_y_r > rel_space_y) { // ## so that can use > in this condition regardless
|
||||
// of position of block
|
||||
interferes = true;
|
||||
}
|
||||
}
|
||||
@@ -461,7 +461,7 @@ void OrthoViews::choose_page()// chooses which bit of page space to use dependin
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::calc_scale()// compute scale required to meet minimum space requirements
|
||||
void OrthoViews::calc_scale() // compute scale required to meet minimum space requirements
|
||||
{
|
||||
float scale_x, scale_y, working_scale;
|
||||
|
||||
@@ -474,24 +474,24 @@ void OrthoViews::calc_scale()// compute scale required to meet minimum space req
|
||||
// 'sensible' scale, rather than 0.28457239... eg if working_scale = 0.115, then we want to use
|
||||
// 0.1, similarly 7.65 -> 5, and 76.5 -> 50
|
||||
|
||||
float exponent = floor(log10(working_scale));// if working_scale = a * 10^b, what is b?
|
||||
working_scale *= pow(10, -exponent); // now find what 'a' is.
|
||||
float exponent = floor(log10(working_scale)); // if working_scale = a * 10^b, what is b?
|
||||
working_scale *= pow(10, -exponent); // now find what 'a' is.
|
||||
|
||||
float valid_scales[2][8] = {
|
||||
{1, 1.25, 2, 2.5, 3.75, 5, 7.5, 10},// equate to 1:10, 1:8, 1:5, 1:4, 3:8, 1:2, 3:4, 1:1
|
||||
{1, 1.5, 2, 3, 4, 5, 8, 10}}; // equate to 1:1, 3:2, 2:1, 3:1, 4:1, 5:1, 8:1, 10:1
|
||||
{1, 1.25, 2, 2.5, 3.75, 5, 7.5, 10}, // equate to 1:10, 1:8, 1:5, 1:4, 3:8, 1:2, 3:4, 1:1
|
||||
{1, 1.5, 2, 3, 4, 5, 8, 10}}; // equate to 1:1, 3:2, 2:1, 3:1, 4:1, 5:1, 8:1, 10:1
|
||||
|
||||
int i = 7;
|
||||
while (valid_scales[(exponent >= 0)][i]
|
||||
> working_scale) {// choose closest value smaller than 'a' from list.
|
||||
i -= 1; // choosing top list if exponent -ve, bottom list for +ve exponent
|
||||
> working_scale) { // choose closest value smaller than 'a' from list.
|
||||
i -= 1; // choosing top list if exponent -ve, bottom list for +ve exponent
|
||||
}
|
||||
|
||||
scale = valid_scales[(exponent >= 0)][i]
|
||||
* pow(10, exponent);// now have the appropriate scale, reapply the *10^b
|
||||
* pow(10, exponent); // now have the appropriate scale, reapply the *10^b
|
||||
}
|
||||
|
||||
void OrthoViews::calc_offsets()// calcs SVG coords for centre of upper left view
|
||||
void OrthoViews::calc_offsets() // calcs SVG coords for centre of upper left view
|
||||
{
|
||||
// space_x is the empty clear white space between views
|
||||
// gap_x is the centre - centre distance between views
|
||||
@@ -517,7 +517,7 @@ void OrthoViews::calc_offsets()// calcs SVG coords for centre of upper left view
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_views()// process all views - scale & positions
|
||||
void OrthoViews::set_views() // process all views - scale & positions
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
@@ -534,7 +534,7 @@ void OrthoViews::set_views()// process all views - scale & positions
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::process_views()// update scale and positions of views
|
||||
void OrthoViews::process_views() // update scale and positions of views
|
||||
{
|
||||
if (autodims) {
|
||||
calc_layout_size();
|
||||
@@ -573,7 +573,8 @@ void OrthoViews::set_smooth(bool state)
|
||||
parent_doc->recompute();
|
||||
}
|
||||
|
||||
void OrthoViews::set_primary(gp_Dir facing, gp_Dir right)// set the orientation of the primary view
|
||||
void OrthoViews::set_primary(gp_Dir facing,
|
||||
gp_Dir right) // set the orientation of the primary view
|
||||
{
|
||||
primary.SetDirection(facing);
|
||||
primary.SetXDirection(right);
|
||||
@@ -591,16 +592,16 @@ void OrthoViews::set_primary(gp_Dir facing, gp_Dir right)// set the orientation
|
||||
}
|
||||
else {
|
||||
views[0]->set_projection(primary);
|
||||
set_all_orientations();// reorient all other views appropriately
|
||||
set_all_orientations(); // reorient all other views appropriately
|
||||
process_views();
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_orientation(int index)// set orientation of single view
|
||||
void OrthoViews::set_orientation(int index) // set orientation of single view
|
||||
{
|
||||
double rotation;
|
||||
int n; // how many 90* rotations from primary view?
|
||||
gp_Dir dir;// rotate about primary x axis (if in a relative y position) or y axis?
|
||||
int n; // how many 90* rotations from primary view?
|
||||
gp_Dir dir; // rotate about primary x axis (if in a relative y position) or y axis?
|
||||
gp_Ax2 cs;
|
||||
|
||||
if (views[index]->ortho) {
|
||||
@@ -613,16 +614,16 @@ void OrthoViews::set_orientation(int index)// set orientation of single view
|
||||
n = -views[index]->rel_y;
|
||||
}
|
||||
|
||||
rotation = n * rotate_coeff * M_PI / 2;// rotate_coeff is -1 or 1 for 1st or 3rd angle
|
||||
rotation = n * rotate_coeff * M_PI / 2; // rotate_coeff is -1 or 1 for 1st or 3rd angle
|
||||
cs = primary.Rotated(gp_Ax1(gp_Pnt(0, 0, 0), dir), rotation);
|
||||
views[index]->set_projection(cs);
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_all_orientations()// set orientations of all views (ie projection or primary
|
||||
// changed)
|
||||
void OrthoViews::set_all_orientations() // set orientations of all views (ie projection or primary
|
||||
// changed)
|
||||
{
|
||||
for (unsigned int i = 1; i < views.size(); i++)// start from 1 - the 0 is the primary view
|
||||
for (unsigned int i = 1; i < views.size(); i++) // start from 1 - the 0 is the primary view
|
||||
{
|
||||
if (views[i]->ortho) {
|
||||
set_orientation(i);
|
||||
@@ -633,7 +634,7 @@ void OrthoViews::set_all_orientations()// set orientations of all views (ie proj
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_projection(int proj)// 1 = 1st angle, 3 = 3rd angle
|
||||
void OrthoViews::set_projection(int proj) // 1 = 1st angle, 3 = 3rd angle
|
||||
{
|
||||
if (proj == 3) {
|
||||
rotate_coeff = 1;
|
||||
@@ -646,7 +647,7 @@ void OrthoViews::set_projection(int proj)// 1 = 1st angle, 3 = 3rd angle
|
||||
process_views();
|
||||
}
|
||||
|
||||
void OrthoViews::add_view(int rel_x, int rel_y)// add a new view to the layout
|
||||
void OrthoViews::add_view(int rel_x, int rel_y) // add a new view to the layout
|
||||
{
|
||||
if (index(rel_x, rel_y) == -1) {
|
||||
orthoview* view = new orthoview(parent_doc, part, page, &bbox);
|
||||
@@ -676,7 +677,7 @@ void OrthoViews::add_view(int rel_x, int rel_y)// add a new view to the layout
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::del_view(int rel_x, int rel_y)// remove a view from the layout
|
||||
void OrthoViews::del_view(int rel_x, int rel_y) // remove a view from the layout
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
@@ -691,9 +692,9 @@ void OrthoViews::del_view(int rel_x, int rel_y)// remove a view from the layout
|
||||
min_r_x = max_r_x = 0;
|
||||
min_r_y = max_r_y = 0;
|
||||
|
||||
for (unsigned int i = 1; i < views.size(); i++)// start from 1 - the 0 is the primary view
|
||||
for (unsigned int i = 1; i < views.size(); i++) // start from 1 - the 0 is the primary view
|
||||
{
|
||||
min_r_x = min(min_r_x, views[i]->rel_x);// calculate extremes from remaining views
|
||||
min_r_x = min(min_r_x, views[i]->rel_x); // calculate extremes from remaining views
|
||||
max_r_x = max(max_r_x, views[i]->rel_x);
|
||||
min_r_y = min(min_r_y, views[i]->rel_y);
|
||||
max_r_y = max(max_r_y, views[i]->rel_y);
|
||||
@@ -709,7 +710,7 @@ void OrthoViews::del_view(int rel_x, int rel_y)// remove a view from the layout
|
||||
void OrthoViews::del_all()
|
||||
{
|
||||
boost::signals2::shared_connection_block blocker(connectDocumentDeletedObject);
|
||||
for (int i = views.size() - 1; i >= 0; i--)// count downwards to delete from back
|
||||
for (int i = views.size() - 1; i >= 0; i--) // count downwards to delete from back
|
||||
{
|
||||
views[i]->deleteme();
|
||||
delete views[i];
|
||||
@@ -717,7 +718,7 @@ void OrthoViews::del_all()
|
||||
}
|
||||
}
|
||||
|
||||
int OrthoViews::is_Ortho(int rel_x, int rel_y)// is the view at r_x, r_y an ortho or axo one?
|
||||
int OrthoViews::is_Ortho(int rel_x, int rel_y) // is the view at r_x, r_y an ortho or axo one?
|
||||
{
|
||||
int result = index(rel_x, rel_y);
|
||||
|
||||
@@ -728,7 +729,7 @@ int OrthoViews::is_Ortho(int rel_x, int rel_y)// is the view at r_x, r_y an orth
|
||||
return result;
|
||||
}
|
||||
|
||||
int OrthoViews::index(int rel_x, int rel_y)// index in vector of view, -1 if doesn't exist
|
||||
int OrthoViews::index(int rel_x, int rel_y) // index in vector of view, -1 if doesn't exist
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
@@ -744,7 +745,7 @@ int OrthoViews::index(int rel_x, int rel_y)// index in vector of view, -1 if doe
|
||||
|
||||
void OrthoViews::set_Axo_scale(int rel_x,
|
||||
int rel_y,
|
||||
float axo_scale)// set an axo scale independent of ortho ones
|
||||
float axo_scale) // set an axo scale independent of ortho ones
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
@@ -762,7 +763,7 @@ void OrthoViews::set_Axo(int rel_x,
|
||||
gp_Dir right,
|
||||
bool away,
|
||||
int axo,
|
||||
bool tri)// set custom axonometric view
|
||||
bool tri) // set custom axonometric view
|
||||
{
|
||||
double rotations[2];
|
||||
|
||||
@@ -810,18 +811,18 @@ void OrthoViews::set_Axo(int rel_x,
|
||||
parent_doc->recompute();
|
||||
}
|
||||
|
||||
void OrthoViews::set_Axo(int rel_x, int rel_y)// set view to default axo projection
|
||||
void OrthoViews::set_Axo(int rel_x, int rel_y) // set view to default axo projection
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
if (num != -1) {
|
||||
gp_Dir up = primary.YDirection();// default to view from up and right
|
||||
gp_Dir up = primary.YDirection(); // default to view from up and right
|
||||
gp_Dir right = primary.XDirection();
|
||||
bool away = false;
|
||||
|
||||
if (rel_x * rel_y != 0)// but change default if it's a diagonal position
|
||||
if (rel_x * rel_y != 0) // but change default if it's a diagonal position
|
||||
{
|
||||
if (rotate_coeff == 1)// third angle
|
||||
if (rotate_coeff == 1) // third angle
|
||||
{
|
||||
away = (rel_y < 0);
|
||||
|
||||
@@ -832,7 +833,7 @@ void OrthoViews::set_Axo(int rel_x, int rel_y)// set view to default axo project
|
||||
right = primary.XDirection();
|
||||
}
|
||||
}
|
||||
else// first angle
|
||||
else // first angle
|
||||
{
|
||||
away = (rel_y > 0);
|
||||
|
||||
@@ -848,7 +849,7 @@ void OrthoViews::set_Axo(int rel_x, int rel_y)// set view to default axo project
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_Ortho(int rel_x, int rel_y)// return view to orthographic
|
||||
void OrthoViews::set_Ortho(int rel_x, int rel_y) // return view to orthographic
|
||||
{
|
||||
int num = index(rel_x, rel_y);
|
||||
|
||||
@@ -896,7 +897,7 @@ void OrthoViews::auto_dims(bool setting)
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::set_configs(float configs[5])// for autodims off, set scale & positionings
|
||||
void OrthoViews::set_configs(float configs[5]) // for autodims off, set scale & positionings
|
||||
{
|
||||
if (!autodims) {
|
||||
scale = configs[0];
|
||||
@@ -908,7 +909,7 @@ void OrthoViews::set_configs(float configs[5])// for autodims off, set scale & p
|
||||
}
|
||||
}
|
||||
|
||||
void OrthoViews::get_configs(float configs[5])// get scale & positionings
|
||||
void OrthoViews::get_configs(float configs[5]) // get scale & positionings
|
||||
{
|
||||
configs[0] = scale;
|
||||
configs[1] = offset_x;
|
||||
@@ -948,24 +949,24 @@ TaskOrthoViews::TaskOrthoViews(QWidget* parent)
|
||||
// **********************************************************************
|
||||
|
||||
// [x+2][y+2]
|
||||
c_boxes[0][2] = ui->cb02;// left most, x = -2, y = 0
|
||||
c_boxes[0][2] = ui->cb02; // left most, x = -2, y = 0
|
||||
c_boxes[1][1] = ui->cb11;
|
||||
c_boxes[1][2] = ui->cb12;
|
||||
c_boxes[1][3] = ui->cb13;
|
||||
c_boxes[2][0] = ui->cb20;// top most, x = 0, y = -2
|
||||
c_boxes[2][0] = ui->cb20; // top most, x = 0, y = -2
|
||||
c_boxes[2][1] = ui->cb21;
|
||||
c_boxes[2][2] = ui->cb22;// centre (primary view) checkbox x = y = 0.
|
||||
c_boxes[2][2] = ui->cb22; // centre (primary view) checkbox x = y = 0.
|
||||
c_boxes[2][3] = ui->cb23;
|
||||
c_boxes[2][4] = ui->cb24;// bottom most, x = 0, y = 2
|
||||
c_boxes[2][4] = ui->cb24; // bottom most, x = 0, y = 2
|
||||
c_boxes[3][1] = ui->cb31;
|
||||
c_boxes[3][2] = ui->cb32;
|
||||
c_boxes[3][3] = ui->cb33;
|
||||
c_boxes[4][2] = ui->cb42;// right most, x = 2, y = 0
|
||||
c_boxes[4][2] = ui->cb42; // right most, x = 2, y = 0
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if ((abs(i - 2) + abs(j - 2))
|
||||
< 3)// if i,j combination corresponds to valid check box, then proceed with:
|
||||
< 3) // if i,j combination corresponds to valid check box, then proceed with:
|
||||
{
|
||||
connect(c_boxes[i][j], SIGNAL(toggled(bool)), this, SLOT(cb_toggled(bool)));
|
||||
connect(c_boxes[i][j],
|
||||
@@ -1018,7 +1019,7 @@ TaskOrthoViews::TaskOrthoViews(QWidget* parent)
|
||||
orthos->set_primary(facing, right);
|
||||
|
||||
txt_return = false;
|
||||
}// end of constructor
|
||||
} // end of constructor
|
||||
|
||||
TaskOrthoViews::~TaskOrthoViews()
|
||||
{
|
||||
@@ -1056,7 +1057,7 @@ void TaskOrthoViews::ShowContextMenu(const QPoint& pos)
|
||||
if (selectedItem) {
|
||||
QString text = selectedItem->text();
|
||||
|
||||
if (text == str_1)// make axo
|
||||
if (text == str_1) // make axo
|
||||
{
|
||||
orthos->set_Axo(dx, -dy);
|
||||
axo_r_x = dx;
|
||||
@@ -1065,7 +1066,7 @@ void TaskOrthoViews::ShowContextMenu(const QPoint& pos)
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
setup_axo_tab();
|
||||
}
|
||||
else if (text == str_2)// edit axo
|
||||
else if (text == str_2) // edit axo
|
||||
{
|
||||
axo_r_x = dx;
|
||||
axo_r_y = dy;
|
||||
@@ -1073,7 +1074,7 @@ void TaskOrthoViews::ShowContextMenu(const QPoint& pos)
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
setup_axo_tab();
|
||||
}
|
||||
else if (text == str_3)// make ortho
|
||||
else if (text == str_3) // make ortho
|
||||
{
|
||||
orthos->set_Ortho(dx, -dy);
|
||||
if (dx == axo_r_x && dy == axo_r_y) {
|
||||
@@ -1104,7 +1105,7 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
|
||||
if (toggle) {
|
||||
orthos->add_view(dx, -dy);
|
||||
if (dx * dy != 0)// adding an axo view
|
||||
if (dx * dy != 0) // adding an axo view
|
||||
{
|
||||
axo_r_x = dx;
|
||||
axo_r_y = dy;
|
||||
@@ -1113,11 +1114,11 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
setup_axo_tab();
|
||||
}
|
||||
}
|
||||
else// removing a view
|
||||
else // removing a view
|
||||
{
|
||||
if (!orthos->is_Ortho(dx, -dy))// is it an axo one?
|
||||
if (!orthos->is_Ortho(dx, -dy)) // is it an axo one?
|
||||
{
|
||||
if (dx == axo_r_x && dy == axo_r_y)// is it the one currently being edited?
|
||||
if (dx == axo_r_x && dy == axo_r_y) // is it the one currently being edited?
|
||||
{
|
||||
axo_r_x = 0;
|
||||
axo_r_y = 0;
|
||||
@@ -1132,7 +1133,7 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||
|
||||
void TaskOrthoViews::projectionChanged(int index)
|
||||
{
|
||||
int proj = 3 - 2 * index;// index = 0 = third angle
|
||||
int proj = 3 - 2 * index; // index = 0 = third angle
|
||||
orthos->set_projection(proj);
|
||||
|
||||
set_configs();
|
||||
@@ -1140,24 +1141,24 @@ void TaskOrthoViews::projectionChanged(int index)
|
||||
|
||||
void TaskOrthoViews::setPrimary(int /*dir*/)
|
||||
{
|
||||
int p_sel = ui->view_from->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axis_right->currentIndex();// index for entry selected for 'rightwards axis'
|
||||
int p_sel = ui->view_from->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axis_right->currentIndex(); // index for entry selected for 'rightwards axis'
|
||||
|
||||
int p_vec[3] = {0, 0, 0};// will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0};// will be vector for 'rightwards axis'
|
||||
int p_vec[3] = {0, 0, 0}; // will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0}; // will be vector for 'rightwards axis'
|
||||
int r[2] = {0, 1};
|
||||
|
||||
int pos = 1 - 2 * int(p_sel / 3);// 1 if p_sel = 0, 1, 2 or -1 if p_sel = 3, 4, 5
|
||||
p_sel = p_sel % 3; // p_sel = 0, 1, 2
|
||||
int pos = 1 - 2 * int(p_sel / 3); // 1 if p_sel = 0, 1, 2 or -1 if p_sel = 3, 4, 5
|
||||
p_sel = p_sel % 3; // p_sel = 0, 1, 2
|
||||
p_vec[p_sel] = pos;
|
||||
|
||||
for (int i = p_sel; i < 2;
|
||||
i++) {// make r[2] to be, {0, 1}, {0, 2}, or {1, 2} depending upon p_sel
|
||||
i++) { // make r[2] to be, {0, 1}, {0, 2}, or {1, 2} depending upon p_sel
|
||||
r[i] += 1;
|
||||
}
|
||||
|
||||
pos = 1 - 2 * int(r_sel / 2);// 1 if r_sel = 0, 1 or -1 if r_sel = 3, 4
|
||||
r_sel = r_sel % 2; // r_sel = 0, 1
|
||||
pos = 1 - 2 * int(r_sel / 2); // 1 if r_sel = 0, 1 or -1 if r_sel = 3, 4
|
||||
r_sel = r_sel % 2; // r_sel = 0, 1
|
||||
r_vec[r[r_sel]] = pos;
|
||||
|
||||
gp_Dir facing = gp_Dir(p_vec[0], p_vec[1], p_vec[2]);
|
||||
@@ -1200,7 +1201,7 @@ void TaskOrthoViews::smooth(int i)
|
||||
|
||||
void TaskOrthoViews::toggle_auto(int i)
|
||||
{
|
||||
if (i == 2)// auto scale switched on
|
||||
if (i == 2) // auto scale switched on
|
||||
{
|
||||
orthos->auto_dims(true);
|
||||
ui->label_4->setEnabled(false);
|
||||
@@ -1208,7 +1209,7 @@ void TaskOrthoViews::toggle_auto(int i)
|
||||
ui->label_6->setEnabled(false);
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
inputs[j]->setEnabled(false);// disable user input boxes
|
||||
inputs[j]->setEnabled(false); // disable user input boxes
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1218,7 +1219,7 @@ void TaskOrthoViews::toggle_auto(int i)
|
||||
ui->label_6->setEnabled(true);
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
inputs[j]->setEnabled(true);// enable user input boxes
|
||||
inputs[j]->setEnabled(true); // enable user input boxes
|
||||
}
|
||||
set_configs();
|
||||
}
|
||||
@@ -1305,15 +1306,15 @@ void TaskOrthoViews::setup_axo_tab()
|
||||
|
||||
void TaskOrthoViews::change_axo(int /*p*/)
|
||||
{
|
||||
int u_sel = ui->axoUp->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axoRight->currentIndex();// index for entry selected for 'rightwards axis'
|
||||
int u_sel = ui->axoUp->currentIndex(); // index for entry selected for 'view from'
|
||||
int r_sel = ui->axoRight->currentIndex(); // index for entry selected for 'rightwards axis'
|
||||
|
||||
int u_vec[3] = {0, 0, 0};// will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0};// will be vector for 'rightwards axis'
|
||||
int u_vec[3] = {0, 0, 0}; // will be the vector for 'view from'
|
||||
int r_vec[3] = {0, 0, 0}; // will be vector for 'rightwards axis'
|
||||
int r[2] = {0, 1};
|
||||
|
||||
int pos = 1 - 2 * int(u_sel / 3);// 1 if p_sel = 0,1,2 or -1 if p_sel = 3,4,5
|
||||
u_sel = u_sel % 3; // p_sel = 0,1,2
|
||||
int pos = 1 - 2 * int(u_sel / 3); // 1 if p_sel = 0,1,2 or -1 if p_sel = 3,4,5
|
||||
u_sel = u_sel % 3; // p_sel = 0,1,2
|
||||
u_vec[u_sel] = pos;
|
||||
|
||||
for (int i = u_sel; i < 2; i++) {
|
||||
@@ -1381,13 +1382,13 @@ void TaskOrthoViews::set_configs()
|
||||
bool TaskOrthoViews::user_input()
|
||||
{
|
||||
if (txt_return) {
|
||||
txt_return = false; // return was pressed while text box had focus
|
||||
ui->label_7->setFocus();// move focus out of text box
|
||||
return true; // return that we were editing
|
||||
txt_return = false; // return was pressed while text box had focus
|
||||
ui->label_7->setFocus(); // move focus out of text box
|
||||
return true; // return that we were editing
|
||||
}
|
||||
else {
|
||||
return false;// return that we weren't editing ---> treat as clicking OK... we can close the
|
||||
// GUI
|
||||
return false; // return that we weren't editing ---> treat as clicking OK... we can close
|
||||
// the GUI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user