home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / ZynAddFX / Setup_ZynAddSubFX-2.1.1.exe / MicrotonalUI.fl < prev    next >
Encoding:
FLTK User Interface Designer  |  2004-08-22  |  10.3 KB  |  268 lines

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0105 
  3. header_name {.h} 
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2004 Nasca Octavian Paul} {} 
  6.  
  7. decl {//License: GNU GPL version 2} {} 
  8.  
  9. decl {\#include <stdlib.h>} {public
  10.  
  11. decl {\#include <stdio.h>} {public
  12.  
  13. decl {\#include <string.h>} {public
  14.  
  15. decl {\#include <FL/Fl_File_Chooser.H>} {public
  16.  
  17. decl {\#include <FL/fl_ask.H>} {public
  18.  
  19. decl {\#include "../Misc/Microtonal.h"} {public
  20.  
  21. class MicrotonalUI {} {
  22.   Function {make_window()} {} {
  23.     Fl_Window microtonaluiwindow {
  24.       label Scales
  25.       xywh {140 189 405 450} type Double hide
  26.     } {
  27.       Fl_Group {} {
  28.         tooltip {Center where the note's freqs. are turned upside-down} xywh {249 2 155 45} box ENGRAVED_FRAME
  29.       } {
  30.         Fl_Check_Button {} {
  31.           label {Invert keys}
  32.           callback {microtonal->Pinvertupdown=(int) o->value();
  33. if (microtonal->Pinvertupdown==0) centerinvertcounter->deactivate();
  34.    else centerinvertcounter->activate();}
  35.           tooltip {Turn upside-down the note frequencies} xywh {254 13 55 30} down_box DOWN_BOX labelfont 1 labelsize 12 align 148
  36.           code0 {o->value(microtonal->Pinvertupdown);}
  37.         }
  38.         Fl_Counter centerinvertcounter {
  39.           label Center
  40.           callback {microtonal->Pinvertupdowncenter=(int) o->value();}
  41.           xywh {319 13 80 20} labelfont 1 labelsize 12 align 130 minimum 0 maximum 127 step 1 textfont 1
  42.           code0 {o->lstep(microtonal->getoctavesize());}
  43.           code1 {o->value(microtonal->Pinvertupdowncenter);}
  44.           code2 {if (microtonal->Pinvertupdown==0) o->deactivate();}
  45.         }
  46.       }
  47.       Fl_Group microtonalgroup {
  48.         xywh {3 49 402 398} box ENGRAVED_FRAME
  49.         code0 {if (microtonal->Penabled==0) o->deactivate();}
  50.       } {
  51.         Fl_Button {} {
  52.           label Apply
  53.           callback {tuningsinput->do_callback();
  54. mappinginput->do_callback();}
  55.           tooltip {Retune the synth accorging to the inputs from "Tunnings" and "Keyboard Mappings"} xywh {8 413 95 28} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 18
  56.         }
  57.         Fl_Value_Output octavesizeoutput {
  58.           label {nts./oct.}
  59.           callback {o->value(microtonal->getoctavesize());}
  60.           tooltip {Notes/Octave} xywh {150 421 35 17} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
  61.           code0 {o->value(microtonal->getoctavesize());}
  62.         }
  63.         Fl_Input nameinput {
  64.           label {Name:}
  65.           callback {snprintf((char *)microtonal->Pname,MICROTONAL_MAX_NAME_LEN,"%s",o->value());}
  66.           xywh {8 64 285 25} labelfont 1 labelsize 12 align 5
  67.           code0 {o->insert((char *)microtonal->Pname);}
  68.         }
  69.         Fl_Input tuningsinput {
  70.           label {Tunings:}
  71.           callback {int err=microtonal->texttotunings(o->value());
  72. if (err>=0) fl_alert("Parse Error: The input may contain only numbers (like 232.59)\\n or divisions (like 121/64).");
  73. if (err==-2) fl_alert("Parse Error: The input is empty.");
  74. octavesizeoutput->do_callback();}
  75.           xywh {8 144 182 264} type Multiline labelfont 1 labelsize 12 align 5 when 0
  76.           code0 {updateTuningsInput();}
  77.         }
  78.         Fl_Input commentinput {
  79.           label {Comment:}
  80.           callback {snprintf((char *)microtonal->Pcomment,MICROTONAL_MAX_NAME_LEN,"%s",o->value());}
  81.           xywh {8 104 391 25} labelfont 1 labelsize 12 align 5
  82.           code0 {o->insert((char *)microtonal->Pcomment);}
  83.         }
  84.         Fl_Counter {} {
  85.           label Shift
  86.           callback {microtonal->Pscaleshift=(int) o->value()+64;}
  87.           xywh {313 69 70 20} type Simple labelsize 12 align 1 minimum -63 maximum 64 step 1 textfont 1
  88.           code0 {o->value(microtonal->Pscaleshift-64);}
  89.         }
  90.         Fl_Button {} {
  91.           label {Import .SCL file}
  92.           callback {const char *filename;
  93. filename=fl_file_chooser("Open:","(*.scl)",NULL,0);
  94. if (filename==NULL) return;
  95. int result=microtonal->loadscl(filename);
  96. if (result==0) {
  97.        updateTuningsInput();
  98.        nameinput->cut(0,nameinput->maximum_size());
  99.        nameinput->insert((char *)microtonal->Pname);
  100.        nameinput->position(0);
  101.        commentinput->cut(0,commentinput->maximum_size());
  102.        commentinput->insert((char *)microtonal->Pname);
  103.        commentinput->position(0);
  104.        tuningsinput->position(0);
  105.        octavesizeoutput->do_callback();
  106.      } else {
  107.     fl_alert("Error: Could not load the file.");   
  108.      };}
  109.           tooltip {Inport Scala .scl file (tunnings)} xywh {243 411 84 15} box THIN_UP_BOX labelfont 1 labelsize 10
  110.         }
  111.         Fl_Group keymappinggroup {
  112.           label {Keyboard Mapping} open
  113.           xywh {193 144 206 264} box ENGRAVED_BOX labelfont 1 labelsize 12
  114.         } {
  115.           Fl_Input mappinginput {
  116.             callback {microtonal->texttomapping(o->value());
  117. mapsizeoutput->do_callback();
  118. anotecounter->do_callback();}
  119.             xywh {250 147 146 258} type Multiline labelfont 1 labelsize 12 align 5
  120.             code0 {updateMappingInput();}
  121.           }
  122.           Fl_Counter firstnotecounter {
  123.             label {First note}
  124.             callback {microtonal->Pfirstkey=(int) o->value();}
  125.             tooltip {First MIDI note number} xywh {199 195 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 12
  126.             code0 {o->value(microtonal->Pfirstkey);}
  127.           }
  128.           Fl_Counter lastnotecounter {
  129.             label {Last note}
  130.             callback {microtonal->Plastkey=(int) o->value();}
  131.             tooltip {Last MIDI note number} xywh {199 225 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 12
  132.             code0 {o->value(microtonal->Plastkey);}
  133.           }
  134.           Fl_Counter middlenotecounter {
  135.             label {Midle note}
  136.             callback {microtonal->Pmiddlenote=(int) o->value();}
  137.             tooltip {Midle note (where scale degree 0 is mapped to)} xywh {199 267 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 60 textfont 1 textsize 12
  138.             code0 {o->value(microtonal->Pmiddlenote);}
  139.           }
  140.           Fl_Value_Output mapsizeoutput {
  141.             label {Map Size}
  142.             callback {o->value(microtonal->Pmapsize);}
  143.             xywh {201 382 44 20} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
  144.             code0 {o->value(microtonal->Pmapsize);}
  145.           }
  146.         }
  147.         Fl_Check_Button mappingenabledbutton {
  148.           label ON
  149.           callback {int x=(int) o->value();
  150. microtonal->Pmappingenabled=x;
  151. if (x==0) keymappinggroup->deactivate();
  152.  else keymappinggroup->activate();
  153. o->show();}
  154.           tooltip {Enable the Mapping (otherwise the mapping is linear)} xywh {198 150 48 21} box FLAT_BOX down_box DOWN_BOX labelfont 1
  155.           code0 {o->value(microtonal->Pmappingenabled);}
  156.           code1 {if (microtonal->Pmappingenabled==0) keymappinggroup->deactivate();}
  157.         }
  158.         Fl_Button {} {
  159.           label {Import .kbm file}
  160.           callback {const char *filename;
  161. filename=fl_file_chooser("Open:","(*.kbm)",NULL,0);
  162. if (filename==NULL) return;
  163. int result=microtonal->loadkbm(filename);
  164. if (result==0) {
  165.        updateMappingInput();
  166.        mappinginput->position(0);
  167.        mapsizeoutput->do_callback();
  168.        firstnotecounter->value(microtonal->Pfirstkey);
  169.        lastnotecounter->value(microtonal->Plastkey);
  170.        middlenotecounter->value(microtonal->Pmiddlenote);
  171.        mapsizeoutput->do_callback();
  172.        mappingenabledbutton->value(microtonal->Pmappingenabled);
  173.        mappingenabledbutton->do_callback();
  174.        afreqinput->value(microtonal->PAfreq);
  175.        anotecounter->value(microtonal->PAnote);
  176.        anotecounter->do_callback();
  177.      } else {
  178.     fl_alert("Error: Could not load the file.");   
  179.      };}
  180.           tooltip {Inport Scala .kbm file (keyboard mapping)} xywh {243 428 84 16} box THIN_UP_BOX labelfont 1 labelsize 10
  181.         }
  182.       }
  183.       Fl_Group {} {
  184.         xywh {108 2 140 45} box ENGRAVED_FRAME
  185.       } {
  186.         Fl_Counter anotecounter {
  187.           label {"A" Note}
  188.           callback {microtonal->PAnote=(int) o->value();
  189. if (microtonal->getnotefreq(microtonal->PAnote,0)<0.0) o->textcolor(FL_RED);
  190.  else o->textcolor(FL_BLACK);
  191.  
  192. o->redraw();}
  193.           tooltip {The "A" note (the reference note for which freq. ("A" freq) is given)} xywh {173 17 65 20} labelfont 1 labelsize 10 align 129 minimum 0 maximum 127 step 1 value 69 textfont 1 textsize 11
  194.           code0 {o->lstep(12);}
  195.           code1 {o->value(microtonal->PAnote);}
  196.         }
  197.         Fl_Value_Input afreqinput {
  198.           label {"A" Freq.}
  199.           callback {microtonal->PAfreq=o->value();}
  200.           tooltip {The freq. of "A" note (default=440.0)} xywh {118 17 45 20} labelfont 1 labelsize 10 align 1 minimum 1 maximum 20000 step 0.001 value 440 textfont 1 textsize 11
  201.           code0 {o->value(microtonal->PAfreq);}
  202.         }
  203.       }
  204.       Fl_Button {} {
  205.         label Close
  206.         callback {microtonaluiwindow->hide();}
  207.         xywh {333 413 67 28} box THIN_UP_BOX
  208.       }
  209.       Fl_Check_Button {} {
  210.         label {Enable Microtonal}
  211.         callback {microtonal->Penabled=(int) o->value();
  212. if (microtonal->Penabled==0) microtonalgroup->deactivate();
  213.    else microtonalgroup->activate();}
  214.         xywh {3 3 102 45} box PLASTIC_UP_BOX down_box DOWN_BOX labelfont 1 labelsize 12 align 148
  215.         code0 {o->value(microtonal->Penabled);}
  216.       }
  217.     }
  218.   }
  219.   Function {updateTuningsInput()} {selected
  220.   } {
  221.     code {char *tmpbuf=new char[100];
  222.  
  223. tuningsinput->cut(0,tuningsinput->maximum_size());
  224.  
  225. for (int i=0;i<microtonal->getoctavesize();i++){
  226.    if (i!=0) tuningsinput->insert("\\n");
  227.    microtonal->tuningtoline(i,tmpbuf,100);
  228.    tuningsinput->insert(tmpbuf);
  229. };
  230.  
  231. delete(tmpbuf);} {}
  232.   }
  233.   Function {updateMappingInput()} {} {
  234.     code {char *tmpbuf=new char[100];
  235.  
  236. mappinginput->cut(0,tuningsinput->maximum_size());
  237.  
  238. for (int i=0;i<microtonal->Pmapsize;i++){
  239.    if (i!=0) mappinginput->insert("\\n");
  240.    if ((microtonal->Pmapping[i])==-1)
  241.         snprintf(tmpbuf,100,"x");
  242.    else snprintf(tmpbuf,100,"%d",microtonal->Pmapping[i]);
  243.    mappinginput->insert(tmpbuf);
  244. };
  245.  
  246. delete(tmpbuf);} {}
  247.   }
  248.   Function {MicrotonalUI(Microtonal *microtonal_)} {} {
  249.     code {microtonal=microtonal_;
  250.  
  251. make_window();} {}
  252.   }
  253.   Function {~MicrotonalUI()} {} {
  254.     code {microtonaluiwindow->hide();
  255. delete(microtonaluiwindow);} {}
  256.   }
  257.   Function {show()} {} {
  258.     code {microtonaluiwindow->show();} {}
  259.   }
  260.   decl {Microtonal *microtonal;} {}
  261.