⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flv_table.cxx

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CXX
📖 第 1 页 / 共 3 页
字号:
    return -4;			//      In grey area at bottom?}intFlv_Table::select_start_col(int n){    if (n >= vcols)	n = vcols - 1;    if (n < 0)	n = 0;    if (n != vselect_col) {	vselect_col = n;	if (DOcb(FLVEcb_SELECTION_CHANGED)) {	    vwhy_event = FLVE_SELECTION_CHANGED;	    do_callback(this, user_data());	    vwhy_event = 0;	}	damage(FL_DAMAGE_CHILD);    }    return vselect_col;}voidFlv_Table::update_width(){    int rw, n;    for (rw = n = 0; n < vcols; n++)	rw += (col_width(n));    if (col_header())	rw += col_width(-1);    if (col_footer())	rw += col_width(-2);    if (rw != row_width()) {	row_width(rw);	damage(FL_DAMAGE_CHILD);    }}voidFlv_Table::adjust_for_cell(){    int n, o, cw;    int X, Y, W, H;    for (n = o = 0; n < col(); n++)	o += col_width(n);    if (row_offset() > o)	row_offset(o);    else {	client_area(X, Y, W, H);	if (col_footer())	    W -= col_width(-2);	if (col_header())	    W -= col_width(-2);	cw = col_width(col());	if (o + cw - row_offset() > W) {	    row_offset(o + cw - W);	    damage(FL_DAMAGE_CHILD);	}    }}boolFlv_Table::check_resize(void){    int ex, ey, v;    int X, Y, W, H;    if (drag_row < -3 && drag_col < -2)	return false;    client_area(X, Y, W, H);    ex = Fl::event_x();    ey = Fl::event_y();    if (drag_row == -3) {	v = ey - anchor_top;	if (v < 2)	    v = 2;	row_style[drag_row].height(v);	damage(FL_DAMAGE_CHILD);	return true;    }    if (label() && *label()) {	Y += row_height(-3);	H -= row_height(-3);    }    if (drag_col > -3) {	if (drag_col == -2) {	    v = anchor_left - ex + col_width(drag_col);	    if (col_header()) {		X += col_width(-1);		W -= col_width(-1);	    }	    if (v > W - 1) {		v = W - 1;		anchor_left = X + W - v;	    }	    if (v < 2) {		v = 2;		anchor_left = X + W - 2;	    }	    col_style[drag_col].width(v);	    damage(FL_DAMAGE_CHILD);	    if (v != W - 1 && v != 2)		anchor_left = ex;	} else {	    v = ex - anchor_left;	    if (drag_col == -1) {		//      Make sure it's in the grid		if (col_footer())		    W -= col_width(-2);		if (v > W - 1)		    v = W - 1;	    }	    if (v < 2)		v = 2;	    col_width(v, drag_col);	    damage(FL_DAMAGE_CHILD);	}    }    //      Resize row    if (drag_row > -4) {	if (drag_row == -2) {	    v = anchor_top - ey + row_height(drag_row);	    if (row_header()) {		H -= row_height(-1);		Y += row_height(-1);	    }	    if (v > H - 1) {		v = H - 1;		anchor_top = Y + H - v;	    }	    if (v < 2) {		v = 2;		anchor_top = Y + H - 2;	    }	    row_style[drag_row].height(v);	    damage(FL_DAMAGE_CHILD);	    if (v != 2 && v != H - 1)		anchor_top = ey;	} else {	    v = ey - anchor_top;	    if (drag_row == -1) {		if (row_footer())		    H -= row_height(-2);		if (v > H - 1)		    v = H - 1;	    }	    if (v < 2)		v = 2;	    row_height(v, drag_row);	    damage(FL_DAMAGE_CHILD);	}    }    return true;}//      See if we can resize, if so change cursorvoidFlv_Table::check_cursor(void){    int X, Y, W, H, R, ey, ex, move = 0, WW, size;    int v;    bool resize, inh, inv;    Fl_Cursor cursor;    //      Assume total miss    drag_row = drag_col = -4;    cursor = FL_CURSOR_DEFAULT;    ex = Fl::event_x();    ey = Fl::event_y();    client_area(X, Y, W, H);    inh = (ex >= X && ex < X + W);    inv = (ey >= Y && ey < Y + H);    if (label() && *label()) {	size = row_height(-3);	Y += size;	H -= size;	resize = (ey >= Y - FUDGE && ey <= Y + FUDGE && inh);	if (resize) {	    if (row_resizable(-3)) {		drag_row = -3;		anchor_top = Y - size;		move |= MOVE_Y;	    }	}    }    //      Trival tests to see if we're in region    resize = full_resize();    if (!resize) {	if (row_header()) {	    size = row_height(-1);	    resize |= (ey >= Y && ey <= Y + size + FUDGE && inh);	}	if (!resize) {	    if (row_footer()) {		size = row_height(-2);		resize |= (ey <= Y + H && ey >= Y + H - size - FUDGE && inh);	    }	    if (!resize) {		if (col_header()) {		    size = col_width(-1);		    resize |= (ex >= X && ex <= X + size + FUDGE && inh);		}		if (!resize) {		    if (col_footer()) {			size = col_width(-2);			resize |= (ex <= X + W && ex >= X + W - size - FUDGE				   && inh);		    }		}	    }	}    }    if (!resize)		//      In general region?    {	if (cursor != last_cursor) {	    fl_cursor(cursor, FL_BLACK, FL_WHITE);	    last_cursor = cursor;	}	return;    }    //    ==================================================================    //    Sweep columns    WW = X;    if (col_header()) {	size = col_width(-1);	if (ex >= WW + size - FUDGE && ex <= WW + size + FUDGE && inv) {	    if (col_resizable(-1) && (move & MOVE_Y) == 0) {		drag_col = -1;		anchor_left = WW;		move |= MOVE_X;	    }	}	WW += size;	X += size;	W -= size;    }    if (col_footer()) {	size = col_width(-2);	if (ex >= X + W - size - FUDGE && ex <= X + W - size + FUDGE && inv) {	    if (col_resizable(-2)) {		drag_col = -2;		anchor_left = ex;		move |= MOVE_X;	    }	}	W -= size;    }    if ((move & MOVE_X) == 0) {	R = X - row_offset() + row_width() + FUDGE;	//      Right edge of row	for (WW -= row_offset(), v = 0; WW < R && WW < X + W && v < cols();	     WW += size, v++) {	    size = col_width(v);	    if (WW + size < X)	//      Off left		continue;	    if (ex >= WW + size - FUDGE && ex <= WW + size + FUDGE && inv) {		if (col_resizable(v)) {		    drag_col = v;		    anchor_left = WW;		    move |= MOVE_X;	//      Moving col		}		break;	    }	}    }    if (col_header()) {	X -= col_width(-1);	W += col_width(-1);    }    if (col_footer())	W += col_width(-2);    //      ==================================================================    //      Sweep rows    WW = Y;    if (row_header()) {	size = row_height(-1);	if (ey >= WW + size - FUDGE && ey <= WW + size + FUDGE && inh) {	    if (row_resizable(-1)) {		drag_row = -1;		anchor_top = WW;		move |= MOVE_Y;	    }	}	WW += size;	Y += size;	H -= size;    }    if (row_footer()) {	size = row_height(-2);	if (ey >= Y + H - size - FUDGE && ey <= Y + H - size + FUDGE && inh) {	    if (row_resizable(-2)) {		drag_row = -2;		anchor_top = ey;		move |= MOVE_Y;	    }	}	H -= size;    }    if ((move & MOVE_Y) == 0) {	for (v = top_row(); v < rows(); WW += size, v++) {	    size = row_height(v);	    if (WW + size - FUDGE >= Y + H)		break;	    if (ey >= WW + size - FUDGE && ey <= WW + size + FUDGE && inh) {		if (row_resizable(v)) {		    drag_row = v;		    anchor_top = WW;		    move |= MOVE_Y;	//      Moving		}		break;	    }	}    }    switch (move) {    case MOVE_X:	cursor = FL_CURSOR_WE;	drag_row = -4;	break;    case MOVE_Y:	cursor = FL_CURSOR_NS;	drag_col = -4;	break;    case MOVE_XY:	cursor = FL_CURSOR_NWSE;	break;    default:	drag_row = drag_col = -4;	cursor = FL_CURSOR_DEFAULT;	break;    }    if (cursor != last_cursor) {	fl_cursor(cursor, FL_BLACK, FL_WHITE);	last_cursor = cursor;    }}boolFlv_Table::move_row(int amount){    Flv_Style s;    int r = row();    if (!amount)	return true;    r += amount;    if (r >= rows())	r = rows() - 1;    if (r < 0)	r = 0;    while (!select_locked()) {	get_style(s, r, col());	if (!s.locked())	    break;	r += (amount < 0 ? -1 : 1);	if (r < 0 || r >= rows())	    return false;    }    if (r != row()) {	row(r);	return true;    }    return false;}boolFlv_Table::move_col(int amount){    Flv_Style s;    int c = col();    if (!amount)	return true;    c += amount;    if (c >= cols())	c = cols() - 1;    if (c < 0)	c = 0;    while (!select_locked()) {	get_style(s, row(), c);	if (!s.locked())	    break;	c += (amount < 0 ? -1 : 1);	if (c < 0 || c >= rows())	    return false;    }    if (c != col()) {	col(c);	return true;    }    return false;}intFlv_Table::edit_when(int v){    int wfocused = (Fl::focus() == veditor);    if (v != vedit_when) {	vedit_when = v;	if (vedit_when != FLV_EDIT_ALWAYS)	    end_edit();	else	    start_edit();    }    if (wfocused && !vediting) {	Fl::focus(this);	//    take_focus();	redraw();    }    return vedit_when;}voidFlv_Table::start_edit(void)	//      Start editing{    if (!vediting) {	vediting = true;	switch_editor(row(), col());    }}voidFlv_Table::end_edit(void){    int wfocused = (Fl::focus() == veditor);    if (veditor)	switch_editor(-1, -1);    if (wfocused && !vediting) {	Fl::focus(this);	//    take_focus();	redraw();    }}voidFlv_Table::cancel_edit(void)	//      Cancel editing{    if (veditor) {	veditor->hide();	veditor->redraw();    }    veditor = NULL;    edit_row = -1;    edit_col = -1;    vediting = false;    switch_editor(edit_row, edit_col);}voidFlv_Table::switch_editor(int nr, int nc){    Flv_Style s;    int x, y, w, h, wfocused;    wfocused = (Fl::focus() == veditor);    if (veditor) {	if (edit_row > -1 && edit_col > -1)	    save_editor(veditor, edit_row, edit_col);	edit_row = -1;	edit_col = -1;	veditor->hide();	veditor->draw();	veditor = NULL;    }    if (edit_when() == FLV_EDIT_ALWAYS) {	vediting = true;	if (nr < 0)	    nr = row();	if (nc < 0)	    nc = col();    }    if (nr > -1 && nc > -1 && vediting) {	get_style(s, nr, nc);	if (s.editor_defined() && !s.locked()) {	    veditor = s.editor();	    if (veditor) {		edit_row = nr;		edit_col = nc;		veditor->hide();		get_cell_bounds(x, y, w, h, nr, nc);		position_editor(veditor, x, y, w, h, s);		load_editor(veditor, nr, nc);		veditor->show();		Fl::focus(veditor);		//veditor->take_focus();		veditor->handle(FL_FOCUS);		veditor->damage(FL_DAMAGE_ALL);		veditor->redraw();	    }	}    }    if (!veditor) {	vediting = false;	edit_row = -1;	edit_col = -1;    }    if (!veditor && wfocused) {	Fl::focus(this);	//    take_focus();	handle(FL_FOCUS);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -