# data file for the Fltk User Interface Designer (fluid)
version 1.0308
header_name {.h}
code_name {.cc}
comment {MasterUI.h} {not_in_source in_header
}

comment {MasterUI.cc} {in_source not_in_header
}

comment {Original ZynAddSubFX author Nasca Octavian Paul
Copyright (C) 2002-2005 Nasca Octavian Paul
Copyright 2009-2011, Alan Calvert
Copyright 2014-2024, Will Godfrey

This file is part of yoshimi, which is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.

yoshimi is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.   See the GNU General Public License (version 2 or
later) for more details.

You should have received a copy of the GNU General Public License along with
yoshimi; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA  02110-1301, USA.

This file is a derivative of the ZynAddSubFX original.

} {selected in_source in_header
}

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

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

decl {\#include "UI/MiscGui.h"} {public local
}

decl {\#include "UI/WidgetCheckButton.h"} {public local
}

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

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

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

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

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

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

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

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

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

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

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

decl {\#include "MasterUI.h"} {private global
}

decl {\#include "UI/WidgetMWSlider.h"} {private global
}

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

decl {\#include <FL/Fl_Menu_Bar.H>} {public global
}

decl {\#include <FL/fl_draw.H>} {private global
}

decl {\#define MIN_DB -48.0} {public local
}

decl {\#define NO_DB -68.0} {public local
}

decl {\#include "Misc/NumericFuncs.h"
    using func::asDecibel;} {private local
}

decl {\#include "Misc/FormatFuncs.h"
    using func::asString;} {private local
}

class VUMeter {: {public Fl_Box}
} {
  Function {VUMeter(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
    code {npart=-1;} {}
  }
  Function {init(int part_, SynthEngine *_synth)} {} {
    code {// the "part_" parameters sets the part (if it is >=0), else it sets the master
    synth = _synth;
    label(NULL);
    tick500 = 0;
    npart = part_;
    oldpeakl = 0;
    oldpeakr = 0;
    oldrmsdbl = 0.0;
    oldrmsdbr = 0.0;
    maxdbl = NO_DB;
    maxdbr = NO_DB;
    clipped = 0;
    plgroup = &synth->getGuiMaster()->panelgroup;
    for (int i = 0; i < NUM_MIDI_PARTS; i++)
    {
        panelpart.oldpeak[i] = 0;
        panelpart.oldpeakR[i] = 0;
        panelpart.clip[i] = false;
        panelpart.clipR[i] = false;
    }} {}
  }
  Function {fetchData(float value, int control, int part, int kititem = UNUSED, int engine = UNUSED, int insert = UNUSED, int parameter = UNUSED, int offset = UNUSED, int miscmsg = UNUSED)} {return_type float
  } {
    code {//
        return collect_readData(synth, value, control, part, kititem, engine, insert, parameter, offset, miscmsg);} {}
  }
  Function {draw_master()} {} {
    code {//
            int ox = x();
            int oy = y();
            int lx = w();
            int ly = h();
            float dbl = asDecibel(fetchData(0, MAIN::control::readMainLRpeak, TOPLEVEL::section::main, 0));
            float dbr = asDecibel(fetchData(0, MAIN::control::readMainLRpeak, TOPLEVEL::section::main, 1));
            float rmsdbl = asDecibel(fetchData(0, MAIN::control::readMainLRrms, TOPLEVEL::section::main, 0));
            float rmsdbr = asDecibel(fetchData(0, MAIN::control::readMainLRrms, TOPLEVEL::section::main, 1));

            clipped = clipped | (dbl > 0) | ((dbr > 0) << 1);
            if (dbl > 0.5f)
                dbl = 0.5f;
            if (dbr > 0.5f)
                dbr = 0.5f;

            if (dbl > maxdbl)
                maxdbl = dbl;
            if (dbr > maxdbr)
                maxdbr = dbr;

            dbl = (MIN_DB - dbl) / MIN_DB;
            if (dbl < 0.0)
                dbl = 0.0;
            else if (dbl > 1.0)
                dbl = 1.0;
            dbr = (MIN_DB - dbr) / MIN_DB;
            if (dbr < 0.0)
                dbr = 0.0;
            else if (dbr > 1.0)
                dbr = 1.0;
\#          define VULENX (lx-35)
\#          define VULENY (ly/2-3)
            dbl *= VULENX;
            dbr *= VULENX;
            oldpeakl = (int)dbl;
            oldpeakr = (int)dbr;

            // compute RMS - start
            rmsdbl = ((MIN_DB - rmsdbl) / MIN_DB);
            if (rmsdbl < 0.0)
                rmsdbl = 0.0;
            else if (rmsdbl >  1.0)
                rmsdbl =  1.0;
            rmsdbr = ((MIN_DB - rmsdbr) / MIN_DB);
            if (rmsdbr < 0.0)
                rmsdbr = 0.0;
            else if (rmsdbr >1.0)
                rmsdbr = 1.0;
            int irmsdbl = rmsdbl * VULENX;
            int irmsdbr = rmsdbr * VULENX;
            // compute RMS - end

            // draw db level
            fl_color(VU_level);
            fl_rectf(ox, oy, oldpeakl, VULENY);
            fl_rectf(ox, oy + ly / 2, oldpeakr, VULENY);

            // fill with black
            fl_rectf(ox + oldpeakl, oy, VULENX - oldpeakl, VULENY, graph_back);
            fl_rectf(ox + oldpeakr, oy + ly / 2, VULENX - oldpeakr, VULENY, graph_back);

            // draw scale
            float tmp = VULENX * 1.0 / MIN_DB;
            for (int i = 1; i < 1 - MIN_DB; ++i)
            {
                int tx = VULENX + (int)(tmp * i);
                fl_color(VU_bar_1dB);
                fl_rectf(ox + tx, oy, 1, VULENY + ly / 2);
                if (i % 5 == 0)
                {
                    fl_color(VU_bar_5dB);
                    fl_rectf(ox + tx, oy, 1, VULENY + ly / 2);
                }
                if (i % 10 == 0)
                    fl_rectf(ox + tx - 1, oy, 2, VULENY + ly / 2, VU_bar_10dB);
            }

            // mellow yellow rms indicator
            if (irmsdbl)
                fl_rectf(ox + irmsdbl - 1, oy, 3, VULENY, VU_rms);
            if (irmsdbr)
                fl_rectf(ox + irmsdbr - 1, oy + ly / 2, 3, VULENY, VU_rms);

            // see red if clipped
            if (clipped & 1)
                fl_rectf(ox + VULENX + 2, oy, lx - VULENX - 3, ly / 2 - 3, VU_over);
            else
                fl_rectf(ox + VULENX + 2, oy, lx - VULENX - 3, ly / 2 - 3, graph_back);

            if (clipped & 2)
                fl_rectf(ox + VULENX + 2, oy + ly / 2, lx - VULENX - 3, (ly - 2) / 2 - 2, VU_over);
            else
                fl_rectf(ox + VULENX + 2, oy + ly / 2, lx - VULENX - 3, (ly - 2) / 2 - 2, graph_back);

            // show maxdB
            static char tmpstr[8];
            const char *dbtag = "dB";

            if ((maxdbl > NO_DB))
            {
                fl_font(FL_HELVETICA | FL_BOLD, 9);
                fl_color(VU_text);
                snprintf(tmpstr, 7, "%+3.f%s", maxdbl + 0.5f, dbtag);
                fl_draw(tmpstr, ox + VULENX + 1, oy + 1,
                    lx - VULENX - 4, VULENY - 2, FL_ALIGN_RIGHT, NULL, 0);
            }

            if ((maxdbr > NO_DB))
            {
                fl_font(FL_HELVETICA | FL_BOLD, 9);
                fl_color(VU_text);
                snprintf(tmpstr, 7, "%+3.f%s", maxdbr + 0.5f, dbtag);
                fl_draw(tmpstr, ox + VULENX + 1, oy + ly / 2 + 1,
                    lx - VULENX - 4, VULENY, FL_ALIGN_RIGHT, NULL, 0);
            }} {}
  }
  Function {draw_part()} {} {
    code {//
    int ox = x()+2;
    int oy = y()+2;
    int lx = w()-4;
    int ly = h()-4;
    int mid = (w() / 2) - 2;
    int actualpart = npart + *plgroup;
    float Vpeak = fetchData(0, MAIN::control::readPartPeak, TOPLEVEL::section::main, actualpart);
    if (Vpeak < 0) // its inactive
    {
        fl_color(45);
        fl_rectf(ox, oy, lx, ly);
    }
    else
    {

        if (Vpeak > 1.0f)
        {
            panelpart.clip[actualpart] = true;
            if (Vpeak > 1.5f)
                Vpeak = 1.0f;
        }

        // draw the vu lines
        float db = asDecibel(Vpeak);
        db = (MIN_DB - db) / MIN_DB;
        db = (db > 1.0) ? 1.0 : db;
        db = db * ly - 2;
        panelpart.oldpeak[actualpart] = int(db);
        fl_rectf(ox, oy,mid, ly, graph_back);
        fl_color(VU_level);
        fl_rectf(ox, oy + ly - panelpart.oldpeak[actualpart], mid, panelpart.oldpeak[actualpart]);
        if (panelpart.clip[actualpart])
            fl_rectf(ox, oy, mid, 4, VU_over);

        Vpeak = fetchData(0, MAIN::control::readPartPeak, TOPLEVEL::section::main, actualpart, 1);
        if (Vpeak > 1.0)
            panelpart.clipR[actualpart] = true;
        db = asDecibel(Vpeak);
        db = (MIN_DB - db) / MIN_DB;
        db = (db > 1.0) ? 1.0 : db;
        db = db * ly - 2;
        panelpart.oldpeakR[actualpart] = int(db);
        fl_rectf(ox + mid, oy,lx - mid, ly, graph_back);
        fl_color(VU_level);
        fl_rectf(ox + mid, oy + ly - panelpart.oldpeakR[actualpart], lx - mid, panelpart.oldpeakR[actualpart]);
        if (panelpart.clipR[actualpart])
            fl_rectf(ox + mid, oy, lx - mid, 4, VU_over);

        // draw the scales
        float tmp = ly * 1.0 / MIN_DB;
        for (int i = 1; i < 1 - MIN_DB; ++i)
        {
            int ty = ly + int(tmp * i);
            if (i % 5 == 0)
            {
                fl_color(VU_bar_1dB); // actually 5dB here
                fl_rectf(ox, oy + ly - ty, lx, 1);
            }
            if (i % 10 == 0)
            {
                fl_color(VU_bar_10dB);
                fl_rectf(ox, oy + ly - ty, lx, 1);
            }
        }
        fl_rectf(x() + mid, oy, 4, ly, FL_GRAY);
    }
    fl_color(42);
    fl_rectf(x() + mid, oy, 4, ly);} {}
  }
  Function {draw()} {} {
    code {//
    if (npart >= 0)
        draw_part();
    else
    {
        draw_master();
        ++tick500;
        if (!(tick500 & 15)) // approx 500mS delay
        {
            synth->getGuiMaster()->configui->halfSecTimer();
        }
    }} {}
  }
  Function {tickdraw(VUMeter *o)} {return_type {static void}
  } {
    code {o->redraw();} {}
  }
  Function {tick(void *v)} {return_type {static void}
  } {
    code {//
    tickdraw((VUMeter *) v);
    Fl::add_timeout(0.033333333, tick, v); // 1.0 / 30.0 => 30 fps} {}
  }
  Function {handle(int event)} {return_type int
  } {
    code {//
    switch(event)
    {
        case FL_SHOW:
            tick(this);
            return 1;
        case FL_HIDE:
            Fl::remove_timeout(tick, this);
            return 1;
        case FL_PUSH:
            if (npart < 0)
            {
                maxdbl = NO_DB;
                maxdbr = NO_DB;
                clipped = 0;
               	MasterUI *masterUI = synth->getGuiMaster();
               	if (masterUI)
                    masterUI->resetPartsClip();
            }
            return 1;
    }
    return 0;} {}
  }
  decl {int tick500;} {private local
  }
  decl {int npart;} {private local
  }
  decl {float oldrmsdbl;} {private local
  }
  decl {float oldrmsdbr;} {private local
  }
  decl {float maxdbl;} {private local
  }
  decl {float maxdbr;} {private local
  }
  decl {int oldpeakl;} {private local
  }
  decl {int oldpeakr;} {private local
  }
  decl {int clipped;} {private local
  }
  decl {int *plgroup;} {public local
  }
  decl {SynthEngine *synth;} {private local
  }
  decl {struct{
 int oldpeak[NUM_MIDI_PARTS]; int oldpeakR[NUM_MIDI_PARTS];
  bool clip[NUM_MIDI_PARTS];
 bool clipR[NUM_MIDI_PARTS]; } panelpart;} {public local
  }
  Function {resetPart(bool clipOnly = false)} {} {
    code {//
    for (int i = 0; i < NUM_MIDI_PARTS; i++)
    {
        panelpart.clip[i] = false;
        panelpart.clipR[i] = false;
        if (!clipOnly)
        {
            panelpart.oldpeak[i] = 0;
            panelpart.oldpeakR[i] = 0;
        }
    }} {}
  }
}

class SysEffSend {: {public WidgetPDial}
} {
  Function {SysEffSend(int x,int y, int w, int h, const char *label=0):WidgetPDial(x,y,w,h,label)} {} {
    code {neff1=0; neff2=0;} {}
  }
  Function {init(int neff1_, int neff2_, SynthEngine *_synth)} {} {
    code {//
        synth = _synth;
        neff1 = neff1_;
        neff2 = neff2_;
        minimum(0);
        maximum(127);
        step(1);
        labelfont(0);
        labelsize(11);
        align(FL_ALIGN_TOP);
        value(synth->Psysefxsend[neff1][neff2]);
        copy_label((asString(neff1 + 1) + "->" + asString(neff2 + 1)).c_str());} {}
  }
  Function {~SysEffSend()} {} {
    code {hide();} {}
  }
  Function {handle(int event)} {return_type int
  } {
    code {//
    if (event == FL_PUSH || event == FL_DRAG || event == FL_MOUSEWHEEL)
        collect_writeData(synth, value(), 0, (TOPLEVEL::type::Write | TOPLEVEL::type::Integer), neff2, TOPLEVEL::section::systemEffects, UNUSED, neff1, TOPLEVEL::insert::systemEffectSend);
    return WidgetPDial::handle(event);} {}
  }
  decl {int neff1;} {private local
  }
  decl {int neff2;} {private local
  }
  decl {SynthEngine *synth;} {private local
  }
}

class Panellistitem {: {public Fl_Group}
} {
  Function {make_window()} {} {
    Fl_Window panellistitem {
      xywh {648 54 65 270} type Double hide
      class Fl_Group
    } {
      Fl_Group panellistitemgroup {
        xywh {0 -5 65 279} box PLASTIC_THIN_UP_BOX
        code0 {if (not synth->partonoffRead(npart + *plgroup)) o->deactivate();}
        code1 {if (not synth->getRuntime().isMultiFeed) audiosend->deactivate();}
      } {
        Fl_Group {} {
          xywh {30 64 26 112} box ENGRAVED_FRAME
        } {
          Fl_Box partVUMeter {
            label {V U}
            xywh {30 65 26 110} box FLAT_BOX labelcolor 55 align 128
            code0 {partVUMeter->init(npart, synth);}
            class VUMeter
          }
          Fl_Button {} {
            callback {//
                      for (int i = 0; i < NUM_MIDI_PARTS; i += NUM_MIDI_CHANNELS)
                      {
                        partVUMeter->panelpart.clip[npart + i] = false;
                        partVUMeter->panelpart.clipR[npart + i] = false;
                      }}
            tooltip {Click here to clear overload warning.} xywh {30 64 26 111} box NO_BOX labelcolor 64
          }
        }
        Fl_Button partEdit {
          label Edit
          callback {//
              int newpart = npart | synth->getGuiMaster()->panelgroup;
              if (Fl::event() == FL_RELEASE && Fl::event_button() == FL_RIGHT_MOUSE)
                  synth->getGuiMaster()->partui->Showedit();

              if ((int)bankui->cbwig->value() != (newpart + 1))
              {
                  bankui->cbwig->value(newpart + 1);
                  bankui->cbwig->do_callback();
              }}
          tooltip {Left mouse button: Part select
Right mouse button: Instrument edit} xywh {12 248 40 20} box PLASTIC_UP_BOX labelfont 9 labelsize 10 labelcolor 64
        }
        Fl_Box partadd {
          xywh {5 20 17 40} box FLAT_BOX
        }
        Fl_Box partsub {
          xywh {22 20 18 40} box FLAT_BOX
        }
        Fl_Box partpad {
          xywh {40 20 17 40} box FLAT_BOX
        }
        Fl_Button partname {
          label {  }
          xywh {4 20 55 40} box THIN_DOWN_FRAME labelsize 10 labelcolor 64 align 208
        }
        Fl_Button buttontop {
          label {  }
          callback {//
    bankui->cbwig->value(npart + 1 + *plgroup);
    bankui->cbwig->do_callback();
    bankui->Show();}
          xywh {4 20 55 40} box THIN_DOWN_FRAME labeltype NO_LABEL labelfont 9 labelsize 10 labelcolor 64 align 208
        }
        Fl_Slider partvolume {
          callback {//
    float realvalue;
    if (Fl::event_button() == 3)
    {
        realvalue = 96;
        o->value(realvalue);
        o->redraw();
    }
    else
        realvalue = o->value();
    o->selection_color(setSlider(realvalue,96));
//   synth->getGuiMaster()->partVol->value(realvalue);
    send_data(TOPLEVEL::action::forceUpdate, PART::control::volume, realvalue, 0);}
          xywh {9 65 20 110} type {Vert Knob} box THIN_DOWN_BOX labelcolor 49 minimum 127 maximum 0 step 1
          code0 {o->value(synth->part[npart + *plgroup]->Pvolume);}
          code1 {o->setValueType(VC_PartVolume); o->useCustomTip(true);}
          code2 {o->selection_color(setSlider(o->value(),96));}
          class mwheel_slider
        }
        Fl_Dial partpanning {
          callback {//
    float realvalue;
    // must be float, otherwise fine control only goes negative!
    if (Fl::event_button() == 3)
    {
       realvalue = 64;
       o->value(realvalue);
    }
    else
        realvalue = o->value();
    o->selection_color(setKnob(realvalue,64));
    send_data(TOPLEVEL::action::forceUpdate, PART::control::panning, realvalue, 0);}
          xywh {17 180 30 30} maximum 127 step 1
          code0 {o->value(synth->part[npart + *plgroup]->Ppanning);}
          code1 {o->setValueType(VC_PanningStd);}
          code2 {o->selection_color(setKnob(o->value(),64));}
          class WidgetPDial
        }
        Fl_Choice partrcv {
          callback {//
      int tmp = o->value() & 0xf;
      o->textcolor(gen_text);

      send_data(TOPLEVEL::action::forceUpdate, PART::control::midiChannel, tmp, TOPLEVEL::type::Integer);}
          tooltip {receive from MIDI channel} xywh {8 210 50 15} down_box BORDER_BOX selection_color 64 labelsize 10 labelcolor 64 align 5 textfont 9 textsize 10 textcolor 64
          code0 {for (int i = 0; i < NUM_MIDI_CHANNELS; i++)
            {
                if (i == 9)
                    o->add("Dr10");
                else
                    o->add(string("Ch" + asString(i + 1)).c_str());
            }}
          code1 {o->value(synth->part[npart + *plgroup]->Prcvchn);}
        } {}
        Fl_Choice audiosend {
          callback {//
    send_data(TOPLEVEL::action::muteAndLoop, PART::control::audioDestination, o->value() + 1, TOPLEVEL::type::Integer);}
          tooltip {Set Audio Destination} xywh {8 229 50 15} box BORDER_BOX down_box BORDER_BOX selection_color 64 labelsize 9 labelcolor 64 textfont 9 textsize 9 textcolor 64
          code0 {o->add("Main");o->add("Part");o->add("Both");}
          code1 {if (synth->part[npart + *plgroup]->Paudiodest == 2) o->value(1); else if (synth->part[npart + *plgroup]->Paudiodest == 3) o->value(2); else o->value(0);}
        } {}
      }
      Fl_Check_Button partenabled {
        label 01
        callback {//
            send_data(TOPLEVEL::action::forceUpdate, PART::control::enable, o->value(), TOPLEVEL::type::Integer);}
        xywh {10 0 45 20} down_box DOWN_BOX selection_color 64 labeltype EMBOSSED_LABEL labelsize 15 labelcolor 64 align 24
        code0 {o->value(synth->partonoffRead(npart + *plgroup));}
        class Fl_Check_Button2
      }
    }
  }
  Function {send_data(int action, int control, float value, int type, int parameter = UNUSED)} {} {
    code {//
        type |= TOPLEVEL::type::Write;
        collect_writeData(synth, value, action, type, control, npart + *plgroup, UNUSED, UNUSED, UNUSED, parameter);} {}
  }
  Function {Panellistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
    code {//
    npart = 0;
    bankui = NULL;} {}
  }
  Function {init(int npart_, BankUI *bankui_, SynthEngine *_synth)} {} {
    code {//
    synth = _synth;
    npart=npart_;
    bankui = bankui_;
    plgroup = &synth->getGuiMaster()->panelgroup;
    make_window();
    panellistitem->show();
    end();} {}
  }
  Function {refresh()} {} {
    code {//
    int setpart = npart | *plgroup; // assumes *plgroup always power of 2

    partenabled->value(synth->partonoffRead(setpart));
    partvolume->value(synth->part[setpart]->Pvolume);
    partvolume->selection_color(setSlider(partvolume->value(),96));
    partpanning->value(synth->part[setpart]->Ppanning);
    partpanning->selection_color(setKnob(partpanning->value(),64));
    int tmpch = synth->part[setpart]->Prcvchn;

    if (tmpch < NUM_MIDI_CHANNELS)
    {
        partrcv->value(tmpch);
        int type = collect_readData(synth, 0, MAIN::control::soloType, TOPLEVEL::section::main);
        if (type == MIDI::SoloType::Row || type == MIDI::SoloType::Loop  || type == MIDI::SoloType::TwoWay)
            partrcv->textcolor(solo_select);
        else
            partrcv->textcolor(gen_text);
    }
    else
        partrcv->textcolor(midi_solo_release);

    int tmp = synth->part[setpart]->Paudiodest - 1;
    if (tmp < 0 or tmp > 3)
        tmp = 0;
    audiosend->value(tmp);
    if ((int)bankui->cbwig->value() != (setpart + 1))
        panellistitemgroup->color(FL_BACKGROUND_COLOR);
    else
        panellistitemgroup->color(panels);
    panellistitemgroup->redraw();
    string num = asString(setpart + 1);
    partenabled->copy_label(num.c_str());
    setPartLabel(setpart);
    if (synth->partonoffRead(setpart))
        panellistitemgroup->activate();
    else
        panellistitemgroup->deactivate();} {}
  }
  Function {setPartLabel(int npart)} {} {
    code {//
    int engine = findengines(npart);

    if (engine & 1)
        partadd->color(add_back);
    else
        partadd->color(bank_back_used);
    if (engine & 2)
        partsub->color(sub_back);
    else
        partsub->color(bank_back_used);
    if (engine & 4)
        partpad->color(pad_back);
    else
        partpad->color(bank_back_used);
    if (synth->part[npart | *plgroup]->PyoshiType)
        partname->labelcolor(yoshi_ins_typ);
    else
        partname->labelcolor(gen_text);
    partname->copy_label(synth->part[npart | *plgroup]->Pname.c_str());
    ;} {}
  }
  Function {findengines(int npart)} {return_type {unsigned int}
  } {
    code {//
    unsigned int engine = 0;

    for (int i = 0; i < NUM_KIT_ITEMS; ++i)
    {
        if (synth->part[npart]->kit[i].Padenabled)
            engine |= 1;
        if (synth->part[npart]->kit[i].Psubenabled)
            engine |= 2;
        if (synth->part[npart]->kit[i].Ppadenabled)
            engine |= 4;
    }
    return engine;} {}
  }
  Function {~Panellistitem()} {} {
    code {panellistitem->hide();} {}
  }
  decl {int npart;} {private local
  }
  decl {BankUI *bankui;} {private local
  }
  decl {SynthEngine *synth;} {private local
  }
  decl {int *plgroup;} {public local
  }
  Function {itemRtext(float dScale)} {} {
    code {//
    int size = int(10 * dScale);
    int size14 = int(14 * dScale);

    partEdit->labelsize(size);
    partname->labelsize(size);
    partvolume->labelsize(size14);
    partpanning->labelsize(size14);
    partrcv->labelsize(size);
       partrcv->textsize(size);
    audiosend->labelsize(size);
        audiosend->textsize(size);
    partenabled->labelsize(int(15 * dScale));} {}
  }
}
