Wx-Scintilla

 view release on metacpan or  search on metacpan

tools/perl_editor.pl  view on Meta::CPAN

        Wx::Scintilla::SCE_PL_REGEX         => $color1,
        Wx::Scintilla::SCE_PL_REGSUBST      => $color1,
        Wx::Scintilla::SCE_PL_LONGQUOTE     => $color1,
        Wx::Scintilla::SCE_PL_BACKTICKS     => $color1,
        Wx::Scintilla::SCE_PL_DATASECTION   => $color1,
        Wx::Scintilla::SCE_PL_HERE_DELIM    => $color1,
        Wx::Scintilla::SCE_PL_HERE_Q        => $color1,
        Wx::Scintilla::SCE_PL_HERE_QQ       => $color1,
        Wx::Scintilla::SCE_PL_HERE_QX       => $color1,
        Wx::Scintilla::SCE_PL_STRING_Q      => $color1,
        Wx::Scintilla::SCE_PL_STRING_QQ     => $color1,
        Wx::Scintilla::SCE_PL_STRING_QX     => $color1,
        Wx::Scintilla::SCE_PL_STRING_QR     => $color1,
        Wx::Scintilla::SCE_PL_STRING_QW     => $color1,
        Wx::Scintilla::SCE_PL_POD_VERB      => $color1,
        Wx::Scintilla::SCE_PL_SUB_PROTOTYPE => $color1,
        Wx::Scintilla::SCE_PL_FORMAT_IDENT  => $color1,
        Wx::Scintilla::SCE_PL_FORMAT        => $color1,
        Wx::Scintilla::SCE_PL_STRING_QQ     => $color1,
        Wx::Scintilla::SCE_PL_STRING_QX     => $color1,
        Wx::Scintilla::SCE_PL_STRING_QR     => $color1,
        Wx::Scintilla::SCE_PL_STRING_QW     => $color1,
        Wx::Scintilla::SCE_PL_POD_VERB      => $color1,
        Wx::Scintilla::SCE_PL_SUB_PROTOTYPE => $color1,
        Wx::Scintilla::SCE_PL_FORMAT_IDENT  => $color1,
        Wx::Scintilla::SCE_PL_FORMAT        => $color1,

        Wx::Scintilla::SCE_PL_STRING_VAR => $color2,
        Wx::Scintilla::SCE_PL_REGEX_VAR  => $color2,
        Wx::Scintilla::SCE_PL_REGSUBST_VAR => $color2,
        Wx::Scintilla::SCE_PL_BACKTICKS_VAR => $color2,
        Wx::Scintilla::SCE_PL_HERE_QQ_VAR => $color2,
        Wx::Scintilla::SCE_PL_HERE_QX_VAR => $color2,
        Wx::Scintilla::SCE_PL_STRING_QQ_VAR => $color2,
        Wx::Scintilla::SCE_PL_STRING_QX_VAR => $color2,
        Wx::Scintilla::SCE_PL_STRING_QR_VAR => $color2,
    );

    for my $style ( keys %styles ) {
        $self->StyleSetForeground( $style, $styles{$style} );
    }

    $self->StyleSetBold( Wx::Scintilla::SCE_PL_WORD, 1 );
    $self->StyleSetSpec( Wx::Scintilla::SCE_H_TAG, "fore:#0000ff" );

    # set the lexer to Perl 5
    $self->SetLexer(Wx::Scintilla::SCLEX_PERL);
    $self->SetStyleBits( $self->GetStyleBitsNeeded );

    my @keywords = qw(
      NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD
      BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept
      alarm and atan2 bind binmode bless caller chdir chmod chomp chop
      chown chr chroot close closedir cmp connect continue cos crypt
      dbmclose dbmopen defined delete die do dump each else elsif endgrent
      endhostent endnetent endprotoent endpwent endservent eof eq eval
      exec exists exit exp fcntl fileno flock for foreach fork format
      formline ge getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname
      gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername
      getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent
      getpwent getpwnam getpwuid getservbyname getservbyport getservent
      getsockname getsockopt glob gmtime goto grep gt hex if index
      int ioctl join keys kill last lc lcfirst le length link listen
      local localtime lock log lstat lt map mkdir msgctl msgget msgrcv
      msgsnd my ne next no not oct open opendir or ord our pack package
      pipe pop pos print printf prototype push quotemeta qu
      rand read readdir readline readlink readpipe recv redo
      ref rename require reset return reverse rewinddir rindex rmdir
      scalar seek seekdir select semctl semget semop send setgrent
      sethostent setnetent setpgrp setpriority setprotoent setpwent
      setservent setsockopt shift shmctl shmget shmread shmwrite shutdown
      sin sleep socket socketpair sort splice split sprintf sqrt srand
      stat study sub substr symlink syscall sysopen sysread sysseek
      system syswrite tell telldir tie tied time times truncate
      uc ucfirst umask undef unless unlink unpack unshift untie until
      use utime values vec wait waitpid wantarray warn while write
      xor given when default say state UNITCHECK
    );
    $self->SetKeyWords( 0, join( ' ', @keywords ) );

    my $filename = "$Bin/perl-test-interpolation.pl.txt";
    if ( open my $fh, "<", $filename ) {
        local $/ = undef;
        my $content = <$fh>;
        $self->SetText($content);
    }
    else {
        die "Cannot open $filename for reading\n";
    }
    $self->SetFocus;

    Wx::Event::EVT_STC_INDICATOR_CLICK(
        $self, $self,
        sub {
            print "EVT_STC_INDICATOR_CLICK triggered\n";
        }
    );

    Wx::Event::EVT_STC_INDICATOR_RELEASE(
        $self, $self,
        sub {
            print "EVT_STC_INDICATOR_RELEASE triggered\n";
        }
    );

    my $WARNING_STYLE = 126;
    my $ERROR_STYLE   = $WARNING_STYLE + 1;
    $self->StyleSetForeground( $WARNING_STYLE,
        Wx::Colour->new( 0xAF, 0x80, 0x00 ) );
    $self->StyleSetBackground( $WARNING_STYLE,
        Wx::Colour->new( 0xFF, 0xFF, 0xF0 ) );
    $self->StyleSetItalic( $WARNING_STYLE, 1 );
    $self->StyleSetForeground( $ERROR_STYLE,
        Wx::Colour->new( 0xAF, 0x00, 0x00 ) );
    $self->StyleSetBackground( $ERROR_STYLE,
        Wx::Colour->new( 0xFF, 0xF0, 0xF0 ) );
    $self->StyleSetItalic( $ERROR_STYLE, 1 );

    $self->AnnotationClearAll;
    my $annoText1 = "Warning\n";
    my $annoText2 = "Error!";



( run in 1.920 second using v1.01-cache-2.11-cpan-39bf76dae61 )