callback.c

来自「ANFY特效」· C语言 代码 · 共 2,174 行 · 第 1/5 页

C
2,174 行
字号
  case DLG_ANLENS:  case DLG_LIFE2D:  case DLG_MANDEL:  case DLG_PLASMA:  case DLG_ROTATE:  case DLG_TMAPCUBE:  case DLG_TUNNEL:  case DLG_TUNNEL3D:  case DLG_VOXEL:  case DLG_WARP:  case DLG_ANWATER:  case DLG_WORMHOLE:  case DLG_GALAXY:  case DLG_BOOKFLIP:  case DLG_MOSAIC:  case DLG_WOBBLER:  case DLG_ANFY3D:  case DLG_CONF_MENU:  case DLG_TSCROLLER:  case DLG_ANFYCAM:  case DLG_ANFYPAINT:  case DLG_SOLIDSCROLLER:  case DLG_ANFYSNOW:  case DLG_FIREWORKS:    current_dialog = DLG_STEP0;    break;  }  change_dialog ();}void on_next_clicked (GtkButton *button, gpointer user_data){  if (!validate_fields (GTK_WIDGET (button)->parent))    return;  save_dialog_data();  switch (current_dialog)  {    case DLG_STEP0:    {      switch (current_applet)      {      case APPLET_ANBLUR: current_dialog = DLG_ANBLUR; break;      case APPLET_ANFADE: current_dialog = DLG_ANFADE; break;      case APPLET_ANFLAG: current_dialog = DLG_ANFLAG; break;      case APPLET_ANFYBUMP: current_dialog = DLG_ANFYBUMP; break;      case APPLET_ANFRACT: current_dialog = DLG_ANFRACT; break;      case APPLET_ANLAKE: current_dialog = DLG_ANLAKE; break;      case APPLET_ANFYCAM: current_dialog = DLG_ANFYCAM; break;      case APPLET_ANLENS: current_dialog = DLG_ANLENS; break;      case APPLET_ANTUNNEL: current_dialog = DLG_TUNNEL; break;      case APPLET_ANVOXEL: current_dialog = DLG_VOXEL; break;      case APPLET_ANWATER: current_dialog = DLG_ANWATER; break;      case APPLET_BLOBS: current_dialog = DLG_BLOBS; break;      case APPLET_CUBEMENU: current_dialog = DLG_CUBEMENU; break;      case APPLET_DEFORM: current_dialog = DLG_DEFORM; break;      case APPLET_FIRE: current_dialog = DLG_FIRE; break;      case APPLET_FLAGLOAD: current_dialog = DLG_FLAGLOAD; break;      case APPLET_FLOZOIDS: current_dialog = DLG_FLOZOIDS; break;      case APPLET_FLUID : current_dialog = DLG_FLUID; break;      case APPLET_HUEROT: current_dialog = DLG_HUEROT; break;      case APPLET_LIFE2D: current_dialog = DLG_LIFE2D; break;      case APPLET_MANDEL: current_dialog = DLG_MANDEL; break;      case APPLET_PLASMA: current_dialog = DLG_PLASMA; break;      case APPLET_ROTATE: current_dialog = DLG_ROTATE; break;      case APPLET_TMAPCUBE: current_dialog = DLG_TMAPCUBE; break;      case APPLET_TUNNEL3D: current_dialog = DLG_TUNNEL3D; break;      case APPLET_WARP: current_dialog = DLG_WARP; break;      case APPLET_WORMHOLE: current_dialog = DLG_WORMHOLE; break;      case APPLET_GALAXY: current_dialog = DLG_GALAXY; break;      case APPLET_BOOKFLIP: current_dialog = DLG_BOOKFLIP; break;      case APPLET_MOSAIC: current_dialog = DLG_MOSAIC; break;      case APPLET_TSCROLLER: current_dialog = DLG_TSCROLLER; break;      case APPLET_WOBBLER: current_dialog = DLG_WOBBLER; break;      case APPLET_ANFY3D: current_dialog = DLG_ANFY3D; break;      case APPLET_WHEEL: current_dialog = DLG_CONF_MENU; break;      case APPLET_TREEMENU: current_dialog = DLG_CONF_MENU; break;      case APPLET_MORPHMENU: current_dialog = DLG_CONF_MENU; break;      case APPLET_ANFYPAINT: current_dialog = DLG_ANFYPAINT; break;      case APPLET_SOLIDSCROLLER: current_dialog = DLG_SOLIDSCROLLER; break;      case APPLET_ANFYSNOW: current_dialog = DLG_ANFYSNOW; break;      case APPLET_FIREWORKS: current_dialog = DLG_FIREWORKS; break;      }    } break;  case DLG_ANFY3D:    current_dialog = DLG_ANFY3D_0;    break;  case DLG_SOLIDSCROLLER:    current_dialog = DLG_ANFYFONT;    break;  case DLG_CONF_MENU:    if (current_applet == APPLET_WHEEL)      current_dialog = DLG_WHEEL;    else if (current_applet == APPLET_TREEMENU)      current_dialog = DLG_TREEMENU;    else if (current_applet == APPLET_MORPHMENU)      current_dialog = DLG_MORPHMENU;    break;  case DLG_TEXTSTYLE:    current_dialog = DLG_EXPERTMODE;    break;  case DLG_CONF_MENU_2:    if (current_applet == APPLET_CUBEMENU)    {      if (dlg_showtextstyle)	current_dialog = DLG_TEXTSTYLE;        else	current_dialog = DLG_EXPERTMODE;    }    else      current_dialog = DLG_EXPERTMODE;    break;  case DLG_EXPERTMODE:    current_dialog = DLG_REGISTRATION;    break;  case DLG_REGISTRATION:    current_dialog = DLG_STEP1;    break;  case DLG_ANBLUR:  case DLG_ANFADE:  case DLG_ANLENS:  case DLG_MANDEL:  case DLG_BOOKFLIP:  case DLG_MOSAIC:  case DLG_ANFYCAM:  case DLG_ANFYFONT:    current_dialog = DLG_EXPERTMODE;    break;  case DLG_ANFYPAINT:    current_dialog = DLG_REGISTRATION;    break;  case DLG_WHEEL:  case DLG_TREEMENU:  case DLG_MM_GALAXY:  case DLG_MM_BLOBS:    if (dlg_showfloat)      current_dialog = DLG_CONF_MENU_2;    else      current_dialog = DLG_EXPERTMODE;    break;  case DLG_MORPHMENU:    if (dlg_plugin == 0)      current_dialog = DLG_MM_GALAXY;    else if (dlg_plugin == 1)      current_dialog = DLG_MM_BLOBS;    else    {      if (dlg_showfloat)	current_dialog = DLG_CONF_MENU_2;      else	current_dialog = DLG_EXPERTMODE;    }    break;  case DLG_CUBEMENU:    if (dlg_showfloat)      current_dialog = DLG_CONF_MENU_2;    else      {	if (dlg_showtextstyle)	  current_dialog = DLG_TEXTSTYLE;  	else	  current_dialog = DLG_EXPERTMODE;      }    break;  case DLG_ANFYBUMP:  case DLG_ANFLAG:  case DLG_BLOBS:  case DLG_DEFORM:  case DLG_FIRE:  case DLG_FLAGLOAD:  case DLG_FLOZOIDS:  case DLG_FLUID:  case DLG_HUEROT:  case DLG_ANFRACT:  case DLG_ANLAKE:  case DLG_LIFE2D:  case DLG_PLASMA:  case DLG_ROTATE:  case DLG_TMAPCUBE:  case DLG_TUNNEL:  case DLG_TUNNEL3D:  case DLG_VOXEL:  case DLG_WARP:  case DLG_ANWATER:  case DLG_WORMHOLE:  case DLG_GALAXY:  case DLG_TSCROLLER:  case DLG_WOBBLER:  case DLG_ANFY3D_0:  case DLG_ANFYSNOW:  case DLG_FIREWORKS:    if (dlg_showtextstyle)      current_dialog = DLG_TEXTSTYLE;      else      current_dialog = DLG_EXPERTMODE;    break;  case DLG_STEP1:    info_dlg (_("To add this effect to your html page, you must copy the .class files to the same dir as the .html file, along with any GIF and JPG images.\nThis can be done with the \"Copy all files to...\" button: you must choose a name for the html file, and a path where save it, along with all the .class files and needed images. We suggest to save in a new folder.\nAdding the <applet>...</applet> tag to your html page, without the needed .class files, will not work.\n"), _("For more details, read instructions."), _("Publish"));    return;    break;  }  change_dialog ();}void on_exit_clicked (GtkButton *button, gpointer user_data){  if (message_box (_("Do you really want to exit?"), 1) == 1)    gtk_widget_destroy (main_dlg);}// =========================================================// Callbacks used by more than 1 dialog// 'Resolution' combobox changedvoid on_resolution_combo_changed (GtkWidget *widget, gpointer user_data){  char* text, buf[16];  int w, h, r;  if ((current_applet != APPLET_BLOBS) &&      (current_applet != APPLET_CUBEMENU) &&      (current_applet != APPLET_TMAPCUBE) &&      (current_applet != APPLET_ANFLAG) &&      (current_applet != APPLET_FLAGLOAD) &&      (current_applet != APPLET_WOBBLER))  {    text = gtk_entry_get_text (GTK_ENTRY (lookup_widget (main_dlg, "width")));    w = strtol (text, NULL, 10);    text = gtk_entry_get_text (GTK_ENTRY (lookup_widget (main_dlg, "height")));    h = strtol (text, NULL, 10);    text = gtk_entry_get_text (GTK_ENTRY (lookup_widget (main_dlg, "resolution_entry")));    r = strtol (text, NULL, 10);    if (current_applet == APPLET_BOOKFLIP)      h = h - dlg_oldextrah;    if (dlg_oldres != 0)    {      sprintf (buf, "%d", (int)(w/dlg_oldres*r));      gtk_entry_set_text (GTK_ENTRY (lookup_widget (main_dlg, "width")), buf);      sprintf (buf, "%d", (int)(h/dlg_oldres*r));      gtk_entry_set_text (GTK_ENTRY (lookup_widget (main_dlg, "height")), buf);    }    dlg_oldres = r;    if (current_applet == APPLET_BOOKFLIP)    {      int e;      text = gtk_entry_get_text (GTK_ENTRY (lookup_widget (main_dlg, "extra_height")));      e = strtol (text, NULL, 10);      text = gtk_entry_get_text (GTK_ENTRY (lookup_widget (main_dlg, "height")));      h = strtol (text, NULL, 10);      sprintf (buf, "%d", h+e);      gtk_entry_set_text (GTK_ENTRY (lookup_widget (main_dlg, "height")), buf);    }    /*    if (current_dialog == DLG_ANLAKE)      OnHalfreflect();    */  }}void on_image_list_add (GtkWidget *widget, gpointer user_data){  unsigned int iWidth, iHeight, iW,iH;  char strWorkDir[1024], strItem[1024], szImgFormat[10], buf[16];  int iLength, iCount, index;  char* filename, *ptr, *row[2] = { NULL, NULL };  char szSourcePath[1024], szFileName[1024];  IMAGE_INFO *info;  GtkCList *list;  file_browse ("Open", &filename);  if (filename == NULL)    return;  GetAppletPath(current_applet, strWorkDir);  iLength = strlen (strWorkDir);  list = GTK_CLIST (lookup_widget (main_dlg, "image_list"));  iCount = list->rows;  if (iCount > 0)   {    gtk_clist_get_text (list, 0, 0, &ptr);    strcpy (strItem, strWorkDir);    strcat (strItem, "/");    strcat (strItem, ptr);    if( !GetFormatAndSize( strItem, szImgFormat, &iW, &iH) )    {      g_free (filename);      return;    }  }  if (GetFormatAndSize(filename, szImgFormat, &iWidth, &iHeight))  {    if ((current_dialog == DLG_CUBEMENU) || (current_dialog == DLG_TMAPCUBE))    {      if (!(iWidth == 128 && iHeight == 128)	  && !(iWidth == 256 && iHeight == 256))	{	  message_box (_("Error ! Images width and height must be 128*128 or 2"), 0);	  g_free (filename);	  return;	}    }    if (iCount <=0)    {      iW = iWidth;      iH = iHeight;    }    else if ((iWidth != iW) || (iHeight != iH))    {      message_box(_("Error ! All images width and height must be the same"), 0);      g_free (filename);      return;    }    PathFromFile(filename, szSourcePath);    FileFromPath(filename, szFileName);    if( !MyCopyFile(szSourcePath, strWorkDir, szFileName ) )    {      message_box(_("Error ! Problem when copying file in applet directory"), 0);      g_free (filename);      return;    }    row[0] = szFileName;    index = gtk_clist_append (list, row);    info = g_malloc (sizeof (IMAGE_INFO));    gtk_clist_set_row_data (list, index, info);    image_info = g_list_append (image_info, info);    info->image = g_strdup (szFileName);    info->link = g_strdup ("");    info->status = g_strdup ("");    info->flip = g_strdup ("");    list->focus_row = index;    gtk_clist_select_row (list, index, 0);    if (list->rows == 6 	&& current_dialog != DLG_ANFADE 	&& current_dialog != DLG_BOOKFLIP	&& current_dialog != DLG_MOSAIC)      gtk_widget_set_sensitive (lookup_widget (main_dlg, "add"), FALSE);  }  if ((current_dialog != DLG_CUBEMENU) && (current_dialog != DLG_TMAPCUBE))  {    if (current_dialog == DLG_BOOKFLIP)      iHeight += dlg_oldextrah;    sprintf (buf, "%d", iWidth);    gtk_entry_set_text (GTK_ENTRY (lookup_widget (main_dlg, "width")), buf);    sprintf (buf, "%d", iHeight);    gtk_entry_set_text (GTK_ENTRY (lookup_widget (main_dlg, "height")), buf);    dlg_oldres=1;  }    /*  if (current_dialog == DLG_MOSAIC)    OnKillfocusTilesheight();    OnSelchangeCboRes();  */  gtk_widget_set_sensitive (lookup_widget (main_dlg, "remove"), TRUE);  g_free (filename);}void on_image_list_remove (GtkWidget *widget, gpointer user_data){  GtkCList* clist;  IMAGE_INFO* info;  int focus;  clist = GTK_CLIST (lookup_widget (main_dlg, "image_list"));  focus = clist->focus_row;  if (focus >= 0)  {    info = gtk_clist_get_row_data (clist, focus);    image_info = g_list_remove (image_info, info);    free_image_info (info);    gtk_clist_remove (clist, focus);    if (focus >= clist->rows)      focus = clist->rows - 1;    clist->focus_row = focus;    gtk_clist_select_row (clist, focus, 0);    if (clist->rows == 0)      on_image_list_select (clist, -1, 0, NULL);  }  gtk_widget_set_sensitive (lookup_widget (main_dlg, "add"), TRUE);}void on_image_list_up (GtkWidget *widget, gpointer user_data){  GtkCList* clist;  int focus;  clist = GTK_CLIST (lookup_widget (main_dlg, "image_list"));  focus = clist->focus_row;  if (clist->focus_row > 0)  {    gtk_clist_swap_rows (clist, focus, focus-1);    gtk_clist_select_row (clist, focus-1, 0);    clist->focus_row = focus-1;  }}void on_image_list_down (GtkWidget *widget, gpointer user_data){  GtkCList* clist;  int focus;  clist = GTK_CLIST (lookup_widget (main_dlg, "image_list"));  focus = clist->focus_row;

⌨️ 快捷键说明

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