# data file for the Fltk User Interface Designer (fluid)
version 1.0302 
header_name {.h} 
code_name {.cc}
decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local
} 

decl {//License: GNU GPL version 2 or later} {private local
} 

decl {\#include <cstdlib>} {public local
} 

decl {\#include <cstdio>} {public local
} 

decl {\#include <cstring>} {public local
} 

decl {\#include <FL/Fl_Button.H>} {public local
} 

decl {\#include <FL/Fl_File_Chooser.H>} {public local
} 

decl {\#include <FL/Fl_Input.H>} {public local
}

decl {\#include "Fl_Osc_Interface.h"} {public local
} 

decl {\#include "Fl_Osc_Check.H"} {public local
} 

decl {\#include "Fl_Osc_Pane.H"} {public local
}

decl {\#include "../Misc/Util.h"} {public local
} 

decl {\#include "BankView.h"} {public local
} 

class BankUI {open
} {
  Function {make_window()} {open
  } {
    Fl_Window bankuiwindow {
      label Bank open
      xywh {492 406 785 575} type Double
      class Fl_Osc_Window
    } {
      Fl_Box {} {
        xywh {0 0 0 0}
        code0 {bankuiwindow->init(osc, "/");}
      }
      Fl_Button {} {
        label Close
        callback {bankuiwindow->hide();}
        xywh {705 546 70 24} box THIN_UP_BOX
      }
      Fl_Group bankview {open
        xywh {5 34 772 491} box ENGRAVED_FRAME
        class BankView
      } {}
      Fl_Group modeselect {open
        xywh {5 528 425 42} box ENGRAVED_BOX
        class BankViewControls
        code0 {o->box(FL_UP_BOX);}
      } {}
      Fl_Button {} {
        label {New Bank...}
        callback {const char *dirname;

dirname=fl_input("New empty Bank:");
if (dirname==NULL) return;

osc->write("/bank/newbank", "s", dirname);
refreshmainwindow();}
        xywh {685 5 93 25} labelfont 1 labelsize 11 align 128
      }
      Fl_Check_Button {} {
        label {auto close}
        tooltip {automatically close the bank window if the instrument is loaded} xywh {705 529 60 15} down_box DOWN_BOX labelsize 10
        code0 {o->init("config/cfg.BankUIAutoClose");}
        class Fl_Osc_Check
      }
      Fl_Choice banklist {
        callback {refreshmainwindow();}
        xywh {5 8 220 20} down_box BORDER_BOX labelfont 1 align 0 textfont 1 textsize 11
        code0 {bankview->init(osc, modeselect, npart);}
        code1 {o->init("bank/bank_select");}
        class BankList
      } {}
      Fl_Button {} {
        label {Refresh bank list}
        callback {rescan_for_banks();
banklist->value(0);}
        tooltip {Refresh the bank list (rescan)} xywh {230 8 105 20} box THIN_UP_BOX color 50 labelsize 11
      }
      Fl_Input {} {
        label {Search by name: }
        code0 {o->when(FL_WHEN_CHANGED);}
        callback {
           std::string str = o->value();
           update_search(str)}
        tooltip {Enter text to search for}
        xywh {460 8 105 20} box THIN_UP_BOX color 50 labelsize 11
      }
    }
  }
  Function {BankUI(int *npart_, Fl_Osc_Interface *osc_)} {open
  } {
    code {npart=npart_;
osc  =osc_;
make_window();
} {}
  }
  Function {~BankUI()} {open return_type virtual
  } {
    code {bankuiwindow->hide();
delete bankuiwindow;} {}
  }
  Function {show()} {open
  } {
    code {bankuiwindow->show();} {}
  }
  Function {hide()} {open
  } {
    code {bankuiwindow->hide();} {}
  }
  Function {init(Fl_Valuator *cbwig_)} {open
  } {
    code {cbwig=cbwig_;
    bankview->cbwig(cbwig);
rescan_for_banks();} {}
  }
  Function {process()} {open return_type void
  } {
    code {} {}
  }
  Function {refreshmainwindow()} {open
  } {
    code {
bankview->refresh();} {}
  }
  Function {rescan_for_banks()} {open
  } {
    code {banklist->clear();
    osc->write("/bank/rescan");
if (banklist->size() == 0)
     banklist->add(" ");} {}
  }
  Function {update_search(std::string search_string)} {open
  } {
    code {if (search_string.empty()) {
    refreshmainwindow();
} else {
    osc->write("/bank/search", "s", search_string.c_str());
}
    } {}
  }
  decl {Fl_Osc_Interface *osc;} {private local
  }
  decl {Fl_Valuator *cbwig;} {public local
  }
  decl {int *npart;} {private local
  }
} 
