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

📄 geardesignui.c

📁 Pro.TOOLKIT.Wildfire插件设计.配套光盘-141M.zip
💻 C
📖 第 1 页 / 共 3 页
字号:
\*=============================================================*/int ProTKGDUITeethFromUIUpdate (GearParam* g_ptr){  status = ProUIInputpanelDoubleGet (GD_UI_MAIN, GD_UI_TOOTH_PRESSURE_ANGLE, &g_ptr->Pressure_angle);  status = ProUIInputpanelDoubleGet (GD_UI_MAIN, GD_UI_TOOTH_P1_INPUT, &g_ptr->tooth_par1);  status = ProUISpinboxIntegerGet (GD_UI_MAIN, GD_UI_N_TEETH_SPINBOX, &g_ptr->n_of_teeth);  if (g_ptr->gear_type == RING_GEAR)    ProUIInputpanelDoubleGet (GD_UI_MAIN, GD_UI_TOOTH_INNER_SURF_INPUT,			      &g_ptr->inner_diam);  return PRO_TK_NO_ERROR;}/*=============================================================*\  Function: 	ProTKGDUIStepFromTableGet  Purpose:	Utility: Get step id from table row\*=============================================================*/int ProTKGDUIStepFromTableGet (char* table_row, ProTKGDStep* step){  int ii;  for (ii = 0;  ii < NUM_GD_STEPS; ii ++)    {      if (strcmp (table_row, gd_components[ii].step_row_name) == 0)	{	  *step = gd_components [ii].step;	  return (int)PRO_TK_NO_ERROR;	}    }  return (int)PRO_TK_GENERAL_ERROR;}/*=============================================================*\  Function: 	ProTKGDUICreateButtonUpdate  Purpose:	Utility: Update sensitivity of "Create" menu button\*=============================================================*/ProBoolean ProTKGDUICreateButtonUpdate (GearParam* g_ptr){  ProTKGDStep step = g_ptr->current_step;  ProBoolean enable;  switch (step)    {    case  PTK_GD_DATUM:      enable = (g_ptr->datum_created ?  PRO_B_FALSE : PRO_B_TRUE);      break;    case PTK_GD_DISK:      enable = (g_ptr->disk_created ?  PRO_B_FALSE : PRO_B_TRUE);      break;    case PTK_GD_HOLE:      enable = (g_ptr->hole_created ?  PRO_B_FALSE : PRO_B_TRUE);      break;    case PTK_GD_HUB:      enable = (g_ptr->hub_created ?  PRO_B_FALSE : PRO_B_TRUE);      break;    case PTK_GD_BACKPLATE:      enable = (g_ptr->backplate_created ?  PRO_B_FALSE : PRO_B_TRUE);      break;    case PTK_GD_TEETH:      enable = (g_ptr->teeth_created ?  PRO_B_FALSE : PRO_B_TRUE);      break;    }  if (enable)    {      if (step != PTK_GD_DATUM && !g_ptr->datum_created)	enable = PRO_B_FALSE;      if (step != PTK_GD_DATUM && step != PTK_GD_DISK && !g_ptr->disk_created)	enable = PRO_B_FALSE;      if (g_ptr->gear_type == RING_GEAR)	if (step != PTK_GD_DATUM && step != PTK_GD_DISK && step != PTK_GD_BACKPLATE && !g_ptr->backplate_created)	  enable = PRO_B_FALSE;    }  if (enable)    ProUIPushbuttonEnable (GD_UI_MAIN, GD_UI_CREATEBTN);  else    ProUIPushbuttonDisable (GD_UI_MAIN, GD_UI_CREATEBTN);  return enable;}/*=============================================================*\  Function: 	ProTKGDUIToggleType  Purpose:	Utility: toggle type (ring <-> spur) in the UI\*=============================================================*/void ProTKGDUIToggleType (GearParam* g_ptr){  /* Clear status table */  ProUITableCellComponentDelete (GD_UI_MAIN, GD_UI_STATUS_TABLE,				 GD_UI_DATUM_ROW, GD_UI_STATUS_DONECOL);  ProUITableCellComponentDelete (GD_UI_MAIN, GD_UI_STATUS_TABLE,				 GD_UI_DISK_ROW, GD_UI_STATUS_DONECOL);  ProUITableCellComponentDelete (GD_UI_MAIN, GD_UI_STATUS_TABLE,				 GD_UI_HOLE_ROW, GD_UI_STATUS_DONECOL);  ProUITableCellComponentDelete (GD_UI_MAIN, GD_UI_STATUS_TABLE,				 GD_UI_HUB_ROW, GD_UI_STATUS_DONECOL);  ProUITableCellComponentDelete (GD_UI_MAIN, GD_UI_STATUS_TABLE,				 GD_UI_BACKPLATE_ROW, GD_UI_STATUS_DONECOL);  ProUITableCellComponentDelete (GD_UI_MAIN, GD_UI_STATUS_TABLE,				 GD_UI_TEETH_ROW, GD_UI_STATUS_DONECOL);  ProUITableRownamesSet (GD_UI_MAIN, GD_UI_STATUS_TABLE, 0, NULL);  if (g_ptr->gear_type == RING_GEAR)    {//      ProUILabelShow (GD_UI_MAIN, GD_UI_TOOTH_INNER_SURF_LABEL);//      ProUIInputpanelShow (GD_UI_MAIN, GD_UI_TOOTH_INNER_SURF_INPUT);    }  else    {           ProUILabelHide (GD_UI_MAIN, GD_UI_TOOTH_INNER_SURF_LABEL);      ProUIInputpanelHide (GD_UI_MAIN, GD_UI_TOOTH_INNER_SURF_INPUT);    }  /* Reinitialize it */  ProTKGDUIStatusTableInit (g_ptr);}/*=============================================================*\  Function: 	ProTKGDUISelectNext  Purpose:	Utility: select next item (typically after creation)\*=============================================================*/int   ProTKGDUISelectNext (GearParam* g_ptr, ProTKGDStep step){  ProTKGDStepInfo* order;  int ii, current_index;  ProTKGDStep next_step;  char * next_select [2];  switch (g_ptr->gear_type)    {    case SPUR_GEAR:      order = (ProTKGDStepInfo*)spur_gear_designinfo;      break;    case RING_GEAR:      order = (ProTKGDStepInfo*)ring_gear_designinfo;      break;    }  for (ii = 0; ii < NUM_GD_STEPS; ii++)    {      if (order[ii].step == step)	{	  current_index = ii;	  break;	}    }    ProTKGDUIStatusTableRowUpdate (g_ptr, step, gd_components[step].step_row_name);  if (current_index != NUM_GD_STEPS - 1)    {      next_step = order [current_index + 1].step;      next_select[0] = gd_components[next_step].step_row_name;      next_select[1] = GD_UI_STATUS_COMPCOL;            g_ptr->current_step = next_step;            ProUITableSelectednamesSet (GD_UI_MAIN, GD_UI_STATUS_TABLE,				  2, next_select);         ProUITabSelectednamesSet (GD_UI_MAIN, GD_UI_MAINTAB,				1, &gd_components[next_step].step_layout);      gd_components [next_step].update_ui_function (g_ptr);     }  return PRO_TK_NO_ERROR;}/*=============================================================*\  Function: 	ProTKGDUIStatusTableRowUpdate  Purpose:	Utility: update the creation status icon in table\*=============================================================*/int ProTKGDUIStatusTableRowUpdate (GearParam* g_ptr,				   ProTKGDStep step,				   char* new_row_name){  ProBoolean created = PRO_B_FALSE;  char* current_component;  char* new_component;  char* source_label;  switch (step)    {    case PTK_GD_DATUM:      if (g_ptr->datum_created)	created = PRO_B_TRUE;      new_component = "DatumCreatedLabel";      break;    case PTK_GD_DISK:      if (g_ptr->disk_created)	created = PRO_B_TRUE;      new_component = "DiskCreatedLabel";      break;    case PTK_GD_HOLE:      if (g_ptr->hole_created)	created = PRO_B_TRUE;      new_component = "HoleCreatedLabel";      break;    case PTK_GD_HUB:      if (g_ptr->hub_created)	created = PRO_B_TRUE;      new_component = "HubCreatedLabel";      break;    case PTK_GD_BACKPLATE:      if (g_ptr->backplate_created)	created = PRO_B_TRUE;      new_component = "BackplateCreatedLabel";      break;    case PTK_GD_TEETH:      if (g_ptr->teeth_created)	created = PRO_B_TRUE;      new_component = "TeethCreatedLabel";      break;    }  ProUITableCellComponentDelete (GD_UI_MAIN,				 GD_UI_STATUS_TABLE,				 new_row_name,				 GD_UI_STATUS_DONECOL);  if (created)    source_label = GD_UI_LABEL_COMPLETED;  else    source_label = GD_UI_LABEL_NOT_COMPLETED;  ProUITableCellComponentCopy (GD_UI_MAIN,			       GD_UI_STATUS_TABLE,			       new_row_name,			       GD_UI_STATUS_DONECOL,			       GD_UI_MAIN,			       source_label,			       new_component);  return PRO_TK_NO_ERROR;}/*=============================================================*\  Function: 	ProTKGDUIStatusTableRowAdd  Purpose:	Utility: add the designated row to the table\*=============================================================*/int ProTKGDUIStatusTableRowAdd (GearParam* g_ptr,				ProTKGDStep step,				ProBoolean required){  char ** row_names;  int n_rows;  char * new_row_name = gd_components [step].step_row_name;  ProLine new_row_label;    status = ProUITableRownamesGet (GD_UI_MAIN, GD_UI_STATUS_TABLE, 			 &n_rows, &row_names);  if (status == PRO_TK_NO_ERROR && n_rows > 0)    {         ProUITableRowsInsert (GD_UI_MAIN, GD_UI_STATUS_TABLE,			    row_names [n_rows-1], 1, 			    &new_row_name);            ProStringarrayFree (row_names, n_rows);    }  else    {      ProUITableRowsInsert (GD_UI_MAIN, GD_UI_STATUS_TABLE,			      NULL, 1, 			      &new_row_name);    }  ProStringToWstring (new_row_label, new_row_name);  ProUITableCellLabelSet (GD_UI_MAIN, GD_UI_STATUS_TABLE,			  new_row_name, GD_UI_STATUS_COMPCOL,			  new_row_label);  ProUITableCellLabelSet (GD_UI_MAIN, GD_UI_STATUS_TABLE,			  new_row_name, GD_UI_STATUS_REQCOL,			  (required?L"Required":L"Optional"));						  ProTKGDUIStatusTableRowUpdate (g_ptr, step, new_row_name);  return PRO_TK_NO_ERROR;}/*=============================================================*\  Function: 	ProTKGDUIStatusTableInit  Purpose:	Utility: initialize the creation status table\*=============================================================*/int ProTKGDUIStatusTableInit (GearParam* g_ptr){  ProTKGDStepInfo* order;  int ii;  switch (g_ptr->gear_type)    {    case SPUR_GEAR:      order = (ProTKGDStepInfo*)spur_gear_designinfo;      break;    case RING_GEAR:      order = (ProTKGDStepInfo*)ring_gear_designinfo;      break;    }  for (ii = 0; ii < NUM_GD_STEPS; ii++)    {      ProTKGDUIStatusTableRowAdd (g_ptr, order [ii].step, order [ii].required);    }  return PRO_TK_NO_ERROR;}/*=================== UI ACTION FUNCTIONS =====================*//*=============================================================*\  Function: 	ProTKGDUICloseAction  Purpose:	Close button action function\*=============================================================*/void ProTKGDUICloseAction (char* dialog,			   char *component,			   ProAppData appdata){  ProUIDialogExit (dialog, 0);}/*=============================================================*\  Function: 	ProTKGDUIDiskInputAction  Purpose:	Disk params input action function\*=============================================================*/void ProTKGDUIDiskInputAction (char* dialog,				 char *component,				 ProAppData appdata){  GearParam* g_ptr = (GearParam*)appdata;  ProTKGDUIDiskFromUIUpdate (g_ptr);  ProTKGDUIDiskUIUpdate (g_ptr);}/*=============================================================*\  Function: 	ProTKGDUIHoleInputAction  Purpose:	Hole params input action function\*=============================================================*/void ProTKGDUIHoleInputAction (char* dialog,				 char *component,				 ProAppData appdata){  GearParam* g_ptr = (GearParam*)appdata;  ProTKGDUIHoleFromUIUpdate (g_ptr);  ProTKGDUIHoleUIUpdate (g_ptr);}/*=============================================================*\  Function: 	ProTKGDUITableSelectAction  Purpose:	Table selection action function\*=============================================================*/void ProTKGDUITableSelectAction (char* dialog,				 char *component,				 ProAppData appdata){  GearParam* g_ptr = (GearParam*)appdata;  ProTKGDStep step;  int n_sel;  char** selections;  ProCharLine sel_row;  ProUITableSelectednamesGet (GD_UI_MAIN, GD_UI_STATUS_TABLE,			      &n_sel, &selections);    /* Need to know only the selected row in the table */  strcpy (sel_row, selections [0]);    ProStringarrayFree (selections, n_sel);  ProTKGDUIStepFromTableGet (sel_row, &step);  status = ProUITabSelectednamesSet (GD_UI_MAIN, GD_UI_MAINTAB,			    1, &gd_components [step].step_layout);  g_ptr->current_step = step;  gd_components [step].update_ui_function (g_ptr);}/*=============================================================*\  Function: 	ProTKGDUICreateAction  Purpose:	"Create" button action function\*=============================================================*/void ProTKGDUICreateAction (char* dialog,				 char *component,				 ProAppData appdata){  ProError err;  ProBoolean keyway, key, bn;  GearParam* g_ptr = (GearParam*)appdata;  char ** selected_layout;  int num_selected;  ProTKGDStep step = g_ptr->current_step;  gd_components [step].update_from_ui_function (g_ptr);  switch (step)    {    case PTK_GD_DATUM:      ProUserCreateDatum (g_ptr);      break;    case PTK_GD_DISK:      ProUserCreateDisk (g_ptr);      break;    case PTK_GD_HOLE:      ProUserCreateHole (g_ptr);            ProUICheckbuttonGetState (GD_UI_MAIN, GD_UI_INCLUDE_KEYWAY, &keyway);            if (keyway)	{	  ProTKGDUIKeywayFromUIUpdate (g_ptr);	  ProUserCreateKeyway (g_ptr);	}      ProUIRadiogroupDisable (GD_UI_MAIN, GD_UI_GEARTYPE_GROUP_M);      break;    case PTK_GD_HUB:      ProUserCreateHub (g_ptr);      ProUICheckbuttonGetState (GD_UI_MAIN, GD_UI_INCLUDE_KEY, &key);            if (key)	{	  ProTKGDUIKeyFromUIUpdate (g_ptr);	  ProUserCreateKey (g_ptr);	}            ProUIRadiogroupDisable (GD_UI_MAIN, GD_UI_GEARTYPE_GROUP_M);            break;    case PTK_GD_BACKPLATE:      ProUserCreateBackPlate (g_ptr);      ProUICheckbuttonGetState (GD_UI_MAIN, GD_UI_INCLUDE_BN, &bn);            if (bn)	{	  ProTKGDUIBacknotchFromUIUpdate (g_ptr);	  ProUserCreateBackNotch (g_ptr);	}      ProUIRadiogroupDisable (GD_UI_MAIN, GD_UI_GEARTYPE_GROUP_M);      break;    case PTK_GD_TEETH:      if (g_ptr->gear_type == RING_GEAR)	ProUserCreateToothSurf (g_ptr);            ProUserCreateTooth (g_ptr);      ProUserCreateTeeth (g_ptr);            ProUIRadiogroupDisable (GD_UI_MAIN, GD_UI_GEARTYPE_GROUP_M);      break;    }  gd_components [step].update_ui_function (g_ptr);

⌨️ 快捷键说明

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