📄 fuzzy.cc
字号:
//**************************************************************//* filename: fuzzy.cc *//* *//**************************************************************//* programmed by: Thomas Wagner *//* last change: (XXX: not updated) *//**************************************************************#include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>#include <sys/types.h> //#include <X11/Xlib.h>#include <X11/Xutil.h>#include "window.h"#include "mainwindow.h"#include "welcome.h"#include "init.h"#include "version.h"#define DEFAULT_FONT "fixed"extern XContext Windowcontext;MainWindow *Mainwindow;static voidusage (){ printf ("\ \n use: fcluster [<options>]\ \n\n with options selected from:\ \n\t-h: help\ \n\t-input FILENAME: load FILENAME as Input-Object\ \n\t-rule FILENAME: load FILENAME as Rule-Object\ \n\t-class FILENAME: load FILENAME as Classify-Object\ \n\t-cluster FILENAME: load FILENAME as Cluster-Object\ \n\t-randoff: no random initialization of cluster etc.\ \n\t-q: No Welcome-Window will be shown\n\n");}int main (int argc, char *argv[]){ XFontStruct *fontstruct; char showwelcome = TRUE; char *display_name = NULL; char *window_title = WINDOW_BANNER; Display *Maindisplay; // Connection to X display //MainWindow *Main; char displayedhelp = FALSE; time_t timer; srand ((unsigned) time (&timer)); short inputcounter; for (inputcounter = 1; inputcounter < argc; inputcounter++) { if ((!strcmp (argv[inputcounter], "-help")) || (!strcmp (argv[inputcounter], "-h"))) { usage (); exit (1); } } if ((Maindisplay = XOpenDisplay (display_name)) == NULL) { printf ("%s: can't open display named %s\n", argv[0], XDisplayName (display_name)); exit (1); } initcolors (Maindisplay); initcursors (Maindisplay); Windowcontext = XUniqueContext (); char *font = DEFAULT_FONT; if ((fontstruct = XLoadQueryFont (Maindisplay, font)) == NULL) printf ("%s: display %s cannot load font %s\n", "abc", DisplayString (Maindisplay), font); XGCValues gcv; gcv.font = (fontstruct)->fid; gcv.foreground = blackpix; gcv.background = whitepix; GC gc = XCreateGC (Maindisplay, DefaultRootWindow (Maindisplay), (GCFont | GCForeground | GCBackground), &gcv); XSetLineAttributes (Maindisplay, gc, 1, LineSolid, CapProjecting, JoinMiter); Mainwindow = new MainWindow (Maindisplay, gc, fontstruct, 200, 150, 500, 300, window_title); for (inputcounter = 1; inputcounter < argc; inputcounter++) { if (!strcmp (argv[inputcounter], "-input")) { Mainwindow->Action (MAIN_CREATEINPUT_OK, (int) argv[++inputcounter]); } else if (!strcmp (argv[inputcounter], "-rule")) { Mainwindow->Action (MAIN_LOADRULE_OK, (int) argv[++inputcounter]); } else if (!strcmp (argv[inputcounter], "-class")) { Mainwindow->Action (MAIN_LOADCLASSIFY_OK, (int) argv[++inputcounter]); } else if (!strcmp (argv[inputcounter], "-cluster")) { Mainwindow->Action (MAIN_LOADCLUSTER_OK, (int) argv[++inputcounter]); } else if (!strcmp (argv[inputcounter], "-q")) { showwelcome = FALSE; } else if (!strcmp (argv[inputcounter], "-randoff")) { srand ((unsigned) 1); } else { usage (); exit (1); } } if (showwelcome) { Welcome *welcome = new Welcome (Maindisplay, gc, Mainwindow, fontstruct, MAIN_MAPME_ACTION); welcome->MapMe (); } else { Mainwindow->MapMe (); } Mainwindow->HandleEventqueue (); // Close connection to display and exit. Uninitcursors (Maindisplay); XFreeGC (Maindisplay, gc); XUnloadFont (Maindisplay, fontstruct->fid); XCloseDisplay (Maindisplay); return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -