Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 3347) +++ trunk/src/action_helper.c (revision 3348) @@ -770,7 +770,7 @@ IncrementUndoSerialNumber(); lastLayer = CURRENT; } - if (PCB->Clipping && (Note.X != Crosshair.AttachedLine.Point2.X || Note.Y != Crosshair.AttachedLine.Point2.Y) + if (conf_core.editor.line_refraction && (Note.X != Crosshair.AttachedLine.Point2.X || Note.Y != Crosshair.AttachedLine.Point2.Y) && (line = CreateDrawnLineOnLayer(CURRENT, Crosshair.AttachedLine.Point2.X, Index: trunk/src/line.c =================================================================== --- trunk/src/line.c (revision 3347) +++ trunk/src/line.c (revision 3348) @@ -245,11 +245,11 @@ /* drc_lines() checks for intersectors against two lines and * adjusts the end point until there is no intersection or * it winds up back at the start. If way is false it checks - * straight start, 45 end lines, otherwise it checks 45 start, - * straight end. + * an ortho start line with one 45 refraction to reach the endpoint, + * otherwise it checks a 45 start, with a ortho refraction to reach endpoint * * It returns the straight-line length of the best answer, and - * changes the position of the input point to the best answer. + * changes the position of the input end point to the best answer. */ static double drc_lines(PointTypePtr end, bool way) @@ -418,6 +418,7 @@ PointType r45, rs; bool shift; double r1, r2; + int refraction = conf_core.editor.line_refraction; /* Silence a bogus compiler warning by storing this in a variable */ int layer_idx = INDEXOFCURRENT; @@ -431,23 +432,32 @@ r1 = drc_lines(&rs, false); /* then try starting at 45 */ r2 = drc_lines(&r45, true); + /* shift forces the line lookahead path to refract the alternate way */ shift = gui->shift_is_pressed(); if (XOR(r1 > r2, shift)) { - if (PCB->Clipping) { - if (shift) - PCB->Clipping = 2; - else - PCB->Clipping = 1; + if (conf_core.editor.line_refraction != 0) { + if (shift) { + conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 2); + printf("line_refraction is set to: %d\n", conf_core.editor.line_refraction); + } + else{ + conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 1); + printf("line_refraction is set to: %d\n", conf_core.editor.line_refraction); + } } Crosshair.X = rs.X; Crosshair.Y = rs.Y; } else { - if (PCB->Clipping) { - if (shift) - PCB->Clipping = 1; - else - PCB->Clipping = 2; + if (conf_core.editor.line_refraction !=0) { + if (shift) { + conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 1); + printf("line_refraction is set to: %d\n", conf_core.editor.line_refraction); + } + else{ + conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 2); + printf("line_refraction is set to: %d\n", conf_core.editor.line_refraction); + } } Crosshair.X = r45.X; Crosshair.Y = r45.Y; Index: trunk/src_plugins/io_pcb/parse_l.c =================================================================== --- trunk/src_plugins/io_pcb/parse_l.c (revision 3347) +++ trunk/src_plugins/io_pcb/parse_l.c (revision 3348) @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 39 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -161,8 +161,13 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -extern int yyleng; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +extern yy_size_t yyleng; + extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 @@ -183,6 +188,13 @@ if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --yylineno;\ + }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -200,11 +212,6 @@ #define unput(c) yyunput( c, (yytext_ptr) ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -222,7 +229,7 @@ /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -292,8 +299,8 @@ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; @@ -321,7 +328,7 @@ YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); @@ -713,7 +720,7 @@ */ static int Parse(FILE *Pipe, const const char *Executable, const char *Path, const char *Filename, const char *Parameter); -#line 717 "lex.yy.c" +#line 724 "lex.yy.c" #define INITIAL 0 @@ -752,7 +759,7 @@ void yyset_out (FILE * out_str ); -int yyget_leng (void ); +yy_size_t yyget_leng (void ); char *yyget_text (void ); @@ -900,11 +907,6 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 109 "../../src_plugins/io_pcb/parse_l.l" - - -#line 907 "lex.yy.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -931,6 +933,12 @@ yy_load_buffer_state( ); } + { +#line 109 "../../src_plugins/io_pcb/parse_l.l" + + +#line 941 "lex.yy.c" + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -947,7 +955,7 @@ yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -977,7 +985,7 @@ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - int yyl; + yy_size_t yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) @@ -1314,7 +1322,7 @@ #line 211 "../../src_plugins/io_pcb/parse_l.l" ECHO; YY_BREAK -#line 1318 "lex.yy.c" +#line 1326 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1445,6 +1453,7 @@ "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1500,7 +1509,7 @@ else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1507,7 +1516,7 @@ { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -1514,7 +1523,7 @@ if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1545,7 +1554,7 @@ /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); + (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -1640,7 +1649,7 @@ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 221); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) @@ -1655,7 +1664,7 @@ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; + register yy_size_t number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = @@ -1708,7 +1717,7 @@ else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1873,10 +1882,6 @@ yyfree((void *) b ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -1989,7 +1994,7 @@ */ static void yyensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { @@ -2086,12 +2091,12 @@ * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2173,7 +2178,7 @@ /** Get the length of the current token. * */ -int yyget_leng (void) +yy_size_t yyget_leng (void) { return yyleng; } @@ -2324,7 +2329,7 @@ #define YYTABLES_NAME "yytables" -#line 211 "../../src_plugins/io_pcb/parse_l.l" +#line 210 "../../src_plugins/io_pcb/parse_l.l"