void GetA::clear() { input_field[0] = '\0'; cursor_pos = 0; if( hide_flag ) hide_field[0] = '\0'; clear_select(); }
inline int IAtelier_summer::OnLButtonUp(UINT flag, int x, int y) { clear_select(); for (int i = _glyph_tree->number_of_children(_tree_iter) - 1; i >= 0; i--) { //draw all GlyphTreeIter_summer it = _glyph_tree->child(_tree_iter, (unsigned int)i); if ((*it)->OnLButtonUp(flag, x, y)) break; } return (0); }
// if any is deleted then return 1 void songlist_delete_song_in_batch(void) { int i; // delete in descended order won't screw things up for(i = songlist->length - 1; i >= 0; i--) if(songlist->selected[i]) mpd_run_delete(conn, songlist->meta[i].id - 1); // then unselect every thing clear_select(); }
// return 1 for selected int GetA::detect_click() { if( !enable_flag ) return 0; if( !mouse_drag_flag ) { int clickCount = mouse.any_click(x-font_ptr->max_font_width, y, x_limit, y+height()-1); if( clickCount == 1) { // set cursor_pos // scan from the last character, until the clicked x is // less than the character x for( cursor_pos = strlen(input_field); cursor_pos > 0 && mouse.click_x() < cursor_x(cursor_pos); --cursor_pos ); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field)); clear_select(); mouse_drag_flag = 1; return 1; } else if( clickCount > 1 ) { select_whole(); return 1; } } else { if( !mouse.left_press ) { mouse_drag_flag = 0; } for( cursor_pos = strlen(input_field); cursor_pos > 0 && mouse.cur_x < cursor_x(cursor_pos); --cursor_pos ); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field)); return 1; } return 0; }
unsigned GetA::detect_key() { if( !enable_flag ) return 0; err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); if( mouse.is_key_event() ) { unsigned keyCode = mouse.key_code; unsigned shiftPressed = mouse.event_skey_state & SHIFT_KEY_MASK; // printable character if( keyCode >= ' ' && keyCode <= 0xff ) { if( strlen(input_field)-(mark_end() - mark_begin()) < field_len) { // insert character memmove( input_field+mark_begin()+1, input_field+mark_end(), strlen(input_field)-mark_end()+1); input_field[mark_begin()] = keyCode; cursor_pos = mark_begin()+1; clear_select(); } err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } else if( keyCode == KEY_DEL ) { if( is_select() ) { err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); // erase selected area memmove( input_field+mark_begin(), input_field+mark_end(), strlen(input_field)-mark_end()+1); cursor_pos = mark_begin(); clear_select(); } else { if(strlen(input_field) > cursor_pos) { err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); memmove( input_field+cursor_pos, input_field+cursor_pos+1, strlen(input_field)-cursor_pos); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); } } err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } else if( keyCode == KEY_BACK_SPACE ) { if( is_select() ) { err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); // erase selected area memmove( input_field+mark_begin(), input_field+mark_end(), strlen(input_field)-mark_end()+1); cursor_pos = mark_begin(); clear_select(); } else { if(cursor_pos > 0) { err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); memmove( input_field+cursor_pos-1, input_field+cursor_pos, strlen(input_field)-cursor_pos+1); cursor_pos--; err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); clear_select(); } } err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } if( keyCode == KEY_LEFT ) { if(cursor_pos > 0) cursor_pos--; if( !shiftPressed ) clear_select(); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } if( keyCode == KEY_RIGHT ) { if(cursor_pos < strlen(input_field)) cursor_pos++; if( !shiftPressed ) clear_select(); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } if( keyCode == KEY_HOME) { cursor_pos = 0; if( !shiftPressed ) clear_select(); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } if( keyCode == KEY_END) { cursor_pos = strlen(input_field); if( !shiftPressed ) clear_select(); err_when( cursor_pos < 0 || cursor_pos > strlen(input_field) ); err_when( mark_cursor_pos < 0 || mark_cursor_pos > strlen(input_field) ); return keyCode; } if( esc_key_flag && keyCode == KEY_ESC ) { // if esc_key_flag is 0 and ESC key pressed, still return 0 clear(); return keyCode; } if( keyCode == KEY_RETURN || keyCode == KEY_UP || keyCode == KEY_DOWN || keyCode == KEY_TAB ) { return keyCode; } } return 0; }
void GetA::clear() { input_field[0] = '\0'; cursor_pos = 0; clear_select(); }
PLAYER::PLAYER(void) : popup(NULL), faction(0), group_id_count(1), active(false), unit_count(0), can_die(false), resources(0) { clear_select(); }
void PLAYER::update_select(void) { if (sel.agent_to_select) sel.agent_to_select->select(true); clear_select(); }