Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CheckAlloc(void *);
- /* Check if an allocation completed successfully */
- void DoNothing(void *);
- /* Just an ugly wordaround to remove some warnings */
- void InitGraph(void *);
- /* Function to init graphics driver */
- void ClearGraph(void *);
- /* Function to clear screen */
- struct _Char
- /* Struct of a char */
- {
- struct _Char *next;
- /* pointer to left or right one */
- char ch;
- };
- typedef struct _Char Char;
- struct _Row
- /* Struct of a row */
- {
- struct _Row *next;
- /* pointer to up or down row */
- Char *ch;
- };
- typedef struct _Row Row;
- struct _MouseState
- /* Struct to save a mouse state */
- {
- int x, y;
- /* Saving where the mouse is */
- int key;
- /* Saving if a button is pressed (0: None, 1: Left, 2: Right) */
- int release;
- /* Saving if a button is released (0: None, 1: Left, 2: Right) */
- };
- typedef struct _MouseState MouseState;
- struct _KeyMap
- /* Struct to save the alphabets' keys */
- {
- int chs[26];
- };
- typedef struct _KeyMap KeyMap;
- struct _NumMap
- /* Struct to save the numbers' keys */
- {
- int num[10];
- };
- typedef struct _NumMap NumMap;
- struct _State
- /* Main state structure */
- {
- MouseState mouse;
- /* Saving the current mouse state */
- KeyboardState keyboard;
- /* Saving the current keyboard state */
- char isexit;
- /* Saving the main exit flag */
- FormMenu *menu;
- /* Saving pointer to form menus */
- Menu *contextmenu;
- /* Saving pointer to the context menu */
- int iscontextmenu, cmmousex, cmmousey;
- /* Saving context menu related states */
- KeyBinding *keybinding;
- /* Saving pointer to all key binding definitions */
- Event *redraw;
- /* Event of redrawing */
- char isclearmenu;
- /* Flag to save clear menu state */
- char iskeyboard;
- /* Flag to save if the menu is operating by mouse or by keyboard */
- int ischildwindow, childx1, childy1, childx2, childy2;
- /* Saving child window related properties */
- char dotted, highlight;
- /* The main text box related properties */
- char isdrag;
- /* Flag of dragging child window */
- char ischosen;
- /* Flag of drag-to-choose mode */
- int startrow, startchar, endrow, endchar;
- /* Chosen area flags (the head and the rear locations ) */
- char isedit, chinese, fullwidth, chipunc;
- /* Chinese-input related states */
- int editx1, edity1, editx2, edity2;
- /* Currently available edit area flags */
- long delaytime;
- /* True delay time for adjusting delay() */
- Row *filehead, *childhead, *childhead2;
- /* File head pointers to save the main text and child texts */
- Row *cutboard;
- /* Clipboard pointer */
- Char *searchstring;
- /* Search string pointer */
- char isreplace;
- /* Judging if in replacing mode */
- char *filename;
- /* Name of currently open file */
- int cursorx, cursory, iscursor;
- /* Location for the cursor */
- long cursortime;
- /* Time-stamp logged here */
- int pagemovecount, currentrow, currentcolumn, rowcount;
- /* Distance of current row */
- KeyMap map;
- NumMap nummap;
- /* Main key-mappings */
- FILE *hzkfile;
- /* Font file HZK16 */
- char page;
- char mousetype;
- char nothing;
- /* Some other flags */
- void *mousebuf;
- /* Buffer to save mouse-floating area contents */
- char ispinyin, pinyinpage, sheng, yun;
- /* Pinyin input method related temperate variables */
- Music curmusic;
- /* Current playing music */
- int isput,lastmsx,lastmsy;
- };
- typedef struct _State State;
- void FREEMEMRow(Row *row);
- /* Release all the memory that used by a row */
- void FREEMEMChar(Char *ch);
- /* Free link table struct Char */
- void Exit(void *n);
- /* Flag an exit event */
- void CalcDelay(void *n);
- /* Use biostime to adjust delay() */
- void Delay(void *n, long t);
- /* The fixed delay function */
- void MsgBox(void *n, char *title, char *message);
- /* Message Box function */
- void DrawOpenWindow(void *n);
- /* Draw "Open" window */
- void DrawSaveWindow(void *);
- /* Draw "Save" window */
- void DrawSaveAsWindow(void *);
- /* Draw "Save as" window */
- void DrawFindWindow(void *);
- /* Draw "Find" window */
- void DrawReplaceWindow(void *);
- /* Draw "Replace" window */
- void SwitchTextBox(void *n);
- /* Switch text box for replace window */
- void CloseChildWindow(void *);
- /* Close the child window */
- void CheckChildButton(void *);
- /* Check if clicked an button on child window */
- void MoveChildWindow(void *n);
- /* Check and move the child window */
- void CheckEnterSubmit(void *n);
- /* Check Enter key to submit the currently opened window */
- void SubmitButton(void *n);
- /* Submit key functions */
- void OpenButton(void *n);
- /* Check if the Open window button is clicked */
- void MsgBoxButton(void *n);
- /* Check if the Message Box button is clicked */
- void CancelButton(void *n);
- /* Cancel button is clicked */
- void Compile(void *n);
- /* Compile and run the currently open C code */
- struct _event
- {
- void (*func)(void *);
- struct _event *next;
- };
- typedef struct _event Event;
- void RegEvent(Event *e, void (*func)(void *));
- /* Register a new func as event */
- void DoEvent(Event *e, void *data);
- /* Do a event */
- void InitEvent(Event *e);
- /* Initialize a event */
- void FreeEvent(Event *e);
- /* Free memory of an event chain */
- struct _KeyboardState
- {
- int key;
- int modifier;
- };
- typedef struct _KeyboardState KeyboardState;
- struct _keybinding
- {
- KeyboardState key;
- Event *event;
- struct _keybinding *next;
- };
- typedef struct _keybinding KeyBinding;
- void CheckKeyboard(void *n);
- /* Read keyboard states and save it */
- void LoadKeyBinding(void *n);
- /* Load-time initialization for key bindings */
- void InitKeyBinding(KeyBinding *kb);
- /* Initialize a key binding struct */
- void AddKeyBinding(void *n, KeyboardState key, Event *event);
- /* Add a key binding with an event */
- KeyboardState KBState(int key, int modifier);
- /* Simply packaging a key binding into a KeyboardState struct */
- void CheckKeyBinding(void *n);
- /* Check if matches a key binding */
- void LoadKeyMap(void *n);
- /* Load A-Z Keymappings (Recorded manually by Felix Yan) */
- void CheckChar(void *n, int key, int shift, int chipunc, int fullwidth, char *punc);
- /* Check if a character should be inserted to text */
- void CharInput(void *n);
- /* Fetch & switch characters (Recorded manually by Felix Yan) */
- char Lowercase(char ch);
- /* Lowercase of a char */
- int NotNameChar(char ch);
- /* Judge if a char is a name char */
- int IsNumber(char ch);
- /* Judge if a char is a number */
- void OutTextxy(void *n, int x, int y, char *p, int color);
- /* Output a normal string that may include any character including Chinese */
- void OpenHZK(void *n);
- /* Open the HZK file on the program loading progress */
- void CloseHZK(void *n);
- /* Close the HZK file when closing program */
- struct _KeyboardState
- {
- int key;
- int modifier;
- };
- typedef struct _KeyboardState KeyboardState;
- struct _keybinding
- {
- KeyboardState key;
- Event *event;
- struct _keybinding *next;
- };
- typedef struct _keybinding KeyBinding;
- void CheckKeyboard(void *n);
- /* Read keyboard states and save it */
- void LoadKeyBinding(void *n);
- /* Load-time initialization for key bindings */
- void InitKeyBinding(KeyBinding *kb);
- /* Initialize a key binding struct */
- void AddKeyBinding(void *n, KeyboardState key, Event *event);
- /* Add a key binding with an event */
- KeyboardState KBState(int key, int modifier);
- /* Simply packaging a key binding into a KeyboardState struct */
- void CheckKeyBinding(void *n);
- /* Check if matches a key binding */
- void LoadKeyMap(void *n);
- /* Load A-Z Keymappings (Recorded manually by Felix Yan) */
- void CheckChar(void *n, int key, int shift, int chipunc, int fullwidth, char *punc);
- /* Check if a character should be inserted to text */
- void CharInput(void *n);
- /* Fetch & switch characters (Recorded manually by Felix Yan) */
- struct _Logo
- /* Struct of a part of the whole logo, saving some points that the
- * program will string them together with line. */
- {
- int n;
- /* Number of the points */
- int *x, *y;
- /* X,Y coordinates for every point */
- };
- typedef struct _Logo Logo;
- struct _Logos
- /* Struct of the whole logo, saving pointers to each part of the logo.*/
- {
- int n;
- /* Number of parts */
- Logo **logo;
- /* pointer to each logo */
- };
- typedef struct _Logos Logos;
- Logos *GetLogoXY(void);
- /* Function to read the logo from file and return a pointer to it. */
- void DrawLogo(void *);
- /* Draw out the Logo */
- struct _Menu
- {
- char *text;
- char enabled, moveover;
- struct _Menu *next;
- Event *func;
- };
- typedef struct _Menu Menu;
- struct _FormMenu
- {
- Menu *menu;
- char *text;
- char moveover, pressed;
- struct _FormMenu *next;
- };
- typedef struct _FormMenu FormMenu;
- void InitFormMenuItem(FormMenu *menu);
- /* Initialize a form menu item, give default values */
- void AddFormMenu(FormMenu *menu, char *title);
- /* Add an form menu item to an existing chain */
- void DrawFormMenu(void *null);
- /* Draw all the form menus */
- void IsMoveOverFormMenu(void *n);
- /* Judging if mouse is moving over a form menu */
- void DrawMoveOverFormMenu(void *n);
- /* Draw the highlight effect of moving-over form menu */
- void IsClickFormMenu(void *n);
- /* Judging if clicked an form menu */
- void DoubleOver(void *n);
- /* Only a workaround for form menus */
- void DrawClickFormMenu(void *n);
- /* Draw click effect for form menus */
- void InitMenuItem(Menu *menu);
- /* Menu item initialization */
- void AddMenu(Menu *menu, char enabled, char *title, Event *func);
- /* Add a menu item to an existing menu chain */
- void DrawMenu(void *n, Menu *menu, int x, int y);
- /* Draw a menu */
- void IsMoveOverMenu(void *n);
- /* Judging if moving over a menu item */
- void DrawMoveOverMenu(void *n);
- /* Draw if moving over a menu item */
- void ClearMenuMoveOver(void *n);
- /* Clear all move over states */
- Menu *GetUpMenu(FormMenu *formmenu, Menu *menu);
- /* Get the upper menu item */
- Menu *GetDownMenu(FormMenu *formmenu, Menu *menu);
- /* Get the down menu item */
- FormMenu *GetLeftFormMenu();
- /* Get left form menu item */
- FormMenu *GetRightFormMenu();
- /* Get right form menu item */
- FormMenu *FindPressedFormMenu(void *n);
- /* Find the currently pressed form menu */
- Menu *FindMoveOverMenu(void *n);
- /* Find the currently moving over menu item */
- void MenuUp(void *n);
- /* Menu up! */
- void MenuDown(void *n);
- /* Menu down! */
- void FormMenuLeft(void *n);
- /* Move left form menu */
- void FormMenuRight(void *n);
- /* Move right form menu */
- void AddMenuToFormMenu(Menu *menu, FormMenu *formmenu);
- /* Add a menu to a form menu */
- void OpenMenu(FormMenu *menu, int n);
- /* Open a form menu */
- void OpenMenu0(void *n);
- /* Open the first form menu */
- void OpenMenu1(void *n);
- /* Open the second form menu */
- void OpenMenu2(void *n);
- /* Open the third form menu */
- void OpenMenu3(void *n);
- /* Open the forth form menu */
- void OpenMenu4(void *n);
- /* Open the fifth form menu */
- void ChildTitleContextMenu(void *n);
- /* Context menu operations */
- int InitMouse();
- /* Initialize mouse */
- void ShowMouse(void *n, int x, int y);
- /* Show the windows-like mouse pointer */
- void HideMouse(void *n);
- /* Hide the windows-like mouse pointer */
- void GetMouseXY(int *x,int *y);
- /* Get current mouse position */
- void SetMouseXY(int x,int y);
- /* Move mouse to specific position */
- int GetPressInfo(int button);
- /* Get mouse pressing info */
- int GetReleaseInfo(int button);
- /* Get mouse release info */
- void SetXRange(int min,int max);
- /* Set mouse movable range along X axis */
- void SetYRange(int min,int max);
- /* Set mouse movable range along Y axis */
- void DrawMouse(int x,int y);
- /* Draw moving mouse pointer */
- void DrawMouseEdit(int x,int y);
- /* Draw editing mouse pointer */
- int PinRA(int x, int y, int x1, int y1, int x2, int y2);
- /* Judging if a pointer is in a rectangle */
- void LoadMouse(void *null);
- /* Loading default mouse properties */
- void RedrawMouse(void *n);
- /* Redraw the mouse pointer if needed */
- void MouseAway(void *n);
- /* Disable mouse pointer to avoid some bugs */
- void PlayMusic(void *n);
- /* Music daemon, called in everything time of mainloop */
- void StartupMusic(void *n);
- /* Play startup music */
- void LogoutMusic(void *n);
- /* Play logout music */
- void RandomMusic(void *n);
- /* Play a random music, except for startup music and logout music */
- enum _Music
- /* Enumerator of songs */
- {
- None,
- Startup,
- Logout,
- Laputa,
- Musicbox,
- Lovesale,
- Romeo,
- Joy,
- Minuet,
- Turkey,
- LoveIsBlue
- };
- typedef enum _Music Music;
- void IMSwitch(void *n);
- /* Input method switch (en <=> zh) */
- void PuncSwitch(void *n);
- /* Punctuation switch (en <=> zh) */
- void WidthSwitch(void *n);
- /* Width switch (fullwidth <=> halfwidth) */
- void CheckIMSwitch(void *n);
- /* Check if a switch should be made */
- void PinyinInput(void *n);
- /* Pinyin input function */
- void PinyinShow(void *n);
- /* Show candidate Chinese characters */
- void SaveSearchString(void *n);
- /* Saving current search string */
- void CmdSearch(void *n);
- /* Search button function */
- void DoSearch(void *n);
- /* Do a search to find the search string */
- void CmdReplace(void *n);
- /* Replace button function */
- struct _RGB
- /* Color struct! */
- {
- unsigned char b;
- /* BLUE */
- unsigned char g;
- /* GREEN */
- unsigned char r;
- /* RED */
- };
- typedef struct _RGB RGB;
- void DrawTextBox(int x1, int y1, int x2, int y2);
- /* Draw an text box similar to Win9x */
- void DrawButton(void *n, int x1, int y1, int x2, int y2, char *title);
- /* Draw a button on a specific place */
- void DrawWindow(void *n, int x1, int y1, int x2, int y2, char *title);
- /* Draw an interface similar to Win9x */
- void DrawStatusBox(void *n);
- /* Draw an status box similar to Win9x */
- void DrawMainTextBox(void *n);
- /* The main text box */
- void DrawMainWindow(void *n);
- /* Draw main window */
- void IsExit(void *n);
- /* Check whether an window should be closed */
- int RAvsRA(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
- /* If a RectAngle covers the other one */
- void SetColor(unsigned int n);
- /* Workaround for quick access to change the function */
- void FadingColor(void *null);
- /* Color fading while loading and unloading */
- void InitColor(void *null);
- /* Initialize all colors to black, so the fading could work later */
- void ChangeDotted(void *n);
- /* Change dotted mode */
- void ChangeHighlight(void *n);
- /* Change highlight mode */
- void CheckStatus(void *n);
- /* Check and display the status in the main status box */
- void ShowHelp(void *n);
- /* Show Help messages */
- void OpenFile(void *n, char *f);
- /* Open an file */
- void CleanUp(void *n);
- /* Both mouse and cursor workaround */
- void CheckCursor(void *n);
- /* Check the cursor to do the pageup and pagedown */
- void DrawCur(void *n);
- /*Draw a cursor in the txt*/
- void FlashCur(void *n);
- /*Move the cursor by keyboard*/
- void ClrCur(void *n);
- /*Clear the cursor at last position*/
- void CursorUp(void *n);
- /* Move cursor up*/
- void CursorDown(void *n);
- /* Move cursor down */
- void CursorLeft(void *n);
- /* Move cursor left */
- void CursorRight(void *n);
- /* Move cursor right */
- void GetCurPos(void *n);
- /* Get cursor position by row and column */
- void MousetoCursor(void *n);
- /* left click mouse and then move the cursor to the current position */
- int LeftHZ(void *n);
- /* there is a HZ on the left side of the cursor */
- int RightHZ(void *n);
- /* there is a HZ on the right side of the cursor */
- int UpHZ(void *n);
- /* judge the HZ above the cursor */
- int FindUpHZPosition(void *n);
- /* calculate the HZ positon in the front row */
- int DownHZ(void *n);
- /* there is a HZ on the top side of the cursor */
- int FindDownHZPosition(void *n);
- /* calculate the HZ positon in the next row */
- int MouseHZ(void *n);
- /* there is a HZ under the Mouse */
- int FindMouseHZPosition(void *n);
- /* calculate the HZ positon under the Mouse */
- void OutPutMain(void *n);
- void OutPutXY(void *n);
- /*put out a txt in a rectangle*/
- void PageDown(void *n);
- /* move page down by one row */
- void PageUp(void *n);
- /* move page up by one row */
- void BackSpace(void *n);
- /*del the NO.N char in Row M*/
- void Delete(void *n);
- /*del the NO.N + 1 char in Row M*/
- void HZInsert(void *n);
- /*insert the NO.N char in Row M*/
- void RowCount(void *n);
- /* Caculate the total row of the txt */
- void Insert(void *n,char *hz);
- /* Insert a hanzi in front of the cursor */
- void EnterKey(void *n);
- /* Add the function of pressing Enter Key */
- void InitChildhead(void *n);
- /* Init childhead 1 */
- void InitChildhead2(void *n);
- /* Init childhead 2 */
- void FreeChildhead(void *n);
- /* Free childhead 2*/
- void FreeChildhead2(void *n);
- /* Free childhead 2*/
- char *GetChildText(void *n);
- char *GetChildText2(void *n);
- /* Get child text */
- char LeftChar(void *n);
- /* Get the chat at the left sid of cursor */
- void ChosenArea(void *n);
- /* chose a string and color it BLUE */
- void Home(void *n);
- /* put the cursor in the first of the currentrow */
- void CtrlHome(void *n);
- /* put the cursor in the first of the firstrow */
- void End(void *n);
- /* put the cursor in the end of the currentrow */
- void CtrlEnd(void *n);
- /* put the cursor in the end of the currentrow */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement