main.c
来自「ANFY特效」· C语言 代码 · 共 472 行 · 第 1/2 页
C
472 行
/* * Initial main.c file generated by Glade. Edit as required. * Glade will not overwrite this file. */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <gtk/gtk.h>#include <stdio.h>#include "main.h"#include "support.h"#include "dialogs.h"#include "custom.h"// =========================================================void restore_dialog_data (int usedefault);// =========================================================// Global variablesGList* icon_list = NULL;GList* image_info = NULL;GtkWidget* main_dlg = NULL;INFO applet_info[NUMAPPLETS];int current_dialog;int current_applet;int dlg_showfloat;int dlg_showtextstyle;int dlg_oldres;int dlg_oldextrah;int dlg_backcolor_red;int dlg_backcolor_green;int dlg_backcolor_blue;int dlg_f1color_red;int dlg_f1color_green;int dlg_f1color_blue;int dlg_f2color_red;int dlg_f2color_green;int dlg_f2color_blue;int dlg_forcolor_red;int dlg_forcolor_green;int dlg_forcolor_blue;guint32 dlg_ul_backcolor;guint32 dlg_ul_pencolor;guint32 dlg_ul_wheelcolor;guint32 dlg_ul_textcolor;guint32 dlg_ul_selectcolor;guint32 dlg_ul_seedcolor;int dlg_firecolor_red;int dlg_firecolor_green;int dlg_firecolor_blue;guint32 dlg_ul_firecolor;guint32 dlg_ul_selbackcolor;guint32 dlg_ul_scrollcolor;guint32 dlg_ul_filtercolor;int dlg_plugin; int dlg_textcolor_red;int dlg_textcolor_green;int dlg_textcolor_blue;int dlg_textscolor_red;int dlg_textscolor_green;int dlg_textscolor_blue;char g_strAppPath[256];char g_strAppletDir[256];char g_strHelpDir[256];CHAR_SET map_char_set[] = { { "Arabic (ISO)", "iso-8859-6" }, { "Arabic (Windows)", "windows-1256" }, { "Baltic (ISO)", "iso-8859-4" }, { "Baltic (Windows)", "windows-1257" }, { "Chinese (Traditional)", "big5" }, { "Chinese (Simplified)", "gb2312" }, { "Chinese (Simplified HZ)", "hz-gb-2312" }, { "Cyrillic (ISO)", "iso-8859-5" }, { "Cyrillic (Windows)", "windows-1251" }, { "European (Central, ISO)", "iso-8859-2" }, { "European (Central, Windows)", "windows-1250" }, { "European (Western, ISO)", "iso-8859-1" }, { "Greek (ISO)", "iso-8859-7" }, { "Greek (Windows)", "windows-1253" }, { "Hebrew (ISO)", "iso-8859-8" }, { "Hebrew (Windows)", "windows-1255" }, { "Japanese (Shift-JIS)", "x-sjis" }, { "Japanese (JIS)", "iso-2022-jp" }, { "Japanese (EUC)", "x-euc-jp" },//{ "Korean (ISO)", "iso-2022-kr" }, { "Korean (ISO)", "KS_C_5601-1987" }, { "Korean (euc-kr)", "euc-kr" }, { "Latin 3 (ISO)", "iso-8859-3" }, { "Thai (ISO)", "iso-8859-11" }, { "Thai (Windows)", "windows-874" }, { "Turkish (ISO)", "iso-8859-9" }, { "Turkish (Windows)", "windows-1254" }, { "Ukrainian (KOI8-RU)", "koi8-ru" }, { "Vietnamese (Windows)", "windows-1258" }, { NULL, NULL }}; void init_applet_info(){ applet_info[APPLET_ANBLUR].name = "BLUR"; applet_info[APPLET_ANBLUR].description = _("This is a Java(tm) routine that can animate a sequence of GIF/JPG images. Unlike other animators, it also calculates the motion blur effect between frames resulting in an effect like a high speed camera. Note: GIF/JPG images must be identical sizes."); applet_info[APPLET_ANFYBUMP].name = "BUMP"; applet_info[APPLET_ANFYBUMP].description = _("This applet gives an effect of a light source over a \"bumpy\" surface that casts a shadow in relation to the light source. Any size image will work, and you can have an optional bump-image if identical in size to the picture."); applet_info[APPLET_ANFADE].name = "CFADE"; applet_info[APPLET_ANFADE].description = _("This applet can execute a cross-fade between any GIF or JPG image, the only requirement is that all images must be same size."); applet_info[APPLET_ANFLAG].name = "FLAG"; applet_info[APPLET_ANFLAG].description = _("This applet can generate an animated waving flag in real time. You can choose from the flags of 34 nations which are included.\n"); applet_info[APPLET_ANFRACT].name = "IFSFRACT"; applet_info[APPLET_ANFRACT].description = _("This applet renders fractals by recursivly calculating a fractal-tree that morphs using sin and cos tabs. The applet is fully configurable regarding fractal generation and color palette."); applet_info[APPLET_ANLAKE].name = "LAKE"; applet_info[APPLET_ANLAKE].description = _("This applet generates a reflection effect under any GIF/JPG image. The effect is similar to other Lake and DorianGray applets, but this one is calculated in realtime requiring less memory (about ten times less!)"); applet_info[APPLET_ANLENS].name = "LENS"; applet_info[APPLET_ANLENS].description = _("This applet can simulate a lens moving over any GIF or JPG image."); applet_info[APPLET_BLOBS].name = "BLOBS"; applet_info[APPLET_BLOBS].description = _("This applet can generate and animate a realtime \"blobs\" effect, a sort of \"light interference\" between lightballs."); applet_info[APPLET_CUBEMENU].name = "CUBEMENU"; applet_info[APPLET_CUBEMENU].description = _("This applet is a modified version of the TMAPCUBE that works as a menu selector. Each face of the cube becomes a selectable link/menu option. This feature is enabled only after registering the shareware."); applet_info[APPLET_DEFORM].name = "DEFORM"; applet_info[APPLET_DEFORM].description = _("This applet gives a continuous deforming effect to any GIF/JPG image."); applet_info[APPLET_FIRE].name = "FIRE"; applet_info[APPLET_FIRE].description = _("This applet generates and animates a realtime ""fire"" effect which is well known in the ""demo scene"" contest."); applet_info[APPLET_FLAGLOAD].name = "FLAGLOAD"; applet_info[APPLET_FLAGLOAD].description = _("This applet can generate an animated waving flag in real time using your own GIF/JPG flag sized to 50 X 33."); applet_info[APPLET_FLOZOIDS].name = "FLOZOIDS"; applet_info[APPLET_FLOZOIDS].description = _("This applet animates an ""artificial life"" algorithm, where some of the ""flozoids"" appear to fly or swim around the image."); applet_info[APPLET_FLUID].name = "FLUID"; applet_info[APPLET_FLUID].description = _("This applet can simulate fluid wavings."); applet_info[APPLET_HUEROT].name = "HUEROT"; applet_info[APPLET_HUEROT].description = _("This applet continually changes the hue of any GIF/JPG image in a rotating sequence."); applet_info[APPLET_MANDEL].name = "MANDEL"; applet_info[APPLET_MANDEL].description = _("This applet can generate and animate a realtime Mandelbrot fractal."); applet_info[APPLET_LIFE2D].name = "LIFE2D"; applet_info[APPLET_LIFE2D].description = _("This applet can generate and simulate in realtime an Artificial Life, using Conway algorythm... the result is a sort of unicellular life."); applet_info[APPLET_ROTATE].name = "ROT"; applet_info[APPLET_ROTATE].description = _("This applet zooms and rotates any GIF/JPG image into distortion. The image must be sized to equal a power of 2 (64 X 64 pixels, 32 X 64 pixels,128 X 128 ...)."); applet_info[APPLET_PLASMA].name = "PLASMA"; applet_info[APPLET_PLASMA].description = _("This applet can generate and animate a realtime ""plasma"" effect, well known in the ""demo scene"" contest."); applet_info[APPLET_ANTUNNEL].name = "TUNNEL"; applet_info[APPLET_ANTUNNEL].description = _("This applet can generate a texturemapped tunnel from any GIF/JPG image."); applet_info[APPLET_TMAPCUBE].name = "TMAPCUBE"; applet_info[APPLET_TMAPCUBE].description = _("This applet uses any GIF/JPG image as a texture map on the faces of a cube."); applet_info[APPLET_ANVOXEL].name = "VOXEL"; applet_info[APPLET_ANVOXEL].description = _("This applet can generate a lightsourced voxel landscape in realtime."); applet_info[APPLET_TUNNEL3D].name = "TUNNEL3D"; applet_info[APPLET_TUNNEL3D].description = _("This applet generates a texturemapped tunnel with 3D interior views from any GIF/JPG image."); applet_info[APPLET_ANWATER].name = "WATER"; applet_info[APPLET_ANWATER].description = _("This applet makes any GIF/JPG image appear in clear ""liquid"" form, with drops falling on the image in an increasing tempo."); applet_info[APPLET_WARP].name = "WARP"; applet_info[APPLET_WARP].description = _("This applet creates a warp/spiraling effect on any GIF/JPG image. The image must be sized to equal a power of 2 (64 X 64 pixels, 32 X 64 pixels,128 X 128 ...). You can get a \\""breathing image\\"" effect by changing the parameters."); applet_info[APPLET_WORMHOLE].name = "WORMHOLE"; applet_info[APPLET_WORMHOLE].description = _("This applet generates a wormhole effect in real time (often called a dot-tunnel)."); applet_info[APPLET_GALAXY].name = "GALAXY"; applet_info[APPLET_GALAXY].description = _("This applet can generate and animate a realtime ""galaxy"" effect. This applet is fully parametrized, so you can generate all kinds of galaxies."); applet_info[APPLET_BOOKFLIP].name = "BOOKFLIP"; applet_info[APPLET_BOOKFLIP].description = _("This applet can execute a ""book flip"" transition between any identically sized GIF or JPG images."); applet_info[APPLET_MOSAIC].name = "MOSAIC"; applet_info[APPLET_MOSAIC].description = _("This applet can execute a tiling transition among any identically sized GIF or JPG images."); applet_info[APPLET_ANFY3D].name = "ANFY3D LIGHT"; applet_info[APPLET_ANFY3D].description = _("This applet can animate in realtime 3d ojects, even with shading and texture mapping, transparency, motion blur, fog. Some sample objects are provided: sphere, cone, waving sheet, labyrinth."); applet_info[APPLET_WHEEL].name = "WHEELMENU"; applet_info[APPLET_WHEEL].description = _("This applet is a 3d navigational menu: it can display up to 8 menu's, with 8 items each menu."); applet_info[APPLET_MORPHMENU].name = "MORPHMENU"; applet_info[APPLET_MORPHMENU].description = _("This applet is a navigational menu: it can display up to 20 sub menu's, with max 20 items each menu, with a nice text morph effect. Note: links are enabled online only after registering."); applet_info[APPLET_WOBBLER].name = "WOBBLER"; applet_info[APPLET_WOBBLER].description = _("This applet can wobble any GIF or JPG image of any size. It is based on original code by Jetro Lauha that I am using under license. Due to particular optimizations, the applet size must be a multiple of 8, both width and height."); applet_info[APPLET_TSCROLLER].name = "TEXTSCROLLER"; applet_info[APPLET_TSCROLLER].description = _("This is simply the scrolltext routine present in most of the applets, without any effect in the background."); applet_info[APPLET_TREEMENU].name = "TREEMENU"; applet_info[APPLET_TREEMENU].description = _("This applet is a navigational menu, which emulates the windows tree structures. It can display unlimited sub menus, with any kind of icons. Note: links are enabled online only after registering."); applet_info[APPLET_ANFYCAM].name = "ANFYCAM"; applet_info[APPLET_ANFYCAM].description = _("This applet reloads an image from a given URL location every a specified number of seconds. In other words, it can display the frames generated from a web cam."); applet_info[APPLET_ANFYPAINT].name = "ANFYPAINT"; applet_info[APPLET_ANFYPAINT].description = _("This applet is a complete paint program, with freehand, and geometric drawing tools."); applet_info[APPLET_SOLIDSCROLLER].name = "SOLIDSCROLLER"; applet_info[APPLET_SOLIDSCROLLER].description = _("This applet display a scrolling text, using colored fonts.\nThe text can jump, wave and can have a mirror effect on bottom area."); applet_info[APPLET_ANFYSNOW].name = "SNOW"; applet_info[APPLET_ANFYSNOW].description = _("This applet adds snow flakes to any image, preferably one with snow present already on the ground."); applet_info[APPLET_FIREWORKS].name = "FIREWORKS"; applet_info[APPLET_FIREWORKS].description = _("This applet adds fireworks to any image or background, preferably one very dark or definitely black.");};void free_image_info (IMAGE_INFO* info){ if (info == NULL) return; g_free (info->image); g_free (info->link); g_free (info->status); g_free (info->flip); g_free (info);}GtkWidget* set_color_pixmap (GtkWidget* pixwidget, int r, int g, int b){ GdkColor c; GdkGC* gc; GdkPixmap* pixmap; gc = gdk_gc_new (main_dlg->window); pixmap = gdk_pixmap_new (main_dlg->window, 20, 20, -1); c.red = r*256; c.green = g*256; c.blue = b*256; gdk_color_alloc (gtk_widget_get_colormap(main_dlg), &c); gdk_gc_set_foreground(gc, &c); gdk_draw_rectangle (pixmap, gc, TRUE, 0, 0, 20, 20); if (pixwidget == NULL) pixwidget = gtk_pixmap_new (pixmap, (GdkBitmap*)NULL); else gtk_pixmap_set (GTK_PIXMAP (pixwidget), pixmap, (GdkBitmap*)NULL); gdk_pixmap_unref (pixmap); gdk_gc_destroy(gc); return pixwidget;}GtkWidget* valid_widget (GtkWidget *widget, const gchar *widget_name){ GtkWidget *parent, *found_widget; for (;;) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?