zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

BankView.h (2556B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   BankView.h - View of Bank Widgets
      5   Copyright (C) 2016 Mark McCurry
      6 
      7   This program is free software; you can redistribute it and/or
      8   modify it under the terms of the GNU General Public License
      9   as published by the Free Software Foundation; either version 2
     10   of the License, or (at your option) any later version.
     11 */
     12 #ifndef BANKVIEW_H
     13 #define BANKVIEW_H
     14 
     15 #include "Fl_Osc_Widget.H"
     16 #include "Fl_Osc_Choice.H"
     17 #include <FL/Fl_Group.H>
     18 #include <FL/Fl_Check_Button.H>
     19 #include <string>
     20 
     21 #include "common.H"
     22 
     23 class Bank;
     24 class BankView;
     25 class Fl_Check_Button;
     26 
     27 class BankList : public Fl_Osc_Choice
     28 {
     29     public:
     30         BankList(int x,int y, int w, int h, const char *label=0);
     31         void init(std::string path);
     32         void OSC_raw(const char *msg);
     33 };
     34 
     35 class BankSlot : public Fl_Button
     36 {
     37     public:
     38         BankSlot(int x,int y, int w, int h, const char *label=0);
     39         int handle(int event);
     40         void init(int nslot_, BankView *bv_);
     41 
     42         void update(const char *name__, const char *fname__);
     43 
     44         bool empty(void) const;
     45         const char *name(void) const;
     46         const char *filename(void) const;
     47     private:
     48         std::string name_;
     49         std::string filename_;
     50         char labelstr[128];
     51         int nslot;
     52         BankView *bv;
     53 };
     54 
     55 class BankViewControls: public Fl_Group
     56 {
     57     public:
     58         BankViewControls(int x,int y, int w, int h, const char *label=0);
     59         void init(BankView *bv_);
     60 
     61 
     62         int mode(void) const;
     63         void mode(int);
     64 
     65     private:
     66         Fl_Check_Button *read;
     67         Fl_Check_Button *write;
     68         Fl_Check_Button *clear;
     69         Fl_Check_Button *swap;
     70 
     71         //1 -> read
     72         //2 -> write
     73         //3 -> clear
     74         //4 -> swap
     75         int mode_;
     76 
     77         static void cb_clearbutton(Fl_Check_Button*, void*);
     78         static void cb_readbutton(Fl_Check_Button*, void*);
     79         static void cb_writebutton(Fl_Check_Button*, void*);
     80 };
     81 
     82 class BankView: public Fl_Group, public Fl_Osc_Widget
     83 {
     84     public:
     85         BankView(int x,int y, int w, int h, const char *label=0);
     86         ~BankView(void);
     87         void init(Fl_Osc_Interface *osc_, BankViewControls *bvc_, int *npart_);
     88 
     89         void react(int event, int slot);
     90 
     91         virtual void OSC_raw(const char *msg) override;
     92         void cbwig(Fl_Widget *w);
     93 
     94         void refresh(void);
     95     private:
     96         BankViewControls *bvc;
     97         BankSlot *slots[160];
     98 
     99         //XXX TODO locked banks...
    100         int nselected;
    101         int *npart;
    102 
    103         Fl_Widget *cbwig_;
    104 };
    105 
    106 #endif