[TextEditor-mcc] Re: How can take not marked blocks (useful for sintax highlight)

  • From: "Gianfranco \"ShInKurO\" Gignina" <sh1nkur0@xxxxxxxxx>
  • To: texteditor_mcc@xxxxxxxxxxxxx
  • Date: Mon, 11 May 2009 19:43:55 +0200

Il 11-Mag-2009, Gianfranco "ShInKurO" Gignina scrisse:


> here diff file :)

It miss of new setBlock.c file... attached in this mail

-- 
Bye, 
Gianfranco "ShInKurO" Gignina

http://shinkuro.amiga.it
#include <string.h>

#include <proto/utility.h>

#include "private.h"

ULONG OM_SetBlock(struct MUIP_TextEditor_SetBlock *msg, struct InstData *data)
{
  struct marking newblock;
 
  ENTER();

//D(DBF_STARTUP, "SetBlock\n");
  {//identify block
    if (msg->starty <= (ULONG)data->totallines)
      newblock.startline = LineNode(msg->starty+1, data);

    if (msg->startx <= (newblock.startline)->line.Length)
      newblock.startx = msg->startx;

    if (msg->stopx < (newblock.startline)->line.Length)
      newblock.stopx = msg->stopx;
    else if (msg->stopx == (newblock.startline)->line.Length)
      newblock.stopx = msg->stopx-1;

    if (msg->starty <= (ULONG)data->totallines)
      newblock.stopline = LineNode(msg->stopy+1, data);
  }

//D(DBF_STARTUP, "(newblock.startline)->line.Length=%ld\n", 
(newblock.startline)->line.Length);
//D(DBF_STARTUP, "MSG : startx=%ld, stopx=%ld, starty=%ld, stopy=%ld 
operation=%ld, flag=%ld\n", 
msg->startx,msg->stopx,msg->starty,msg->stopy,msg->operation,msg->flag);
//D(DBF_STARTUP, "NBK : startx=%ld, stopx=%ld, starty=%ld, stopy=%ld 
operation=%ld, flag=%ld\n", 
newblock.startx,newblock.stopx,(LineNr(newblock.startline, data)-1), 
(LineNr(newblock.stopline, data)-1),msg->operation,msg->flag);

  if(msg->operation & MUIF_TextEditor_SetBlock_Color)
  {
//D(DBF_STARTUP, "SetBlock: color %ld\n", msg->flag);
     newblock.enabled=TRUE;

     AddColor(&newblock, (UWORD)msg->flag, data);

     newblock.enabled=FALSE;
  }
  else
  {  
    if(msg->operation & MUIF_TextEditor_SetBlock_StyleBold)
    {
//D(DBF_STARTUP, "SetBlock: StyleBold %ld\n", msg->flag);
      AddStyle(&newblock, BOLD, msg->flag, data);
    }

    if(msg->operation & MUIF_TextEditor_SetBlock_StyleItalic)
    {
//D(DBF_STARTUP, "SetBlock: StyleItalic %ld\n", msg->flag);
      AddStyle(&newblock, ITALIC, msg->flag, data);
  }

    if(msg->operation & MUIF_TextEditor_SetBlock_StyleUnderline)
    {
//D(DBF_STARTUP, "SetBlock: StyleUnderline %ld\n", msg->flag);
      AddStyle(&newblock, UNDERLINE, msg->flag, data);
    }
  } 


  RETURN(TRUE);
  return TRUE;
}

Other related posts: