jed-users mailing list

[2002 Date Index] [2002 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: question on colour objects


On Wed, 13 Nov 2002 13:35:55 +0100 (CET) wrote Guido Gonzato <ggonza@xxxxxx>:

> I'd like to draw an ASCII piano keyboard. To do so, I need to set '
> white and black 'rectangles' (characters) with which to draw black and
> white keys. 
...  
> I suppose I shoud create a colour object and associate a special character
> to it, so that inserting (say) '#' I get a white-on-white character, and
> inserting say '@' I get a black-on-black character.
> 
> The question is: how do I do that? If anyone has ideas...

  I tried with a special syntax map but failed :-(
                                                  
But how about using colored lines and columns? Something like                                                  

  
static variable lines = Mark_Type[4];
define draw_piano()
{
   setbuf("piano");
   set_color_object(30, "blue", "white");
   set_color_object(31, "blue", "black");
   variable i=1;
   % set the column colors
   % of course a real piano has not evenly spaces black and white keys
   loop(WRAP/5)
     {
        set_column_colors (30, i, i+2);
        set_column_colors (31, i+3, i+4);
        i += 5;
     }
   % fill the buffer with spaces to see the background
   loop(12)
     { 
        insert_spaces(WRAP);
        newline;
     }
   % overwrite the columns with line-marks to get the wide part of the
   %  white keys
   for(i=0; i<4; i++)
     {
        lines[i] = create_line_mark(30);
        go_up_1;
     }
   pop2buf("piano");
   % alternatively use my
   % popup_buffer("piano");  % includes the fit-window function
}

                                                  
Regards
                                                  
Günter MIlde                                                  

--
Milde at ife.et.tu-dresden.de


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2002 date index] [2002 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]