grep '(switch|state|case|end|first_time|NResize|doresize)' node_resize.cctmp > node_resize_block_structure.txt Tree structure of switch case blocks and extra flag use, in node_resize callback. - RJL041013 ------------------------------------------------------------------ * Revised - RJL 041007-13 - refactoring for state model clarity * TBD: Use xor GC for doresize during BUTON_MOVED iterations. int state, /* Canvas State (eventually just NodeCreate)*/ static int first_time = 0; //RJL041012 //static int NResize = 0; // Resize ---> NResize ---> Reconfirmed- RJL041010 // TBD: split state SNode_Resize, replacing Reconfirmed switch (state) case SResize: first_time = 0; switch (button_op) { case BUTTON_DOWN_EVENT: case BUTTON_MOVED_EVENT: // wait for button_up and reconfirm case BUTTON_UP_EVENT: //moved action from case BUTTON_DOWN-041010 } // end case BUTTON_UP } // end switch(button_op) break; // end case SResize; case SResize_node: switch (button_op) { case BUTTON_DOWN_EVENT: //Same state; ignore BUTTON_MOVED, wait for BUTTON_UP; first_time = TRUE; //Another Flag Var! } // end else non-null selection break; // end case BUTTON_DOWN case BUTTON_MOVED_EVENT: // new or old HN selection assert(first_time == TRUE); //remove flag if superfluous DP;doresize((int)event->x, (int)event->y, id); // doresize clears first_time break; // end BUTTON_MOVED case BUTTON_UP_EVENT: if (!Reconfirmed) { // same next state? // first_time == FALSE; // skip MOVED:doresize // OK to repeat node_resize for THIS node in state SNode_resize } // end if..else break; // end case BUTTON_UP } // end switch(button_op) // end case SResize_node fprintf(stderr, "switch arg state=0x%x\n", state); } // end switch(state) } // end node_resize() /* doresize() client: node_resize: state SResize_node: */ /* doresize is done on each BUTTON_MOVED event */ /* TBD: switch(shape) cases should be class-specific */ void doresize(int x, int y, hcg_key id) extern int first_time; // in node_resize if(first_time){ first_time = FALSE; } // end circular shape move if(first_time){ first_time = FALSE; switch(curr_shape[0]){ // assert non-circular; erase old shape // this switch is a crutch to avoid polymorphic shape subclass:draw() case 'E': case 'e': case 'R': case 'r': case 'F': case 'f': case 'O': case 'o': case 'I': case 'i': } // end switch( shape) } // end if(first_time); first_time = FALSE now else{ // not first_time - erase prior shape: switch(curr_shape[0]){ case 'E': case 'e': case 'R': case 'r': case 'F': case 'f': case 'O': case 'o': case 'I': case 'i': } // end not first_time switch(curr_shape[0]){ case 'E': case 'e': case 'R': case 'r': case 'F': case 'f': case 'O': case 'o': case 'I': case 'i': } // end switch(shape) } // end non-circular shapes } // end do_resize:480:828 ----------------------------------------------- grep -n node_resize *.cc buttonevent.cc:206: node_resize(event, nodeops.cc:11:// node_resize();node_fit_to_text(); doresize() nodeops.cc:104:// In routines node_move() and node_resize() changed calls from nodeops.cc:115:// Fixed the last remaining bug in node_resize().. :) nodeops.cc:118:// Fixed on more minor bug in node_resize(). Before if you resized a node, nodeops.cc:484: * node_resize performs the node resize operation. It does nodeops.cc:500:void node_resize ( XButtonEvent *event, nodeops.cc:641: else { // assert(Reconfirmed);cursor: movehand;finish node_resize: nodeops.cc:660: // OK to repeat node_resize for THIS node in state SNode_resize nodeops.cc:673: fprintf(stderr, "Out of State in function node_resize.\n"); nodeops.cc:680:} // end node_resize() nodeops.cc:684:/* doresize() client: node_resize: state SResize_node: */ nodeops.cc:698: extern int first_time; // in node_resize textops.cc:1279: fprintf(stderr, "Out of State(SResize) in node_resize"); -------------------------------------------------