diff --git a/src/Base/QuantityLexer.c b/src/Base/QuantityLexer.c index a27b4562d4..39ff67c2d3 100644 --- a/src/Base/QuantityLexer.c +++ b/src/Base/QuantityLexer.c @@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 95 -#define YY_END_OF_BUFFER 96 +#define YY_NUM_RULES 96 +#define YY_END_OF_BUFFER 97 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -370,26 +370,26 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[167] = +static yyconst flex_int16_t yy_accept[168] = { 0, - 0, 0, 0, 0, 96, 94, 4, 5, 36, 38, - 6, 74, 75, 25, 94, 94, 65, 29, 94, 49, - 94, 94, 94, 63, 1, 94, 94, 94, 77, 94, - 19, 24, 94, 94, 15, 13, 94, 94, 94, 94, - 22, 21, 94, 94, 94, 3, 95, 2, 5, 74, - 0, 74, 75, 68, 0, 28, 51, 0, 66, 53, + 0, 0, 0, 0, 97, 95, 4, 5, 36, 38, + 6, 75, 76, 25, 95, 95, 65, 29, 95, 49, + 95, 95, 95, 63, 1, 95, 95, 95, 78, 95, + 19, 24, 95, 95, 15, 13, 95, 95, 95, 95, + 22, 21, 95, 95, 95, 3, 96, 2, 5, 75, + 0, 75, 76, 68, 0, 28, 51, 0, 66, 53, 0, 64, 69, 0, 0, 0, 0, 34, 11, 0, 0, 0, 12, 0, 37, 0, 35, 27, 50, 0, 20, 14, 0, 43, 0, 26, 30, 52, 0, 18, - 42, 10, 0, 7, 45, 76, 0, 0, 0, 0, + 42, 10, 0, 7, 45, 77, 0, 0, 0, 0, - 0, 46, 0, 0, 32, 0, 16, 8, 41, 0, - 0, 73, 56, 55, 0, 67, 84, 0, 0, 0, - 82, 47, 70, 83, 72, 54, 62, 48, 44, 86, - 0, 40, 23, 85, 33, 88, 61, 71, 89, 0, - 91, 0, 0, 31, 0, 17, 9, 57, 78, 79, - 80, 0, 0, 90, 93, 92, 39, 0, 0, 81, - 87, 58, 59, 0, 60, 0 + 0, 46, 0, 0, 32, 0, 16, 8, 41, 70, + 0, 0, 74, 56, 55, 0, 67, 85, 0, 0, + 0, 83, 47, 71, 84, 73, 54, 62, 48, 44, + 87, 0, 40, 23, 86, 33, 89, 61, 72, 90, + 0, 92, 0, 0, 31, 0, 17, 9, 57, 79, + 80, 81, 0, 0, 91, 94, 93, 39, 0, 0, + 82, 88, 58, 59, 0, 60, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -412,9 +412,9 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 51, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 52, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 51, 1, 1, 1, 1, + 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 53, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -424,126 +424,126 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[53] = +static yyconst flex_int32_t yy_meta[54] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 + 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[168] = +static yyconst flex_int16_t yy_base[169] = { 0, - 0, 0, 50, 51, 219, 220, 220, 215, 47, 220, - 220, 54, 63, 220, 194, 195, 220, 220, 66, 177, - 187, 173, 199, 167, 220, 52, 52, 30, 162, 164, - 168, 220, 168, 80, 55, 112, 168, 155, 54, 177, - 67, 57, 88, 173, 151, 220, 220, 220, 198, 105, - 128, 144, 153, 220, 173, 220, 220, 172, 220, 220, - 155, 153, 220, 152, 155, 159, 166, 220, 220, 148, - 146, 157, 220, 148, 220, 149, 220, 220, 220, 160, - 220, 220, 150, 73, 151, 220, 220, 220, 143, 220, - 90, 220, 111, 220, 220, 220, 135, 145, 139, 129, + 0, 0, 51, 52, 221, 222, 222, 217, 48, 222, + 222, 55, 64, 222, 196, 197, 222, 222, 67, 179, + 189, 175, 201, 169, 222, 53, 53, 31, 164, 166, + 170, 222, 170, 81, 56, 113, 170, 157, 55, 179, + 68, 58, 89, 175, 53, 222, 222, 222, 201, 106, + 129, 145, 154, 222, 176, 222, 222, 175, 222, 222, + 158, 156, 222, 155, 158, 162, 169, 222, 222, 151, + 149, 160, 222, 151, 222, 152, 222, 222, 222, 163, + 222, 222, 154, 74, 155, 222, 222, 222, 146, 222, + 91, 222, 112, 222, 222, 222, 138, 149, 153, 142, - 124, 220, 121, 118, 220, 111, 220, 220, 220, 148, - 162, 167, 220, 220, 106, 220, 220, 102, 105, 104, - 220, 220, 220, 220, 220, 220, 220, 220, 220, 132, - 90, 220, 220, 220, 220, 220, 220, 220, 97, 83, - 89, 76, 76, 220, 68, 220, 220, 220, 220, 220, - 96, 95, 60, 220, 220, 220, 220, 45, 27, 220, - 220, 220, 220, 17, 220, 220, 54 + 127, 222, 130, 128, 222, 121, 222, 222, 222, 222, + 149, 163, 168, 222, 222, 116, 222, 222, 108, 111, + 108, 222, 222, 222, 222, 222, 222, 222, 222, 222, + 135, 101, 222, 222, 222, 222, 222, 222, 222, 109, + 89, 98, 83, 81, 222, 83, 222, 222, 222, 222, + 222, 109, 100, 65, 222, 222, 222, 222, 46, 28, + 222, 222, 222, 222, 18, 222, 222, 55 } ; -static yyconst flex_int16_t yy_def[168] = +static yyconst flex_int16_t yy_def[169] = { 0, - 166, 1, 167, 167, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 167, 1, 168, 168, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 0, 166 + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 0, 167 } ; -static yyconst flex_int16_t yy_nxt[273] = +static yyconst flex_int16_t yy_nxt[276] = { 0, 6, 7, 8, 9, 10, 11, 11, 12, 13, 13, 13, 13, 14, 15, 6, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 6, 26, 6, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 6, 40, 41, 42, 43, 6, 6, 44, 6, - 6, 45, 47, 47, 46, 50, 50, 50, 50, 165, - 72, 51, 50, 50, 50, 50, 52, 73, 51, 164, - 52, 53, 53, 53, 53, 48, 48, 51, 56, 64, - 65, 68, 84, 103, 51, 57, 58, 163, 96, 69, - 104, 70, 78, 97, 85, 66, 67, 98, 71, 79, + 6, 6, 45, 47, 47, 46, 50, 50, 50, 50, + 166, 72, 51, 50, 50, 50, 50, 52, 73, 51, + 165, 52, 53, 53, 53, 53, 48, 48, 51, 56, + 64, 65, 68, 84, 103, 51, 57, 58, 164, 96, + 69, 104, 70, 78, 97, 85, 66, 67, 98, 71, - 80, 100, 162, 161, 128, 105, 160, 159, 101, 106, - 129, 102, 81, 50, 50, 50, 50, 82, 158, 51, - 107, 157, 156, 83, 86, 108, 132, 155, 133, 87, - 154, 88, 153, 89, 111, 51, 112, 112, 112, 112, - 134, 152, 151, 150, 90, 149, 91, 135, 148, 92, - 143, 93, 50, 50, 50, 50, 52, 142, 51, 141, - 52, 53, 53, 53, 53, 144, 140, 139, 138, 145, - 112, 112, 112, 112, 51, 112, 112, 112, 112, 137, - 146, 136, 131, 130, 127, 147, 126, 125, 124, 123, - 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, + 79, 80, 100, 110, 111, 129, 105, 163, 162, 101, + 106, 130, 102, 81, 50, 50, 50, 50, 82, 161, + 51, 107, 160, 159, 83, 86, 108, 133, 158, 134, + 87, 157, 88, 156, 89, 112, 51, 113, 113, 113, + 113, 135, 155, 154, 153, 90, 152, 91, 136, 151, + 92, 150, 93, 50, 50, 50, 50, 52, 149, 51, + 144, 52, 53, 53, 53, 53, 145, 143, 142, 141, + 146, 113, 113, 113, 113, 51, 113, 113, 113, 113, + 140, 147, 139, 138, 137, 132, 148, 131, 128, 127, + 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, - 49, 110, 109, 99, 95, 94, 77, 76, 75, 74, - 63, 62, 61, 60, 59, 55, 54, 49, 166, 5, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166 + 116, 115, 114, 49, 109, 99, 95, 94, 77, 76, + 75, 74, 63, 62, 61, 60, 59, 55, 54, 49, + 167, 5, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167 } ; -static yyconst flex_int16_t yy_chk[273] = +static yyconst flex_int16_t yy_chk[276] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 4, 167, 9, 9, 9, 9, 164, - 28, 9, 12, 12, 12, 12, 13, 28, 12, 159, - 13, 13, 13, 13, 13, 3, 4, 9, 19, 26, - 26, 27, 35, 42, 12, 19, 19, 158, 39, 27, - 42, 27, 34, 39, 35, 26, 26, 39, 27, 34, + 1, 1, 1, 3, 4, 168, 9, 9, 9, 9, + 165, 28, 9, 12, 12, 12, 12, 13, 28, 12, + 160, 13, 13, 13, 13, 13, 3, 4, 9, 19, + 26, 26, 27, 35, 42, 12, 19, 19, 159, 39, + 27, 42, 27, 34, 39, 35, 26, 26, 39, 27, - 34, 41, 153, 152, 84, 43, 151, 145, 41, 43, - 84, 41, 34, 50, 50, 50, 50, 34, 143, 50, - 43, 142, 141, 34, 36, 43, 91, 140, 91, 36, - 139, 36, 131, 36, 51, 50, 51, 51, 51, 51, - 93, 130, 120, 119, 36, 118, 36, 93, 115, 36, - 106, 36, 52, 52, 52, 52, 53, 104, 52, 103, - 53, 53, 53, 53, 53, 110, 101, 100, 99, 110, - 111, 111, 111, 111, 52, 112, 112, 112, 112, 98, - 110, 97, 89, 85, 83, 110, 80, 76, 74, 72, - 71, 70, 67, 66, 65, 64, 62, 61, 58, 55, + 34, 34, 41, 45, 45, 84, 43, 154, 153, 41, + 43, 84, 41, 34, 50, 50, 50, 50, 34, 152, + 50, 43, 146, 144, 34, 36, 43, 91, 143, 91, + 36, 142, 36, 141, 36, 51, 50, 51, 51, 51, + 51, 93, 140, 132, 131, 36, 121, 36, 93, 120, + 36, 119, 36, 52, 52, 52, 52, 53, 116, 52, + 106, 53, 53, 53, 53, 53, 111, 104, 103, 101, + 111, 112, 112, 112, 112, 52, 113, 113, 113, 113, + 100, 111, 99, 98, 97, 89, 111, 85, 83, 80, + 76, 74, 72, 71, 70, 67, 66, 65, 64, 62, - 49, 45, 44, 40, 38, 37, 33, 31, 30, 29, - 24, 23, 22, 21, 20, 16, 15, 8, 5, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166 + 61, 58, 55, 49, 44, 40, 38, 37, 33, 31, + 30, 29, 24, 23, 22, 21, 20, 16, 15, 8, + 5, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167 } ; static yy_state_type yy_last_accepting_state; @@ -811,13 +811,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 167 ) + if ( yy_current_state >= 168 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 166 ); + while ( yy_current_state != 167 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -1191,17 +1191,17 @@ yylval = Quantity::Degree; return UNIT; // degree (internal case 71: YY_RULE_SETUP #line 123 "QuantityParser.l" -yylval = Quantity::Radian; return UNIT; // radian +yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) YY_BREAK case 72: YY_RULE_SETUP #line 124 "QuantityParser.l" -yylval = Quantity::Gon; return UNIT; // gon +yylval = Quantity::Radian; return UNIT; // radian YY_BREAK case 73: YY_RULE_SETUP -#line 126 "QuantityParser.l" -{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;} +#line 125 "QuantityParser.l" +yylval = Quantity::Gon; return UNIT; // gon YY_BREAK case 74: YY_RULE_SETUP @@ -1211,109 +1211,114 @@ YY_RULE_SETUP case 75: YY_RULE_SETUP #line 128 "QuantityParser.l" -{yylval = atof( yytext ); return NUM;} +{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;} YY_BREAK case 76: YY_RULE_SETUP -#line 130 "QuantityParser.l" -{yylval = M_PI ; return NUM;} // constant pi +#line 129 "QuantityParser.l" +{yylval = atof( yytext ); return NUM;} YY_BREAK case 77: YY_RULE_SETUP #line 131 "QuantityParser.l" -{yylval = M_E ; return NUM;} // constant e +{yylval = M_PI ; return NUM;} // constant pi YY_BREAK case 78: YY_RULE_SETUP -#line 133 "QuantityParser.l" -return ACOS; +#line 132 "QuantityParser.l" +{yylval = M_E ; return NUM;} // constant e YY_BREAK case 79: YY_RULE_SETUP #line 134 "QuantityParser.l" -return ASIN; +return ACOS; YY_BREAK case 80: YY_RULE_SETUP #line 135 "QuantityParser.l" -return ATAN; +return ASIN; YY_BREAK case 81: YY_RULE_SETUP #line 136 "QuantityParser.l" -return ATAN2; +return ATAN; YY_BREAK case 82: YY_RULE_SETUP #line 137 "QuantityParser.l" -return COS; +return ATAN2; YY_BREAK case 83: YY_RULE_SETUP #line 138 "QuantityParser.l" -return EXP; +return COS; YY_BREAK case 84: YY_RULE_SETUP #line 139 "QuantityParser.l" -return ABS; +return EXP; YY_BREAK case 85: YY_RULE_SETUP #line 140 "QuantityParser.l" -return MOD; +return ABS; YY_BREAK case 86: YY_RULE_SETUP #line 141 "QuantityParser.l" -return LOG; +return MOD; YY_BREAK case 87: YY_RULE_SETUP #line 142 "QuantityParser.l" -return LOG10; +return LOG; YY_BREAK case 88: YY_RULE_SETUP #line 143 "QuantityParser.l" -return POW; +return LOG10; YY_BREAK case 89: YY_RULE_SETUP #line 144 "QuantityParser.l" -return SIN; +return POW; YY_BREAK case 90: YY_RULE_SETUP #line 145 "QuantityParser.l" -return SINH; +return SIN; YY_BREAK case 91: YY_RULE_SETUP #line 146 "QuantityParser.l" -return TAN; +return SINH; YY_BREAK case 92: YY_RULE_SETUP #line 147 "QuantityParser.l" -return TANH; +return TAN; YY_BREAK case 93: YY_RULE_SETUP #line 148 "QuantityParser.l" -return SQRT; +return TANH; YY_BREAK case 94: YY_RULE_SETUP -#line 150 "QuantityParser.l" -return *yytext; +#line 149 "QuantityParser.l" +return SQRT; YY_BREAK case 95: YY_RULE_SETUP #line 151 "QuantityParser.l" +return *yytext; + YY_BREAK +case 96: +YY_RULE_SETUP +#line 152 "QuantityParser.l" ECHO; YY_BREAK -#line 1317 "QuantityLexer.c" +#line 1322 "QuantityLexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(C_COMMENT): yyterminate(); @@ -1607,7 +1612,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 167 ) + if ( yy_current_state >= 168 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1635,11 +1640,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 167 ) + if ( yy_current_state >= 168 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 166); + yy_is_jam = (yy_current_state == 167); return yy_is_jam ? 0 : yy_current_state; } @@ -2272,4 +2277,4 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 151 "QuantityParser.l" +#line 152 "QuantityParser.l" diff --git a/src/Base/QuantityParser.l b/src/Base/QuantityParser.l index a8761306f2..0f149c2041 100644 --- a/src/Base/QuantityParser.l +++ b/src/Base/QuantityParser.l @@ -119,6 +119,7 @@ ID [a-z][a-z0-9]* "CV" yylval = Quantity::WattSecond; return UNIT; // "Ws" yylval = Quantity::WattSecond; return UNIT; // W*s = Joule + "\xC2\xB0" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) "deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) "rad" yylval = Quantity::Radian; return UNIT; // radian "gon" yylval = Quantity::Gon; return UNIT; // gon diff --git a/src/Base/QuantityPyImp.cpp b/src/Base/QuantityPyImp.cpp index 598ee8fb66..a00405b362 100644 --- a/src/Base/QuantityPyImp.cpp +++ b/src/Base/QuantityPyImp.cpp @@ -16,7 +16,7 @@ std::string QuantityPy::representation(void) const { std::stringstream ret; ret << getQuantityPtr()->getValue() << " "; - ret << getQuantityPtr()->getUnit().getString(); + ret << getQuantityPtr()->getUnit().getString().toLatin1().constData(); return ret.str(); } diff --git a/src/Base/Unit.cpp b/src/Base/Unit.cpp index b560b74d87..09e5f2de3a 100644 --- a/src/Base/Unit.cpp +++ b/src/Base/Unit.cpp @@ -158,12 +158,12 @@ Unit& Unit::operator = (const Unit &New) return *this; } -std::string Unit::getString(void) const +QString Unit::getString(void) const { std::stringstream ret; if(isEmpty()) - return ""; + return QString(); if( Sig.Length > 0 || Sig.Mass > 0 || @@ -312,28 +312,28 @@ std::string Unit::getString(void) const if (nnom > 1) ret << ')'; } - return ret.str(); + return QString::fromUtf8(ret.str().c_str()); } -std::string Unit::getTypeString(void) const +QString Unit::getTypeString(void) const { - if(*this == Unit::Length ) return "Length"; else - if(*this == Unit::Area ) return "Area"; else - if(*this == Unit::Volume ) return "Volume"; else - if(*this == Unit::Mass ) return "Mass"; else - if(*this == Unit::Angle ) return "Angle"; else - if(*this == Unit::TimeSpan ) return "TimeSpan"; else - if(*this == Unit::Velocity ) return "Velocity"; else - if(*this == Unit::Acceleration ) return "Acceleration"; else - if(*this == Unit::Temperature ) return "Temperature"; else - if(*this == Unit::ElectricCurrent ) return "ElectricCurrent"; else - if(*this == Unit::AmountOfSubstance ) return "AmountOfSubstance"; else - if(*this == Unit::LuminoseIntensity ) return "LuminoseIntensity"; else - if(*this == Unit::Pressure ) return "Pressure"; else - if(*this == Unit::Force ) return "Force"; else - if(*this == Unit::Work ) return "Work"; else - if(*this == Unit::Power ) return "Power"; else - return ""; + if(*this == Unit::Length ) return QString::fromLatin1("Length"); else + if(*this == Unit::Area ) return QString::fromLatin1("Area"); else + if(*this == Unit::Volume ) return QString::fromLatin1("Volume"); else + if(*this == Unit::Mass ) return QString::fromLatin1("Mass"); else + if(*this == Unit::Angle ) return QString::fromLatin1("Angle"); else + if(*this == Unit::TimeSpan ) return QString::fromLatin1("TimeSpan"); else + if(*this == Unit::Velocity ) return QString::fromLatin1("Velocity"); else + if(*this == Unit::Acceleration ) return QString::fromLatin1("Acceleration"); else + if(*this == Unit::Temperature ) return QString::fromLatin1("Temperature"); else + if(*this == Unit::ElectricCurrent ) return QString::fromLatin1("ElectricCurrent"); else + if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance"); else + if(*this == Unit::LuminoseIntensity ) return QString::fromLatin1("LuminoseIntensity"); else + if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure"); else + if(*this == Unit::Force ) return QString::fromLatin1("Force"); else + if(*this == Unit::Work ) return QString::fromLatin1("Work"); else + if(*this == Unit::Power ) return QString::fromLatin1("Power"); else + return QString(); } diff --git a/src/Base/Unit.h b/src/Base/Unit.h index cb30d1ee29..ecb872556a 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -26,6 +26,7 @@ #ifdef _MSC_VER # include +# include #else # include #endif @@ -74,9 +75,9 @@ public: const UnitSignature & getSignature(void)const {return Sig;} bool isEmpty(void)const; - std::string getString(void) const; + QString getString(void) const; /// get the type as an string such as "Area", "Length" or "Pressure". - std::string getTypeString(void) const; + QString getTypeString(void) const; /** Predefined Unit types. */ //@{ diff --git a/src/Base/UnitPyImp.cpp b/src/Base/UnitPyImp.cpp index 9567bd3945..f050eeed79 100644 --- a/src/Base/UnitPyImp.cpp +++ b/src/Base/UnitPyImp.cpp @@ -16,7 +16,7 @@ std::string UnitPy::representation(void) const const UnitSignature & Sig = getUnitPtr()->getSignature(); std::stringstream ret; ret << "Unit: "; - ret << getUnitPtr()->getString() << " ("; + ret << getUnitPtr()->getString().toLatin1().constData() << " ("; ret << Sig.Length << ","; ret << Sig.Mass << ","; ret << Sig.Time << ","; @@ -25,7 +25,7 @@ std::string UnitPy::representation(void) const ret << Sig.AmountOfSubstance << ","; ret << Sig.LuminoseIntensity << ","; ret << Sig.Angle << ")"; - std::string type = getUnitPtr()->getTypeString(); + std::string type = getUnitPtr()->getTypeString().toLatin1(); if(! type.empty()) ret << " [" << type << "]"; @@ -178,7 +178,7 @@ PyObject* UnitPy::richCompare(PyObject *v, PyObject *w, int op) Py::String UnitPy::getType(void) const { - return Py::String(getUnitPtr()->getTypeString()); + return Py::String(getUnitPtr()->getTypeString().toLatin1()); } diff --git a/src/Base/UnitsSchemaImperial1.cpp b/src/Base/UnitsSchemaImperial1.cpp index ab7873df04..16d7bb5800 100644 --- a/src/Base/UnitsSchemaImperial1.cpp +++ b/src/Base/UnitsSchemaImperial1.cpp @@ -69,10 +69,10 @@ QString UnitsSchemaImperial1::schemaTranslate(Base::Quantity quant,double &facto unitString = QString::fromLatin1("thou"); factor = 0.0254; }else if(UnitValue < 304.8){ - unitString = QString::fromLatin1("in"); + unitString = QString::fromLatin1("\""); factor = 25.4; }else if(UnitValue < 914.4){ - unitString = QString::fromLatin1("ft"); + unitString = QString::fromLatin1("\'"); factor = 304.8; }else if(UnitValue < 1609344.0){ unitString = QString::fromLatin1("yd"); @@ -112,7 +112,7 @@ QString UnitsSchemaImperial1::schemaTranslate(Base::Quantity quant,double &facto } }else{ // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); factor = 1.0; } return QString::fromLatin1("%1 %2").arg(UnitValue / factor).arg(unitString); diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp index 2157055584..2408ff2886 100644 --- a/src/Base/UnitsSchemaInternal.cpp +++ b/src/Base/UnitsSchemaInternal.cpp @@ -48,7 +48,7 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor unitString = QString::fromLatin1("nm"); factor = 0.000001; }else if(UnitValue < 1.0){ - unitString = QString::fromLatin1("ym"); + unitString = QString::fromUtf8("\xC2\xB5m"); factor = 0.001; }else if(UnitValue < 10000.0){ unitString = QString::fromLatin1("mm"); @@ -66,12 +66,17 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor }else if (unit == Unit::Area){ // TODO Cascade for the Areas // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); + factor = 1.0; + }else if (unit == Unit::Angle){ + // TODO Cascade for the Areas + // default action for all cases without special treatment: + unitString = QString::fromUtf8("\xC2\xB0"); factor = 1.0; }else if (unit == Unit::Mass){ // TODO Cascade for the wights // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); factor = 1.0; }else if (unit == Unit::Pressure){ if(UnitValue < 10.0){// Pa is the smallest @@ -89,9 +94,9 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor } }else{ // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); factor = 1.0; } - return QString::fromLatin1("%1 %2").arg(UnitValue / factor).arg(unitString); + return QString::fromUtf8("%1 %2").arg(UnitValue / factor).arg(unitString); } diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp index 4a54c77738..532d323042 100644 --- a/src/Base/UnitsSchemaMKS.cpp +++ b/src/Base/UnitsSchemaMKS.cpp @@ -48,7 +48,7 @@ QString UnitsSchemaMKS::schemaTranslate(Base::Quantity quant,double &factor,QStr unitString = QString::fromLatin1("nm"); factor = 0.000001; }else if(UnitValue < 1.0){ - unitString = QString::fromLatin1("ym"); + unitString = QString::fromUtf8("\xC2\xB5m"); factor = 0.001; }else if(UnitValue < 100.0){ unitString = QString::fromLatin1("mm"); @@ -66,12 +66,12 @@ QString UnitsSchemaMKS::schemaTranslate(Base::Quantity quant,double &factor,QStr }else if (unit == Unit::Area){ // TODO Cascade for the Areas // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); factor = 1.0; }else if (unit == Unit::Mass){ // TODO Cascade for the wights // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); factor = 1.0; }else if (unit == Unit::Pressure){ if(UnitValue < 10.0){// Pa is the smallest @@ -89,8 +89,8 @@ QString UnitsSchemaMKS::schemaTranslate(Base::Quantity quant,double &factor,QStr } }else{ // default action for all cases without special treatment: - unitString = QString::fromLatin1(quant.getUnit().getString().c_str()); + unitString = quant.getUnit().getString(); factor = 1.0; } - return QString::fromLatin1("%1 %2").arg(UnitValue / factor).arg(unitString); + return QString::fromUtf8("%1 %2").arg(UnitValue / factor).arg(unitString); } diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index d45429bbe2..b577a15a3d 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -67,24 +67,24 @@ void InputField::contextMenuEvent(QContextMenuEvent *event) menu->addSeparator(); // datastructure to remember actions for values - std::vector values; + std::vector values; std::vector actions; // add the history menu part... - std::vector history = getHistory(); + std::vector history = getHistory(); - for(std::vector::const_iterator it = history.begin();it!= history.end();++it){ - actions.push_back(menu->addAction(QString::fromAscii(it->c_str()))); + for(std::vector::const_iterator it = history.begin();it!= history.end();++it){ + actions.push_back(menu->addAction(*it)); values.push_back(*it); } // add the save value portion of the menu menu->addSeparator(); QAction *SaveValueAction = menu->addAction(tr("Save value")); - std::vector savedValues = getSavedValues(); + std::vector savedValues = getSavedValues(); - for(std::vector::const_iterator it = savedValues.begin();it!= savedValues.end();++it){ - actions.push_back(menu->addAction(QString::fromAscii(it->c_str()))); + for(std::vector::const_iterator it = savedValues.begin();it!= savedValues.end();++it){ + actions.push_back(menu->addAction(*it)); values.push_back(*it); } @@ -98,7 +98,7 @@ void InputField::contextMenuEvent(QContextMenuEvent *event) int i=0; for(std::vector::const_iterator it = actions.begin();it!=actions.end();++it,i++) if(*it == saveAction) - this->setText(QString::fromAscii(values[i].c_str())); + this->setText(values[i]); } delete menu; @@ -123,15 +123,20 @@ void InputField::newInput(const QString & text) setPalette(palette); ErrorText = ""; this->setToolTip(QString::fromAscii(ErrorText.c_str())); + actQuantity = res; // signaling valueChanged(res); } -void InputField::pushToHistory(std::string value) +void InputField::pushToHistory(const QString &valueq) { - if(value == "") - value = (const char*)this->text().toAscii(); + std::string value; + if(valueq.isEmpty()) + value = this->text().toUtf8().constData(); + else + value = valueq.toUtf8(); + if(_handle.isValid()){ char hist1[21]; char hist0[21]; @@ -146,9 +151,9 @@ void InputField::pushToHistory(std::string value) } } -std::vector InputField::getHistory(void) +std::vector InputField::getHistory(void) { - std::vector res; + std::vector res; if(_handle.isValid()){ std::string tmp; @@ -157,7 +162,7 @@ std::vector InputField::getHistory(void) snprintf(hist,20,"Hist%i",i); tmp = _handle->GetASCII(hist,""); if( tmp != "") - res.push_back(tmp); + res.push_back(QString::fromUtf8(tmp.c_str())); else break; // end of history reached } @@ -165,10 +170,14 @@ std::vector InputField::getHistory(void) return res; } -void InputField::pushToSavedValues(std::string value) +void InputField::pushToSavedValues(const QString &valueq) { - if(value == "") - value = (const char*)this->text().toAscii(); + std::string value; + if(valueq.isEmpty()) + value = this->text().toUtf8().constData(); + else + value = valueq.toUtf8(); + if(_handle.isValid()){ char hist1[21]; char hist0[21]; @@ -183,9 +192,9 @@ void InputField::pushToSavedValues(std::string value) } } -std::vector InputField::getSavedValues(void) +std::vector InputField::getSavedValues(void) { - std::vector res; + std::vector res; if(_handle.isValid()){ std::string tmp; @@ -194,7 +203,7 @@ std::vector InputField::getSavedValues(void) snprintf(hist,20,"Save%i",i); tmp = _handle->GetASCII(hist,""); if( tmp != "") - res.push_back(tmp); + res.push_back(QString::fromUtf8(tmp.c_str())); else break; // end of history reached } @@ -286,6 +295,18 @@ void InputField::setHistorySize(int i) HistorySize = i; } +void InputField::selectNumber(void) +{ + QByteArray str = text().toLatin1(); + unsigned int i = 0; + + while ( (str.at(i) >= '0' && str.at(i) <= '9') || str.at(i)== ',' || str.at(i)== '.'|| str.at(i)== '-' ) + i++; + + setSelection(0,i); + +} + // -------------------------------------------------------------------- diff --git a/src/Gui/InputField.h b/src/Gui/InputField.h index 7f2290cb3f..5ede1388eb 100644 --- a/src/Gui/InputField.h +++ b/src/Gui/InputField.h @@ -60,6 +60,8 @@ public: /// sets the field with a quantity void setValue(const Base::Quantity&); + /// get the actual value + Base::Quantity getQuantity(void)const{return this->actQuantity;} /** sets the Unit this field working with. * After seting the Unit the field will only acceppt * user input with this unit type. Or if the user input @@ -85,6 +87,9 @@ public: /// set the value of the minimum property void setHistorySize(int); + /// set the number portion selected (use after setValue()) + void selectNumber(void); + /** @name history and default management */ //@{ /// the param group path where the widget write and read the dafault values @@ -92,13 +97,13 @@ public: /// set the param group path where the widget write and read the dafault values void setParamGrpPath ( const QByteArray& name ); /// push a new value to the history, if no string given the actual text of the input field is used. - void pushToHistory(std::string value = std::string()); + void pushToHistory(const QString &valueq = QString()); /// get the history of the field, newest first - std::vector getHistory(void); + std::vector getHistory(void); /// push a new value to the history, if no string given the actual text of the input field is used. - void pushToSavedValues(std::string value = std::string()); + void pushToSavedValues(const QString &valueq = QString()); /// get the history of the field, newest first - std::vector getSavedValues(void); + std::vector getSavedValues(void); //@} diff --git a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp index cae9d5c48a..5c8a31c33b 100644 --- a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp +++ b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp @@ -81,10 +81,6 @@ void EditDatumDialog::exec(bool atCursor) return; } - double datum = Constr->Value; - if (Constr->Type == Sketcher::Angle) - datum = Base::toDegrees(datum); - Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView(); Gui::View3DInventorViewer *viewer = static_cast(mdi)->getViewer(); @@ -92,30 +88,48 @@ void EditDatumDialog::exec(bool atCursor) Ui::InsertDatum ui_ins_datum; ui_ins_datum.setupUi(&dlg); + double datum = Constr->Value; + Base::Quantity init_val; + + if (Constr->Type == Sketcher::Angle){ + datum = Base::toDegrees(datum); + init_val.setUnit(Base::Unit::Angle); + ui_ins_datum.labelEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/SketcherAngle")); + }else{ + init_val.setUnit(Base::Unit::Length); + ui_ins_datum.labelEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/SketcherLength")); + } + //ui_ins_datum.lineEdit->setParamGrpPath("User parameter:History/Sketcher/SetDatum"); - double init_val; if (Constr->Type == Sketcher::Angle || ((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) && Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef)) // hide negative sign - init_val = std::abs(datum); - else // show negative sign - init_val = datum; + init_val.setValue(std::abs(datum)); - ui_ins_datum.lineEdit->setText(QLocale::system().toString(init_val,'g',6)); - ui_ins_datum.lineEdit->selectAll(); + else // show negative sign + init_val.setValue(datum); + + ui_ins_datum.labelEdit->setValue(init_val); + ui_ins_datum.labelEdit->selectNumber(); if (atCursor) dlg.setGeometry(QCursor::pos().x() - dlg.geometry().width() / 2, QCursor::pos().y(), dlg.geometry().width(), dlg.geometry().height()); if (dlg.exec()) { - bool ok; - double newDatum = QLocale::system().toDouble(ui_ins_datum.lineEdit->text(), &ok); - if (ok) { + Base::Quantity newQuant = ui_ins_datum.labelEdit->getQuantity(); + if (newQuant.isQuantity()) { + // save the value for the history + ui_ins_datum.labelEdit->pushToHistory(); + + double newDatum; if (Constr->Type == Sketcher::Angle) - newDatum = Base::toRadians(newDatum); + newDatum = Base::toRadians(newQuant.getValue()); + else + newDatum = newQuant.getValue(); + if (Constr->Type == Sketcher::Angle || ((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) && diff --git a/src/Mod/Sketcher/Gui/InsertDatum.ui b/src/Mod/Sketcher/Gui/InsertDatum.ui index d27befec34..e9f3db8c8d 100644 --- a/src/Mod/Sketcher/Gui/InsertDatum.ui +++ b/src/Mod/Sketcher/Gui/InsertDatum.ui @@ -27,7 +27,7 @@ - + diff --git a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp index ef1b75fe8c..0daf175beb 100644 --- a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp +++ b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp @@ -77,7 +77,7 @@ SoDatumLabel::SoDatumLabel() SO_NODE_ADD_FIELD(norm, (SbVec3f(.0f,.0f,1.f))); SO_NODE_ADD_FIELD(name, ("Helvetica")); - SO_NODE_ADD_FIELD(size, (12.f)); + SO_NODE_ADD_FIELD(size, (10.f)); SO_NODE_ADD_FIELD(lineWidth, (2.f)); SO_NODE_ADD_FIELD(datumtype, (SoDatumLabel::DISTANCE)); @@ -92,6 +92,8 @@ SoDatumLabel::SoDatumLabel() SO_NODE_ADD_FIELD(param1, (0.f)); SO_NODE_ADD_FIELD(param2, (0.f)); + useAntialiasing = true; + this->imgWidth = 0; this->imgHeight = 0; this->glimagevalid = false; @@ -127,7 +129,8 @@ void SoDatumLabel::drawImage() image.fill(0x00000000); QPainter painter(&image); - painter.setRenderHint(QPainter::Antialiasing); + if(useAntialiasing) + painter.setRenderHint(QPainter::Antialiasing); painter.setPen(front); painter.setFont(font); diff --git a/src/Mod/Sketcher/Gui/SoDatumLabel.h b/src/Mod/Sketcher/Gui/SoDatumLabel.h index 5a0dc5ae65..ac9cf3f2b8 100644 --- a/src/Mod/Sketcher/Gui/SoDatumLabel.h +++ b/src/Mod/Sketcher/Gui/SoDatumLabel.h @@ -71,6 +71,7 @@ public: SoSFVec3f norm; SoSFImage image; SoSFFloat lineWidth; + bool useAntialiasing; protected: virtual ~SoDatumLabel() {}; diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp index 36c60578b8..c7b0664db4 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp @@ -256,31 +256,36 @@ void TaskSketcherConstrains::slotConstraintsChanged(void) break; case Sketcher::Distance: if(Filter<3 || (*it)->Name != ""){ - name = QString::fromLatin1("%1 (%2)").arg(name).arg((*it)->Value); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity((*it)->Value,Base::Unit::Length).getUserString()); + //name = QString::fromLatin1("%1 (%2)").arg(name).arg((*it)->Value); ui->listWidgetConstraints->addItem(new ConstraintItem(dist,name,i-1,(*it)->Type)); } break; case Sketcher::DistanceX: if(Filter<3 || (*it)->Name != ""){ - name = QString::fromLatin1("%1 (%2)").arg(name).arg(std::abs((*it)->Value)); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity((*it)->Value,Base::Unit::Length).getUserString()); + //name = QString::fromLatin1("%1 (%2)").arg(name).arg(std::abs((*it)->Value)); ui->listWidgetConstraints->addItem(new ConstraintItem(hdist,name,i-1,(*it)->Type)); } break; case Sketcher::DistanceY: if(Filter<3 || (*it)->Name != ""){ - name = QString::fromLatin1("%1 (%2)").arg(name).arg(std::abs((*it)->Value)); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity((*it)->Value,Base::Unit::Length).getUserString()); + //name = QString::fromLatin1("%1 (%2)").arg(name).arg(std::abs((*it)->Value)); ui->listWidgetConstraints->addItem(new ConstraintItem(vdist,name,i-1,(*it)->Type)); } break; case Sketcher::Radius: if(Filter<3 || (*it)->Name != ""){ - name = QString::fromLatin1("%1 (%2)").arg(name).arg((*it)->Value); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity((*it)->Value,Base::Unit::Length).getUserString()); + //name = QString::fromLatin1("%1 (%2)").arg(name).arg((*it)->Value); ui->listWidgetConstraints->addItem(new ConstraintItem(radi,name,i-1,(*it)->Type)); } break; case Sketcher::Angle: if(Filter<3 || (*it)->Name != ""){ - name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::toDegrees(std::abs((*it)->Value))); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees(std::abs((*it)->Value)),Base::Unit::Angle).getUserString()); + //name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::toDegrees(std::abs((*it)->Value))); ui->listWidgetConstraints->addItem(new ConstraintItem(angl,name,i-1,(*it)->Type)); } break; diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index a4c3ccbfb2..ad86ebc489 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -2424,9 +2424,11 @@ Restart: if ((Constr->Type == DistanceX || Constr->Type == DistanceY) && Constr->FirstPos != Sketcher::none && Constr->Second == Constraint::GeoUndef) // display negative sign for absolute coordinates - asciiText->string = SbString().sprintf("%.2f",Constr->Value); + asciiText->string = SbString(Base::Quantity(Constr->Value,Base::Unit::Length).getUserString().toUtf8().constData()); + //asciiText->string = SbString().sprintf("%.2f",Constr->Value); else // hide negative sign - asciiText->string = SbString().sprintf("%.2f",std::abs(Constr->Value)); + asciiText->string = SbString(Base::Quantity(std::abs(Constr->Value),Base::Unit::Length).getUserString().toUtf8().constData()); + //asciiText->string = SbString().sprintf("%.2f",std::abs(Constr->Value)); if (Constr->Type == Distance) asciiText->datumtype = SoDatumLabel::DISTANCE; @@ -2642,7 +2644,8 @@ Restart: break; SoDatumLabel *asciiText = dynamic_cast(sep->getChild(0)); - asciiText->string = SbString().sprintf("%.2f",Base::toDegrees(std::abs(Constr->Value))); + asciiText->string = SbString(Base::Quantity(Base::toDegrees(std::abs(Constr->Value)),Base::Unit::Angle).getUserString().toUtf8().constData()); + //asciiText->string = SbString().sprintf("%.2f",Base::toDegrees(std::abs(Constr->Value))); asciiText->datumtype = SoDatumLabel::ANGLE; asciiText->param1 = Constr->LabelDistance; asciiText->param2 = startangle; @@ -2763,6 +2766,8 @@ void ViewProviderSketch::rebuildConstraintsVisual(void) text->norm.setValue(norm); text->string = ""; text->textColor = ConstrDimColor; + text->size.setValue(17); + text->useAntialiasing = false; SoAnnotation *anno = new SoAnnotation(); anno->renderCaching = SoSeparator::OFF; anno->addChild(text); @@ -3166,7 +3171,7 @@ void ViewProviderSketch::createEditInventorNodes(void) Coordsep->renderCaching = SoSeparator::OFF; SoFont *font = new SoFont(); - font->size = 15.0; + font->size = 10.0; Coordsep->addChild(font); edit->textPos = new SoTranslation();