home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / workbench / stickit2 / source.lha / source / notes.c < prev    next >
C/C++ Source or Header  |  1995-01-09  |  16KB  |  736 lines

  1. /**********************************************
  2.  **************    notes.c   ******************
  3.  **********************************************/
  4.  
  5. #define INTUI_V36_NAMES_ONLY
  6.  
  7. #include <intuition/intuition.h>
  8. #include <exec/exec.h>
  9. #include <intuition/gadgetclass.h>
  10.  
  11. #include <clib/intuition_protos.h>
  12. #include <clib/graphics_protos.h>
  13. #include <clib/exec_protos.h>
  14. #include <clib/diskfont_protos.h>
  15. #include <clib/gadtools_protos.h>
  16.  
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20.  
  21. #include "stickit2.h"
  22.  
  23. #include "consts.h"
  24. #include "structs.h"
  25. #include "proto.h"
  26.  
  27. #ifndef GTMN_NewLookMenus
  28. #define GTMN_NewLookMenus    GT_TagBase+67
  29. #endif
  30.  
  31. extern prj_p prj;
  32.  
  33. extern struct NewMenu noteMenuNewMenu[];
  34.  
  35. #ifdef _DCC
  36. extern __chip UWORD WaitPointer[];
  37. #else
  38. extern UWORD __chip WaitPointer[];
  39. #endif
  40.  
  41. /*
  42. Function : note_p note_create(int note_position)
  43. Purpose : Allocates the memory needed for a note, sets all the values to the
  44.     default. Returns a pointer to the new note.
  45. */
  46.  
  47. note_p note_create(int note_position)
  48. {
  49.     struct Gadget gad_resize = {
  50.         NULL,
  51.         -7,-7,7,7,
  52.         GFLG_GADGHNONE | GFLG_GADGIMAGE | GFLG_RELRIGHT |
  53. GFLG_RELBOTTOM,
  54.         GACT_IMMEDIATE,
  55.         GTYP_SIZING,
  56.         NULL,NULL,NULL,NULL,NULL,
  57.         0};
  58.  
  59.     note_p new_note;
  60.  
  61.     /* Sort out the storing of the note pointer */
  62.  
  63.     new_note = (note_p)malloc(sizeof(struct note));
  64.  
  65.     if (!new_note)
  66.         error("Can't allocate new note",ERR_MALLOC,__LINE__,__FILE__);
  67.  
  68.     /* Set up defaults */
  69.  
  70.     new_note->win = NULL;
  71.     new_note->font = NULL;
  72.     new_note->visualinfo = NULL;
  73.     new_note->menustrip = NULL;
  74.  
  75.     strncpy(new_note->fontname,prj->prefs.notefont,STRLEN_FONTNAME);
  76.  
  77.     new_note->textattr.ta_Name = new_note->fontname;
  78.     new_note->textattr.ta_YSize = prj->prefs.textattr.ta_YSize;
  79.     new_note->textattr.ta_Style = prj->prefs.textattr.ta_Style;
  80.     new_note->textattr.ta_Flags = prj->prefs.textattr.ta_Flags;
  81.  
  82.     build_fontstring(new_note);
  83.  
  84.     new_note->topedge = DEFAULT_TOPEDGE;
  85.     new_note->leftedge = DEFAULT_LEFTEDGE;
  86.     new_note->width = prj->prefs.notewidth;
  87.     new_note->height = prj->prefs.noteheight;
  88.  
  89.     new_note->backcolour = prj->prefs.backcolour;
  90.     new_note->textcolour = prj->prefs.textcolour;
  91.     new_note->caratcolour = prj->prefs.caratcolour;
  92.  
  93.     new_note->title[0] = '\0';
  94.     strcpy(new_note->text,"Empty");
  95.     strcpy(new_note->pubscreen,prj->prefs.pubscreen);
  96.  
  97.     /* Copy gadget into note's gadget */
  98.  
  99.     new_note->gad = gad_resize;
  100.  
  101.     /* Add to note array */
  102.  
  103.     prj->notes[note_position] = new_note;
  104.  
  105.     /* Make an entry in the linked list */
  106.  
  107.     new_note->node.ln_Name = new_note->text;
  108.     new_note->node.ln_Type = NT_STICKIT2;
  109.     new_note->node.ln_Pri = - (BYTE)note_position;
  110.  
  111.     /* Clear the blocking requester */
  112.  
  113.     InitRequester(&new_note->blockreq);
  114.  
  115.     /* If commodities window is open, detach the list before altering it */
  116.  
  117.     if (commod)
  118.         GT_SetGadgetAttrs(commodGadgets[commod_listview],commod,NULL,
  119. GTLV_Labels,~0,TAG_END);
  120.  
  121.     Enqueue(&prj->commodlist,&new_note->node);
  122.  
  123.     if (commod)
  124.         GT_SetGadgetAttrs(commodGadgets[commod_listview],commod,NULL,
  125. GTLV_Labels,&prj->commodlist,TAG_END);
  126.  
  127.     return(new_note);
  128. }
  129.  
  130. /*
  131. Function : void note_open(note_p curr_note)
  132. Purpose : Given a note will open the window and draw the text.
  133. */
  134.  
  135. void note_open(note_p curr_note)
  136. {
  137.     struct RastPort *curr_rport;
  138.     struct Window *curr_win;
  139.  
  140.     /* If already open, bring to front */
  141.  
  142.     if (curr_note->win) {
  143.         WindowToFront(curr_note->win);
  144.         return;
  145.     }
  146.  
  147.     curr_note->win = OpenWindowTags(NULL,
  148.         WA_Left,curr_note->leftedge,
  149.         WA_Top,curr_note->topedge,
  150.         WA_Width,curr_note->width,
  151.         WA_Height,curr_note->height,
  152.         WA_MinWidth,DEFAULT_MINWIDTH,
  153.         WA_MaxWidth,DEFAULT_MAXWIDTH,
  154.         WA_MinHeight,DEFAULT_MINHEIGHT,
  155.         WA_MaxHeight,DEFAULT_MAXHEIGHT,
  156.         WA_Gadgets,&curr_note->gad,
  157.         WA_Flags,WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET |
  158. WFLG_SIMPLE_REFRESH,
  159.         WA_IDCMP,NULL,
  160.         WA_Title,curr_note->title,
  161.         WA_ScreenTitle,"StickIt2 ©1994 Andy Dean",
  162.         WA_PubScreenName,curr_note->pubscreen,
  163.         WA_PubScreenFallBack,TRUE,
  164.         WA_Dummy+0x30, TRUE, /* NewLookMenus */
  165.         TAG_END);
  166.  
  167.     if (!curr_note->win)
  168.         error("Can't open note",ERR_OPENNOTE,__LINE__,__FILE__);
  169.  
  170.     curr_win = curr_note->win;
  171.  
  172.     /* Set up menus */
  173.  
  174.     curr_note->visualinfo = GetVisualInfo(curr_win->WScreen,TAG_END);
  175.  
  176.     if (curr_note->visualinfo) {
  177.         curr_note->menustrip = CreateMenus(noteMenuNewMenu,TAG_END);
  178.  
  179.         if (curr_note->menustrip) {
  180.             if (LayoutMenus(curr_note->menustrip,
  181. curr_note->visualinfo,GTMN_NewLookMenus,TRUE,TAG_END))
  182.                 SetMenuStrip(curr_win,curr_note->menustrip);
  183.         }
  184.     }
  185.  
  186.     /* Set up some easy references */
  187.  
  188.     curr_rport = curr_note->win->RPort;
  189.  
  190.     /* Connect window to message port */
  191.  
  192.     curr_note->win->UserPort = prj->main_msg_port;
  193.  
  194.     ModifyIDCMP(curr_note->win,IDCMP_REFRESHWINDOW|IDCMP_CLOSEWINDOW|
  195. IDCMP_NEWSIZE|IDCMP_INACTIVEWINDOW|IDCMP_MOUSEBUTTONS|IDCMP_VANILLAKEY|
  196. IDCMP_RAWKEY|IDCMP_CHANGEWINDOW|IDCMP_MENUPICK);
  197.  
  198.     /* Set font, if different than the system default */
  199.  
  200.     if ((!curr_note->font) && (curr_note->fontname[0] != '\0'))
  201.         curr_note->font = OpenDiskFont(&curr_note->textattr);
  202.  
  203.     /* Add any font styles */
  204.  
  205.     if (curr_note->font) {
  206.         SetFont(curr_note->win->RPort,curr_note->font);
  207.         SetSoftStyle(curr_rport,curr_note->textattr.ta_Style ^
  208. curr_note->font->tf_Style,(FSF_BOLD | FSF_UNDERLINED | FSF_ITALIC));
  209.     }
  210.     else    /* Cancel font name */
  211.         curr_note->fontname[0] = '\0';
  212.  
  213.     /* No carat */
  214.  
  215.     curr_note->carat.text = NULL;
  216.  
  217.     curr_note->carat.xpos = curr_note->carat.ypos = 0;
  218.     curr_note->carat.oldxpos = curr_note->carat.oldypos = 0;
  219. }
  220.  
  221. /*
  222. Function : void note_close(note_p curr_note,bool_e kill)
  223. Purpose : Closes window. Copies last position and size of window. If kill
  224.     == FALSE, it doesn't dellocate the gadget memory or close the font,
  225.     as the window may be opened up again sometime later. If kill == TRUE
  226.     then all resources are deallocated. The memory for the note itself
  227.     is also dellocated if kill == TRUE.
  228. */
  229.  
  230. void note_close(note_p curr_note,bool_e kill)
  231. {
  232.     /* If already closed, return */
  233.  
  234.     if (curr_note->win) {
  235.  
  236.         /* Store window info */
  237.  
  238.         curr_note->leftedge = curr_note->win->LeftEdge;
  239.         curr_note->topedge = curr_note->win->TopEdge;
  240.         curr_note->width = curr_note->win->Width;
  241.         curr_note->height = curr_note->win->Height;
  242.  
  243.         /* Handle menu stuff */
  244.  
  245.         if (curr_note->menustrip) {
  246.             ClearMenuStrip(curr_note->win);
  247.  
  248.         FreeMenus(curr_note->menustrip);
  249.         }
  250.  
  251.         if (curr_note->visualinfo)
  252.             FreeVisualInfo(curr_note->visualinfo);
  253.  
  254.         /* Actually close the window */
  255.  
  256.         andysCloseWindowSafely(curr_note->win);
  257.         curr_note->win = NULL;
  258.     }
  259.  
  260.     if (kill) {
  261.         if (curr_note->font) {
  262.             CloseFont(curr_note->font);
  263.             curr_note->font = NULL;
  264.         }
  265.  
  266.         /* If the listview is up, disconnect it and remove the node */
  267.  
  268.         if (commod) {
  269.             GT_SetGadgetAttrs(commodGadgets[commod_listview],
  270. commod,NULL,GTLV_Labels,~0,TAG_END);
  271.  
  272.             Remove(&curr_note->node);
  273.  
  274.             GT_SetGadgetAttrs(commodGadgets[commod_listview],
  275. commod,NULL,GTLV_Labels,&prj->commodlist,TAG_END);
  276.         }
  277.  
  278.         /* Free the memory */
  279.  
  280.         free(curr_note);
  281.     }
  282. }
  283.  
  284. /*
  285. Function : void note_refresh(note_p curr_note)
  286. Purpose : Redraws the background and the text in the note.
  287. */
  288.  
  289. void note_refresh(note_p curr_note)
  290. {
  291.     struct Window *curr_win;
  292.     struct RastPort *curr_rport;
  293.     struct TextExtent textextent_result;
  294.  
  295.     char *text_ptr;
  296.  
  297.     ULONG remaininglength;
  298.     LONG textbaseline,topoffset;
  299.     LONG textfit;
  300.  
  301.     int l;
  302.  
  303.     /* Set up some easy references */
  304.  
  305.     curr_win = curr_note->win;
  306.     curr_rport = curr_win->RPort;
  307.  
  308.     textbaseline = curr_rport->TxBaseline + NO_INTERLINE_PIXELS;
  309.     topoffset = curr_win->WScreen->BarHeight + 1;
  310.  
  311.     /* Draw backdrop */
  312.  
  313.     SetDrMd(curr_rport,JAM1);
  314.     SetAPen(curr_rport,curr_note->backcolour);
  315.     RectFill(curr_rport,(LONG)curr_win->BorderLeft,
  316. (LONG)curr_win->BorderTop,curr_win->Width - (curr_win->BorderRight + 1),
  317. curr_win->Height - (curr_win->BorderBottom + 1));
  318.  
  319.     /* Set drawing mode */
  320.  
  321.     SetAPen(curr_rport,curr_note->textcolour);
  322.     SetBPen(curr_rport,curr_note->backcolour);
  323.  
  324.     /* Set up the text pointer */
  325.  
  326.     text_ptr = curr_note->text;
  327.  
  328.     /* Move to position */
  329.  
  330.     Move(curr_rport,(LONG)curr_win->BorderLeft,
  331. topoffset + textbaseline);
  332.  
  333.     while(strlen(text_ptr)) {
  334.  
  335.         /* Have we reached the bottom ? */
  336.  
  337.         if ((curr_rport->cp_y + (curr_rport->TxHeight - textbaseline))>
  338. (curr_win->Height - (curr_win->BorderBottom + 2)))
  339.             break;
  340.  
  341.         /* Remove any space */
  342.  
  343.         for (l = 0; (text_ptr[l] == ' ') &&(l < strlen(text_ptr)); l++);
  344.  
  345.         text_ptr += l;
  346.  
  347.         /* How much text will fit on ? */
  348.  
  349.         textfit = TextFit(curr_rport,text_ptr,strlen(text_ptr),
  350. &textextent_result,NULL,1,(LONG)curr_win->Width -
  351. (curr_rport->cp_x + curr_win->BorderLeft + curr_win->BorderRight + CARAT_WIDTH),
  352. curr_rport->TxHeight + 1);
  353.  
  354.         /* If no text will be printed, try next line */
  355.  
  356.         if (textfit == 0) {
  357.             Move(curr_rport,curr_win->BorderLeft,
  358. curr_rport->cp_y + curr_rport->TxHeight + NO_INTERLINE_PIXELS);
  359.             continue;
  360.         }
  361.  
  362.         /* Will I print all the remainining text ? */
  363.  
  364.         remaininglength = strlen(text_ptr);
  365.  
  366.         if (textfit != remaininglength) {
  367.             for (l = textfit;((l > 0) &&(text_ptr[l] != ' ')); l--);
  368.  
  369.             /* If we can successfully wrap it */
  370.  
  371.             if (l != 0)
  372.                 textfit = l + 1;
  373.         }
  374.  
  375.         /* textfit now holds the number of characters to be printed */
  376.  
  377.         SetAPen(curr_rport,curr_note->textcolour);
  378.         Text(curr_rport,text_ptr,textfit);
  379.  
  380.         /* Next line */
  381.  
  382.         Move(curr_rport,curr_win->BorderLeft,
  383. curr_rport->cp_y +curr_rport->TxHeight + NO_INTERLINE_PIXELS);
  384.  
  385.         /* If we've finished */
  386.  
  387.         if (textfit == remaininglength)
  388.             break;
  389.  
  390.         /* Else, set up next line pointer */
  391.  
  392.         text_ptr += textfit;
  393.     }
  394.  
  395.     /* If there was a carat in the window, redraw it. Clear old one first */
  396.  
  397.     curr_note->carat.oldxpos = curr_note->carat.oldypos = 0;
  398.     carat_draw(curr_note);
  399. }
  400.  
  401. /*
  402. Function : BOOL note_event(struct IntuiMessage *curr_msg)
  403. Purpose : Handles any events related to the notes on the screen.
  404. */
  405.  
  406. BOOL note_event(struct IntuiMessage *curr_msg)
  407. {
  408.     note_p curr_note;
  409.  
  410.     char *temp_carat;
  411.  
  412.     int notepos;
  413.  
  414.     curr_note = note_from_window(curr_msg->IDCMPWindow);
  415.  
  416.     /* If stray message from closed window */
  417.  
  418.     if (!curr_note)
  419.         return(FALSE);
  420.  
  421.     switch(curr_msg->Class) {
  422.         case IDCMP_MENUPICK:
  423.             note_menuevent(curr_note,curr_msg);
  424.             break;
  425.         case IDCMP_MOUSEBUTTONS:
  426.             switch(curr_msg->Code) {
  427.                 case SELECTDOWN:
  428.                     /* Select in listview if open */
  429.                     if (commod) {
  430.                         notepos = positionfromnote(
  431. curr_note);
  432.                         if (notepos != NOT_IN_ARRAY)
  433.                             commodlistview(
  434. notepos,0,0);
  435.                         GT_SetGadgetAttrs(
  436. commodGadgets[commod_listview],commod,NULL,GTLV_Selected,notepos,TAG_END);
  437.                     }
  438.  
  439.                     /* Where's carat ? */
  440.                     carat_from_coords(curr_note,
  441. curr_msg->MouseX,curr_msg->MouseY);
  442.                     break;
  443.                 default:
  444.                     break;
  445.             }
  446.             break;
  447.         case IDCMP_REFRESHWINDOW:
  448.             BeginRefresh(curr_note->win);
  449.             note_refresh(curr_note);
  450.             EndRefresh(curr_note->win,TRUE);
  451.             break;
  452.         case IDCMP_NEWSIZE:
  453.             /* Store window info */
  454.  
  455.             curr_note->leftedge = curr_note->win->LeftEdge;
  456.             curr_note->topedge = curr_note->win->TopEdge;
  457.             curr_note->width = curr_note->win->Width;
  458.             curr_note->height = curr_note->win->Height;
  459.  
  460.             /* Store carat to place back */
  461.  
  462.             temp_carat = curr_note->carat.text;
  463.  
  464.             /* Remove carat */
  465.  
  466.             carat_clear(curr_note);
  467.  
  468.             note_refresh(curr_note);
  469.  
  470.             /* Place carat back */
  471.  
  472.             if (temp_carat) {
  473.                 curr_note->carat.text = temp_carat;
  474.                 carat_from_ptr(curr_note,PTRCHANGE_CURSOR);
  475.             }
  476.  
  477.             break;
  478.         case IDCMP_CHANGEWINDOW:
  479.             /* Store window info */
  480.  
  481.             curr_note->leftedge = curr_note->win->LeftEdge;
  482.             curr_note->topedge = curr_note->win->TopEdge;
  483.             curr_note->width = curr_note->win->Width;
  484.             curr_note->height = curr_note->win->Height;
  485.  
  486.             break;
  487.         case IDCMP_INACTIVEWINDOW:
  488.             /* Remove carat */
  489.  
  490.             carat_clear(curr_note);
  491.  
  492.             /* If commodities window open, refresh list */
  493.  
  494.             if (commod) {
  495.                 GT_SetGadgetAttrs(
  496. commodGadgets[commod_listview],commod,NULL,GTLV_Labels,~0,TAG_END);
  497.                 GT_SetGadgetAttrs(
  498. commodGadgets[commod_listview],commod,NULL,GTLV_Labels,&prj->commodlist,TAG_END);
  499.             }
  500.  
  501.             break;
  502.         case IDCMP_CLOSEWINDOW:
  503.             note_close(curr_note,FALSE);
  504.             break;
  505.         case IDCMP_VANILLAKEY:
  506.             /* Is there a carat in the window ? */
  507.  
  508.             if (curr_note->carat.text)
  509.                 carat_vanillakey(curr_note,curr_msg);
  510.  
  511.             break;
  512.         case IDCMP_RAWKEY:
  513.             /* Is there a carat in the window ? */
  514.  
  515.             if (curr_note->carat.text)
  516.                 carat_rawkey(curr_note,curr_msg);
  517.  
  518.             break;
  519.         default:
  520.             break;
  521.     }
  522.  
  523.     return(FALSE);
  524. }
  525.  
  526. /*
  527. Function : note_p note_from_window(struct Window *curr_win)
  528. Purpose : Given a window pointer, searches the array of notes and if any
  529.     note has that window pointer, returns a pointer to that note. Returns
  530.     NULL if no valid window is found (ie stray message from closed
  531.     window).
  532. */
  533. note_p note_from_window(struct Window *curr_win)
  534. {
  535.     int l;
  536.  
  537.     for (l = 0; l < NO_NOTES; l++) {
  538.         if (!prj->notes[l])
  539.             continue;
  540.  
  541.         if (prj->notes[l]->win == curr_win)
  542.             return(prj->notes[l]);
  543.     }
  544.  
  545.     /* Couldn't find the window */
  546.  
  547.     return(NULL);
  548. }
  549.  
  550. /*
  551. Function : void note_block(note_p curr_note)
  552. Purpose : Blocks the current note to mouse input and puts up a wait pointer.
  553. */
  554.  
  555. void note_block(note_p curr_note)
  556. {
  557.     /* Only do it if window open */
  558.  
  559.     if (!curr_note->win)
  560.         return;
  561.  
  562.     InitRequester(&curr_note->blockreq);
  563.  
  564.     if (Request(&curr_note->blockreq,curr_note->win))
  565.         SetPointer(curr_note->win,WaitPointer,16,16,-6,0);
  566. }
  567.  
  568. /*
  569. Function : void note_blockclear(note_p curr_note)
  570. Purpose : Clears the current note for mouse input and returns to the normal
  571.     pointer.
  572. */
  573.  
  574. void note_blockclear(note_p curr_note)
  575. {
  576.     /* Only do it if window open */
  577.  
  578.     if (!curr_note->win)
  579.         return;
  580.  
  581.     ClearPointer(curr_note->win);
  582.     EndRequest(&curr_note->blockreq,curr_note->win);
  583. }
  584.  
  585. /*
  586. Function : void note_blockall()
  587. Purpose : Blocks all the open notes.
  588. */
  589.  
  590. void note_blockall()
  591. {
  592.     note_p curr_note;
  593.  
  594.     int l;
  595.  
  596.     for (l = 0; l < NO_NOTES; l++) {
  597.         if (prj->notes[l]) {
  598.             curr_note = prj->notes[l];
  599.  
  600.             if (curr_note->win)
  601.                 note_block(curr_note);
  602.         }
  603.     }
  604. }
  605.  
  606. /*
  607. Function : void note_blockclearall()
  608. Purpose : Unblocks all the open notes.
  609. */
  610.  
  611. void note_blockclearall()
  612. {
  613.     note_p curr_note;
  614.  
  615.     int l;
  616.  
  617.     for (l = 0; l < NO_NOTES; l++) {
  618.         if (prj->notes[l]) {
  619.             curr_note = prj->notes[l];
  620.  
  621.             if (curr_note->win)
  622.                 note_blockclear(curr_note);
  623.         }
  624.     }
  625. }
  626.  
  627. /*
  628. Function : void note_menuevent(note_p curr_note,struct IntuiMessage *curr_msg)
  629. Purpose : Handles menu events from a note.
  630. */
  631.  
  632. void note_menuevent(note_p curr_note,struct IntuiMessage *curr_msg)
  633. {
  634.     struct MenuItem *menuitem;
  635.  
  636.     char *temp_carat = NULL;
  637.  
  638.     UWORD menunumber;
  639.     UWORD menunum;
  640.     UWORD itemnumber;
  641.     UWORD subnumber;
  642.  
  643.     BOOL done = FALSE;
  644.  
  645.     menunumber = curr_msg->Code;
  646.  
  647.     while ((menunumber != MENUNULL) && (!done)) {
  648.         menuitem = ItemAddress(curr_note->menustrip,menunumber);
  649.         menunum = MENUNUM(menunumber);
  650.         itemnumber = ITEMNUM(menunumber);
  651.         subnumber = SUBNUM(menunumber);
  652.  
  653.         switch (menunum) {
  654.             case NOMENU:
  655.                 break;
  656.  
  657.             case noteMenu_project:
  658.                 switch (itemnumber) {
  659.                     case NOITEM:
  660.                         break;
  661.                     case noteMenu_project_save:
  662.                         file_writenotes();
  663.                         break;
  664.                     case noteMenu_project_panel:
  665.                         openwindowcommod();
  666.                         break;
  667.                     default:
  668.                         break;
  669.                 }
  670.                 break;
  671.             case noteMenu_edit:
  672.                 switch(itemnumber) {
  673.                     case NOITEM:
  674.                         break;
  675.                     case noteMenu_edit_copy:
  676.                         notemenu_editcopy(curr_note);
  677.                         break;
  678.                     case noteMenu_edit_cut:
  679.                         if (notemenu_editcopy(
  680. curr_note)) {
  681.                             temp_carat =
  682. curr_note->carat.text;
  683.                             if (temp_carat)
  684.                                 carat_clear(curr_note);
  685.  
  686.                             curr_note->text[0] =
  687. '\0';
  688.                             note_refresh(curr_note);
  689.  
  690.                             if (temp_carat) {
  691.                                 curr_note->carat.text =
  692. curr_note->text;
  693.                                 carat_from_ptr(
  694. curr_note,PTRCHANGE_CURSOR);
  695.                             }
  696.                         }
  697.  
  698.                         prj->projectchanged = TRUE;
  699.  
  700.                         break;
  701.                     case noteMenu_edit_delete:
  702.                         temp_carat = curr_note->carat.text;
  703.  
  704.                         if (temp_carat)
  705.                             carat_clear(curr_note);
  706.  
  707.                         curr_note->text[0] = '\0';
  708.  
  709.                         note_refresh(curr_note);
  710.  
  711.                         if (temp_carat) {
  712.                             curr_note->carat.text =
  713. curr_note->text;
  714.                             carat_from_ptr(
  715. curr_note,PTRCHANGE_CURSOR);
  716.                         }
  717.  
  718.                         prj->projectchanged = TRUE;
  719.  
  720.                         break;
  721.                     case noteMenu_edit_paste:
  722.                         notemenu_editpaste(curr_note);
  723.                         break;
  724.                     default:
  725.                         break;
  726.                 }
  727.                 break;
  728.             default:
  729.                 break;
  730.         }
  731.  
  732.     menunumber = menuitem->NextSelect;
  733.     }
  734. }
  735.  
  736.