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

📄 iconedit_panel.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
📖 第 1 页 / 共 4 页
字号:
	    continue;      }      break;   }   fullscreen_destroy(fsh);   return result;}staticblink(fd)int	fd;{	register int	i = 10000;	pr_rop(&iced_conf_pr, 0, 0, 16, 16, PIX_NOT(PIX_DST), 0, 0, 0);	win_setcursor(fd, &iconedit_confirm_cursor);	while (i--);	pr_rop(&iced_conf_pr, 0, 0, 16, 16, PIX_NOT(PIX_DST), 0, 0, 0);	win_setcursor(fd, &iconedit_confirm_cursor);}/* ARGSUSED */static voidsize_proc(item, val) Panel_item item;int     val;{   iced_panelmsg("","");   iced_set_state(val);}/* ARGSUSED */static voidgrid_proc(item, val)Panel_item item;int     val;{   iced_panelmsg("","");   if (val)      iced_paint_grid(PIX_SET);   else {      iced_paint_grid(PIX_CLR);      iced_paint_border();   }}/* ARGSUSED */static voidmode_proc(item, val)Panel_item item;int   val;{   int fill_val;   static int current_mode;   iced_panelmsg("","");   if (val != current_mode) {      switch (val)  {	 case MODE_POINT: 	  canvasmsg("        Points: Pick points to paint or clear.");	  window_set(iced_panel,PANEL_CARET_ITEM,iced_fname_item,0);	  break;	 case MODE_LINE: 	  canvasmsg(" Line: Pick one endpoint, extend to opposite endpoint.");	  window_set(iced_panel,PANEL_CARET_ITEM,iced_fname_item,0);	  break;	 case MODE_RECTANGLE: 	  canvasmsg(" Rectangle: Pick one corner, extend to opposite corner.");	  window_set(iced_panel,PANEL_CARET_ITEM,iced_fname_item,0);	  break;	 case MODE_CIRCLE: 	  canvasmsg("       Circle: Pick center, extend to perimeter.");    	  window_set(iced_panel,PANEL_CARET_ITEM,iced_fname_item,0);	  break;	 case MODE_TEXT: 	  canvasmsg("           Text: Pick point to insert text.");       	  window_set(iced_panel,PANEL_CARET_ITEM,iced_abc_item,0);	  break;      }   } else {      if (val == MODE_RECTANGLE) {	 fill_val = (int)panel_get_value(iced_fill_square_item) + 1; 	 fill_val = fill_val % FILL_PATTERN_COUNT;	 panel_set(iced_fill_square_item, PANEL_VALUE, fill_val, 0);	 fill_square_proc(iced_fill_square_item, fill_val);      } else if (val == MODE_CIRCLE) {	 fill_val = (int)panel_get_value(iced_fill_circle_item) + 1; 	 fill_val = fill_val % FILL_PATTERN_COUNT;	 panel_set(iced_fill_circle_item, PANEL_VALUE, fill_val, 0);	 fill_circle_proc(iced_fill_circle_item,fill_val);      } else if (val == MODE_TEXT) {	 fill_val = (int)panel_get_value(iced_font_item) + 1; 	 fill_val = fill_val % FONT_COUNT;	 panel_set(iced_font_item, PANEL_VALUE, fill_val, 0);	 font_proc(iced_font_item, fill_val);      }   }   current_mode = val;}static voidinvert_proc() {   iced_panelmsg("","");   backup();   iced_dirty_ul_cell.x = 0;   iced_dirty_ul_cell.y = 0;   iced_dirty_dr_cell.x = iced_cell_count-1;   iced_dirty_dr_cell.y = iced_cell_count-1;   pr_rop(iced_canvas_pr,0,0,iced_cell_count,iced_cell_count,PIX_NOT(PIX_DST),0,0,0);   iced_icon_canvas_is_clear = FALSE;   iced_paint_canvas();   iced_paint_proof_rect();}voidiced_clear_proc() {   iced_panelmsg("","");   backup();   iced_dirty_ul_cell.x = 0;   iced_dirty_ul_cell.y = 0;   iced_dirty_dr_cell.x = iced_cell_count-1;   iced_dirty_dr_cell.y = iced_cell_count-1;   pr_rop(iced_canvas_pr, 0, 0, iced_cell_count, iced_cell_count, PIX_CLR, 0, 0, 0);   pw_writebackground(iced_canvas_pw, 0, 0, BIG, BIG, PIX_CLR);   if (panel_get_value(iced_grid_item)) iced_paint_grid(PIX_SET);   iced_paint_border();   iced_paint_proof_rect();   if (iced_state == ICONIC)      iced_icon_canvas_is_clear = TRUE;}static voidfill_canvas_proc() {   int op,result;   iced_panelmsg("","");   if (!iced_fill_sq_pr)      return;   result = (int)panel_get_value(iced_fill_op_item);   op     = val_to_op(result);   backup();   iced_dirty_ul_cell.x = 0;   iced_dirty_ul_cell.y = 0;   iced_dirty_dr_cell.x = iced_cell_count-1;   iced_dirty_dr_cell.y = iced_cell_count-1;   pr_replrop(iced_canvas_pr,0,0,iced_cell_count,iced_cell_count,op,		iced_fill_sq_pr,0,0);   if (iced_state == ICONIC) {      if (iced_fill_sq_pr == iced_patch_prs[GR_WHITE])	 iced_icon_canvas_is_clear = TRUE;      else	 iced_icon_canvas_is_clear = FALSE;   }   iced_paint_proof_rect();   iced_paint_canvas();}/* ARGSUSED */static voidfill_square_proc(item,val)Panel_item item;int   val;{   iced_panelmsg("","");   switch (val) {      case 0:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_box_pr, 0);	 break;      case 1:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_sq_0, 0);	 break;      case 2:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_sq_25, 0);	 break;      case 3:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_sq_root, 0);	 break;      case 4:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_sq_50, 0);	 break;      case 5:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_sq_75, 0);	 break;      case 6:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 2, &iced_square_black, 0);	 break;   }   if (val) iced_fill_sq_pr = iced_patch_prs[val-1];   else     iced_fill_sq_pr = (struct pixrect *) NULL;}/* ARGSUSED */static voidfill_circle_proc(item, val)Panel_item item;int   val;{   iced_panelmsg("","");   switch (val) {      case 0:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_pr, 0);	 break;      case 1:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_0, 0);	 break;      case 2:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_25, 0);	 break;      case 3:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_root, 0);	 break;      case 4:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_50, 0);	 break;      case 5:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_75, 0);	 break;      case 6:	 panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 3, &iced_circle_black, 0);	 break;   }   if (val) iced_fill_ci_pr = iced_patch_prs[val-1];   else     iced_fill_ci_pr = (struct pixrect *) NULL;}static Panel_setting abc_proc(item, event)Panel_item item; struct inputevent *event; {   int	action = event_action(event);      if (action >= ' ' && action <= '~')      iced_panelmsg("","");   return fname_proc(item, event);}/* ARGSUSED */static voidfont_proc(item, val)Panel_item item; int   val;{   int value_y;   if ((Panel_item)window_get(iced_panel,PANEL_CARET_ITEM) != iced_abc_item) {      window_set(iced_panel, PANEL_CARET_ITEM, iced_abc_item, 0);      panel_set(iced_mode_item, PANEL_VALUE, MODE_TEXT, 0);      if (!val)	 val = FONT_COUNT + 1;      panel_set(iced_font_item, PANEL_VALUE, --val, 0);   } else {      switch (val) {	 case SCREEN_R_7:	    iced_abc_font = iced_screenr7;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_screenr7_pr, 0);	    value_y = 273;	    break;	 case SCREEN_R_11:	    iced_abc_font = iced_screenr11;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_screenr11_pr, 0);	    value_y = 271;	    break;	 case SCREEN_B_12:	    iced_abc_font = iced_screenb12;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_screenb12_pr, 0);	    value_y = 268;	    break;	 case SCREEN_R_12:	    iced_abc_font = iced_screenr12;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_screenr12_pr, 0);	    value_y = 268;	    break;	 case SCREEN_B_14:	    iced_abc_font = iced_screenb14;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_screenb14_pr, 0);	    value_y = 266;	    break;	 case SCREEN_R_14:	    iced_abc_font = iced_screenr14;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_screenr14_pr, 0);	    value_y = 266;	    break;	 case CMR_B_14:	    iced_abc_font = iced_cmrb14;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_cmrb14_pr, 0);	    value_y = 266;	    break;	 case CMR_R_14:	    iced_abc_font = iced_cmrr14;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_cmrr14_pr, 0);	    value_y = 266;	    break;	 case GALLANT_R_19:	    iced_abc_font = iced_gallantr19;	    panel_set(iced_mode_item, PANEL_CHOICE_IMAGE, 4, &iced_gallantr19_pr, 0);	    value_y = 264;	    break;	 default:	    break;      }      panel_set(iced_abc_item, 		PANEL_VALUE_FONT,   iced_abc_font,	        PANEL_VALUE_Y,      value_y,	        0);   }}/* ARGSUSED */static voidproof_background_proc(item, val)Panel_item item;int   val;{   iced_panelmsg("","");   iced_proof_pr = iced_patch_prs[val];   iced_paint_proof();}/* ARGSUSED */static voidproof_op_proc(item, val) Panel_item item;int   val;{   iced_panelmsg("","");   iced_new_cursor.cur_function = val_to_op(val);   if (iced_state == CURSOR)      window_set(iced_proof, WIN_CURSOR, &iced_new_cursor, 0);   iced_paint_proof_rect();}static int val_to_op(val) int val; {   switch(val) {      case OP_SRC:	 return(PIX_SRC);      case OP_OR:	 return(PIX_SRC | PIX_DST);      case OP_XOR:	 return(PIX_SRC ^ PIX_DST);      case OP_AND:	 return(PIX_SRC & PIX_DST);   }   /* NOTREACHED */}/* ARGSUSED */static voidquit_proc(item) Panel_item item;{   int		result;   Event	alert_event;   if (quit_invoked_from_keyboard) {      if (!ctrl_q_pending) {	 iced_panelmsg("","Confirm quit with ^Q...");	 return;      }   } else {      ctrl_q_pending = FALSE;      result = alert_prompt(	  (Frame)iced_base_frame,	  &alert_event,	  ALERT_MESSAGE_STRINGS,		"Are you sure you want to Quit?",		0,	  ALERT_BUTTON_YES,	"Confirm",	  ALERT_BUTTON_NO,	"Cancel",	  ALERT_OPTIONAL,	1,	  0);      if (result == ALERT_FAILED) {	  iced_panelmsg("","Confirm quit...");	  confirm_mouse_proc();	  if (!confirm()) {	     iced_panelmsg("","");	     canvas_mouse_proc();	     return;	  }      } else {	  if (result == ALERT_YES) {		result = 1;	  } else result = 0;      }      if (!result) {	  return;      }   }   iced_panelmsg("","Quitting...");   window_set(iced_base_frame, FRAME_NO_CONFIRM, TRUE, 0);   window_destroy(iced_base_frame);}/**************************************************************************//* store button event proc                                                *//**************************************************************************/static voidstore_button_event_proc(item, event)Panel_item item;Event *event;{   if (event_action(event) == MS_RIGHT && event_is_down(event)) {      int result = (int)menu_show(store_menu, iced_panel, event, 0);      switch (result) {	 case 1: store_proc(item);		 break;	 case 2: store_proc(0);		 break;      }   } else      panel_default_handle_event(item, event);}

⌨️ 快捷键说明

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