Example #1
0
void sheet_updown(struct SHEET *sht, int height)
{
	struct SHTCTL *ctl = sht->ctl;
	int h, old = sht->height; /* 存储设置前的高度信息 */
	if (height > ctl->top + 1) {
		height = ctl->top + 1;
	}
	if (height < -1) {
		height = -1;
	}
	sht->height = height;/* 设定高度 */

	/* 下面主要是进行sheets[]的重新排列 */
	if (old > height) { /* 比以前低 */
		if (height >= 0) {
		/* 把中间的往上提 */
			for (h = old; h > height; h--) {
				ctl->sheets[h] = ctl->sheets[h - 1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);
		} else { /* 隐藏 */
			if (ctl->top > old) {
			/* 把上面的降下来 */
				for (h = old; h < ctl->top; h++) {
					ctl->sheets[h] = ctl->sheets[h + 1];
					ctl->sheets[h]->height = h;
				}
			}
			ctl->top--; /* 由于显示中的图层减少了一个,所以最上面的图层高度下降 */
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
		}
	} else if (old < height) { /* 比以前高 */
		if (old >= 0) {
		/* 把中间的拉下去 */
			for (h = old; h < height; h++) {
				ctl->sheets[h] = ctl->sheets[h + 1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
		} else { /* 由隐藏状态转为显示状态 */
		/* 将已在上面的提上来 */
			for (h = ctl->top; h >= height; h--) {
				ctl->sheets[h + 1] = ctl->sheets[h];
				ctl->sheets[h + 1]->height = h + 1;
			}
			ctl->sheets[height] = sht;
			ctl->top++; /* 由于已显示的图层增加了1个,所以最上面的图层高度增加 */
		}
		sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);
		sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height); /* 按新图层信息重新绘制画面 */
	}
	return;
}
Example #2
0
void sheet_updown(struct SHEET *sht, int height)
{
	struct SHTCTL *ctl = sht->ctl;
	int h, old = sht->height;

	if (height > ctl->top + 1)
		height = ctl->top + 1;
	if (height < -1)
		height = -1;
	sht->height = height;

	if (old > height) { //层数下降
		if (height >= 0) {
			for (h = old; h > height; h--) {
				ctl->sheets[h] = ctl->sheets[h - 1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);
		}
		else { //更新后height <0,即这层不显示,总层数-1
			if (ctl->top > old) {
				for (h = old; h < ctl->top; h++) {
					ctl->sheets[h] = ctl->sheets[h + 1];
					ctl->sheets[h]->height = h;
				}
			}
			ctl->top--;
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
		}
		//sheet_refresh(ctl);
		//sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height+1);
	}
	else if (old < height) { //层数升高
		if (old >= 0) {
			for (h = old; h < height; h++) {
				ctl->sheets[h] = ctl->sheets[h + 1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
		}
		else { //重新显示
			for (h = ctl->top; h >= height; h--) {
				ctl->sheets[h + 1] = ctl->sheets[h];
				ctl->sheets[h + 1]->height = h + 1;
			}
			ctl->sheets[height] = sht;
			ctl->top++;
		}
		//sheet_refresh(ctl);
		sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);
		sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);
	}
	return;
}
Example #3
0
/**
 *	@description	设置图层高度
 *	@param			sht:欲设置高度的图层的指针
 *					height:欲设置的高度
 */
void sheet_updown(struct SHEET *sht, int height){
	struct SHTCTL *ctl = sht->ctl;
	int h, old = sht->height; /* 愝掕慜偺崅偝傪婰壇偡傞 */

	//TODO 高度有效修正
	if (height > ctl->top + 1) {
		height = ctl->top + 1;
	}
	if (height < -1) {
		height = -1;
	}
	sht->height = height;

	if (old > height) {
		//TODO 比之前低,做下降动作
		if (height >= 0) {
			for (h = old; h > height; h--) {
				ctl->sheets[h] = ctl->sheets[h - 1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);
		} else {
			if (ctl->top > old) {
				for (h = old; h < ctl->top; h++) {
					ctl->sheets[h] = ctl->sheets[h + 1];
					ctl->sheets[h]->height = h;
				}
			}
			ctl->top--;
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
		}//end of if (height >= 0)else
	} else if (old < height) {
		//TODO 图层做上升动作
		if (old >= 0) {
			for (h = old; h < height; h++) {
				ctl->sheets[h] = ctl->sheets[h + 1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
		} else {
			for (h = ctl->top; h >= height; h--) {
				ctl->sheets[h + 1] = ctl->sheets[h];
				ctl->sheets[h + 1]->height = h + 1;
			}
			ctl->sheets[height] = sht;
			ctl->top++;
		}
		sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);
		sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);
	}
}
Example #4
0
File: sheet.c Project: cupnes/os
void sheet_updown(SHEET *sheet, int height) {
	SHEET_CTL *ctl = sheet->ctl;
	int h, old = sheet->height;	// 設定前の高さを記憶する

	// 指定が低すぎや高すぎだったら修正する
	if(height > ctl->top + 1)	height = ctl->top + 1;
	if(height < -1)				height = -1;
	sheet->height = height;	// 高さを設定

	// 以下は主にsheets[]の並べ替え
	if(old > height) {	// 以前よりも低くなる
		if(height >= 0) {
			// 間のものを引き上げる
			for(h = old; h > height; h--) {
				ctl->sheets[h] = ctl->sheets[h-1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sheet;
			sheet_refreshmap(ctl, sheet->vx0, sheet->vy0, sheet->vx0 + sheet->bxsize, sheet->vy0 + sheet->bysize, height + 1);
			sheet_refresh_sub(ctl, sheet->vx0, sheet->vy0, sheet->vx0 + sheet->bxsize, sheet->vy0 + sheet->bysize, height + 1, old);
	} else {	// 非表示化
			if(ctl->top > old) {
				// 上になっているものをおろす
				for(h = old; h < ctl->top; h++) {
					ctl->sheets[h] = ctl->sheets[h+1];
					ctl->sheets[h]->height = h;
				}
			}
			ctl->top--;	// 表示中の下敷きが1つ減るので一番上の高さが減る
			sheet_refreshmap(ctl, sheet->vx0, sheet->vy0, sheet->vx0 + sheet->bxsize, sheet->vy0 + sheet->bysize, 0);
			sheet_refresh_sub(ctl, sheet->vx0, sheet->vy0, sheet->vx0 + sheet->bxsize, sheet->vy0 + sheet->bysize, 0, old - 1);
	}
	} else if(old < height) {	// 以前よりも高くなる
		if(old >= 0) {
			// 間のものを押し下げる
			for(h = old; h < height; h++) {
				ctl->sheets[h] = ctl->sheets[h-1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sheet;
		} else {	// 表示状態へ
			// 上になるものを持ち上げる
			for(h = ctl->top; h >= height; h--) {
				ctl->sheets[h+1] = ctl->sheets[h];
				ctl->sheets[h+1]->height = h + 1;
			}
			ctl->sheets[height] = sheet;
			ctl->top++;	// 表示中の下敷きが1つ増えるので一番上の高さが増える
		}
		sheet_refreshmap(ctl, sheet->vx0, sheet->vy0, sheet->vx0 + sheet->bxsize, sheet->vy0 + sheet->bysize, height);
		sheet_refresh_sub(ctl, sheet->vx0, sheet->vy0, sheet->vx0 + sheet->bxsize, sheet->vy0 + sheet->bysize, height, height);
	}
	return;
}
Example #5
0
File: sheet.c Project: cupnes/os
void sheet_slide(SHEET *sheet, int vx0, int vy0) {
	SHEET_CTL *ctl = sheet->ctl;
	int old_vx0 = sheet->vx0, old_vy0 = sheet->vy0;
	sheet->vx0 = vx0;
	sheet->vy0 = vy0;
	if(sheet->height >= 0) { // 表示中なら
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sheet->bxsize, old_vy0 + sheet->bysize, 0);
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sheet->bxsize, vy0 + sheet->bysize, sheet->height);
		sheet_refresh_sub(ctl, old_vx0, old_vy0, old_vx0 + sheet->bxsize, old_vy0 + sheet->bysize, 0, sheet->height - 1);
		sheet_refresh_sub(ctl, vx0, vy0, vx0 + sheet->bxsize, vy0 + sheet->bysize, sheet->height, sheet->height);
	}
}
Example #6
0
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
	sht->vx0 = vx0;
	sht->vy0 = vy0;
	if (sht->height >= 0) { /* if it is active (visible) */
		sheet_refreshmap(sht->ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		sheet_refreshmap(sht->ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		sheet_refreshsub(sht->ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height -1);	//paint old area from height "0" on
		sheet_refreshsub(sht->ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);	//paint new area from height "sht->height" on
	}
	return;
}
Example #7
0
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
	struct SHTCTL *ctl = sht->ctl;
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
	sht->vx0 = vx0;
	sht->vy0 = vy0;
	if (sht->height >= 0) { /* もしも表示中なら、新しい下じきの情報に沿って画面を描き直す */
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1);
		sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);
	}
	return;
}
Example #8
0
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
	struct SHTCTL *ctl = sht->ctl;
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
	sht->vx0 = vx0;
	sht->vy0 = vy0;
	if (sht->height >= 0) {		/* 만약 표시 중이라면 */
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		sheet_refreshsub(sht->ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1);		/* 새로운 레이어 정보에 따라 화면을 다시 그린다. */
		sheet_refreshsub(sht->ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);
	}
	return;
}
Example #9
0
/////////////////////////////////////////////////////////////////////////////////////
//功能:上下左右移动窗口
//参数:
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
	struct SHTCTL *ctl = sht->ctl;
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
	sht->vx0 = vx0;//更新位置
	sht->vy0 = vy0;
	if (sht->height >= 0) { /* 如果正在显示,按照新图层刷新画面 */
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1);
		sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);
	}
	return;
}
Example #10
0
/**
 *	@description	平移图层
 *	@param			sht:欲平移的图层的指针
 *					vx0:x方向的平移数
 *					vy0:y方向的平移数
 */
void sheet_slide(struct SHEET *sht, int vx0, int vy0){
	struct SHTCTL *ctl = sht->ctl;
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
	sht->vx0 = vx0;
	sht->vy0 = vy0;
	if (sht->height >= 0) {
		//TODO 图层高度不为-1,即正在显示,则刷新显示
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1);
		sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);
	}
	return;
}
Example #11
0
/* move a single sheet without chaning its height, still need to sheet_refresh */
void sheet_slide(struct SHEET *sht, int vx0, int vy0) {
	struct SHTCTL *ctl = sht->ctl;
	int oldx = sht->vx0, oldy = sht->vy0;
	sht->vx0 = vx0;
	sht->vy0 = vy0;
	/* only repaint if this sheet is being displayed */
	if(sht->height >= 0) {
		/* only redraw the area before and after */
		/* 
			the old area needs to be redrawn from layer 0 - because it's removed 
			new aread can be redrawn from its height
		*/
		sheet_refreshmap(ctl, oldx, oldy, oldx+sht->bxsize, oldy+sht->bysize, 0);
		sheet_refreshsub(ctl, oldx, oldy, oldx+sht->bxsize, oldy+sht->bysize, 0, sht->height-1);
		sheet_refreshmap(ctl, vx0, vy0, vx0+sht->bxsize, vy0+sht->bysize, sht->height);
		sheet_refreshsub(ctl, vx0, vy0, vx0+sht->bxsize, vy0+sht->bysize, sht->height, sht->height);
	}
	return;
}
// move the sheet, and not change the height
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
	/*sht->vx0 = vx0;
	sht->vy0 = vy0;
	if (sht->height >= 0) { // if the sheet is displaying
		sheet_refresh(ctl);
	}
	return;*/
	struct SHTCTL *ctl = sht->ctl;
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
	sht->vx0 = vx0;
	sht->vy0 = vy0;
	if (sht->height >= 0) {
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1); // remove the old traces
		sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);                 // draw the new traces
	}
	return;
}
Example #13
0
/* 
	sht是需要被移动的图层
	vx0,vy1是被移动图层新的左上角坐标
 */
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
	struct SHTCTL *ctl = sht->ctl;
	int old_vx0 = sht->vx0, old_vy0 = sht->vy0;	/* 保存图层原来的坐标 */
	sht->vx0 = vx0;			/* 设置图层新的坐标 */
	sht->vy0 = vy0;
	
	/* 如果该图层不是一个隐藏图层 */
	if (sht->height >= 0) 
	{ 
		/* 先修改map信息 再进行重画 */
		/* 该语句相当于将map中(old_vx0, old_vy0)(old_vx0 + sht->bxsize, old_vy0 + sht->bysize)定义的
		   矩形区域重新设置,注意:此时sht图层的坐标已经修改了,而且此处给出的高度为0.也就是说从高度为0
		   到top的所有图层都会判断是否需要将自己的sid值写入map中该区域
		   */
		sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
		/* 与上一条语句类似,此时给出的高度是图层本身的高度 至于为什么请参考书中P213中间的一段话 */
		sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
		/* 修改了map之后根据map中的值来重画 */
		sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1);
		sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);
	}
	return;
}
Example #14
0
/* 
	move sht from its original height to the new height 
	note can move from height -1 to a positive height as well, in which case ctl->top will add one
*/
void sheet_updown(struct SHEET *sht, int height) {
	struct SHTCTL *ctl = sht->ctl;
	int h, old = sht->height;
	/* check param validity */
	/* can have up to top + 1 layers */
	if(height > ctl->top + 1) {
		height = ctl->top + 1;
	}
	if(height < -1) {
		height = -1;
	}
	sht->height = height;
	/* move it to a lower height */
	if(old > height) {
		if(height >= 0) {
			/* raise (height - old-1) one layer up */
			for(h = old; h > height; h--) {
				ctl->sheets[h] = ctl->sheets[h-1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
			/* this layer is still on screen, we only need to redraw the layers on top of it */
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height + 1);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height + 1, old);
		} 
		/* else height==-1 we need to remove it from ctl->sheets[] */
		else {
			if(ctl->top > old) {
				for(h = height; h < ctl->top; h++) {
					ctl->sheets[h] = ctl->sheets[h+1];
					/* 
						note height is consecutive but not just sorted in ascending order
						so we need to assign the new consequtive height numbers 
					*/
					ctl->sheets[h]->height = h;
				}
			}	
			ctl->top--;
			/* this layer is removed, we need to redraw everything */ 
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
		}
	} 
	/* move it to a higher height */
	else if(old < height) {
		if(old >= 0) {
			for(h = old; h < height; h++) {
				ctl->sheets[h] = ctl->sheets[h+1];
				ctl->sheets[h]->height = h;
			}
			ctl->sheets[height] = sht;
		}
		/* we are adding a new layer */
		else {
			for(h = ctl->top; h >= height; h--) {
				ctl->sheets[h+1] = ctl->sheets[h];
				ctl->sheets[h+1]->height = h + 1;
			}
			ctl->sheets[height] = sht;
			ctl->top++;
		}
		/* this layer is lifted, only draw from its height and above */
		sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height);
		sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height, sht->height);
	}
	
	return;
}
Example #15
0
/* 若对算法不明白的可参考任意一本关于数据结构的书籍 */
void sheet_updown(struct SHEET *sht, int height)
{
	struct SHTCTL *ctl = sht->ctl;
	int h, old = sht->height; /* 保存原来的高度 */

	/* 如果新的高度比所有图层的最大的高度还大 则调整它 */
	if (height > ctl->top + 1) 
	{
		height = ctl->top + 1;
	}
	/* 如果新高度小于-1 就设置为-1 我们只需要用-1来表示隐藏就足够了 */
	if (height < -1) {
		height = -1;
	}
	sht->height = height; /* 更新图层的高度 */

	/* 对p_sheets[]的排列(p_sheets[]就是一个按高度排序的有序数组) */
	if (old > height) 
	{	/* 原来的高度比新高度还要大 */
		if (height >= 0) 
		{
			/* 把中间的往上提 */
			/* 我们可以认为高度就是图层在p_sheets数组中的下标 */
			for (h = old; h > height; h--) 
			{	
				ctl->p_sheets[h] = ctl->p_sheets[h - 1];
				ctl->p_sheets[h]->height = h;		/* 调整原来p_sheets[]中指向的图层的高度 */
												/* 即更改原来的图层在p_sheets[]中的下标 */
			}
			ctl->p_sheets[height] = sht;			/* 插入新的图层指针 */
			/* 设置map信息并重画 */
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);
		} 
		else 
		{	/* 隐藏原来图层 */
			/* 如果原来的图层不是最上层的图层 */
			if (ctl->top > old) 
			{	
				/* 把上面的降下来 */
				for (h = old; h < ctl->top; h++)
				{
					ctl->p_sheets[h] = ctl->p_sheets[h + 1];
					ctl->p_sheets[h]->height = h;	/* 调整原来p_sheets[]中指向的图层的高度 */
				}
			}
			ctl->top--; /* 由于显示中的图层减少了一个, 所以最上层的图层高度减一 */
			/* 设置map信息并重画 */
			sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
			sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
		}
	} 
	else if (old < height) 
	{	/* 原来的高度比新高度还要小 */
		if (old >= 0) 
		{			/* 原来的图层如果不是隐藏的 */
			/* 把中间的拉下去 */
			for (h = old; h < height; h++) 
			{
				ctl->p_sheets[h] = ctl->p_sheets[h + 1];
				ctl->p_sheets[h]->height = h;		/* 调整原来p_sheets[]中指向的图层的高度 */
			}
			ctl->p_sheets[height] = sht;
			
		} 
		else 
		{	/* 原来的图层是隐藏的 */
			for (h = ctl->top; h >= height; h--) 
			{
				ctl->p_sheets[h + 1] = ctl->p_sheets[h];
				ctl->p_sheets[h + 1]->height = h + 1;		/* 调整原来p_sheets[]中指向的图层的高度 */
			}
			ctl->p_sheets[height] = sht;		/* 插入新的图层指针 */
			ctl->top++; /* 由于增加了一个要显示的图层,所以最上层的图层高度需要加一 */
		}
		/* 设置map信息并重画 */
		sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);
		sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);
	}
	return;
}