- guint32 i = 0;
- guint32 x = 0;
- Frame* frame;
- Frame* bt_frame;
- VBox* box;
- int output_row, output_col;
- int button_row, button_col;
- int output_rows, output_cols;
- int button_rows, button_cols;
- guint32 n_ins=0, n_outs = 0;
-
- prefheight = 30;
- hpacker.set_spacing (10);
-
- output_rows = initial_output_rows;
- output_cols = initial_output_cols;
- button_rows = initial_button_rows;
- button_cols = initial_button_cols;
- output_row = 0;
- button_row = 0;
- output_col = 0;
- button_col = 0;
-
- button_table.set_homogeneous (false);
- button_table.set_row_spacings (2);
- button_table.set_col_spacings (2);
- output_table.set_homogeneous (true);
- output_table.set_row_spacings (2);
- output_table.set_col_spacings (2);
- button_table.set_border_width (5);
- output_table.set_border_width (5);
-
- hpacker.set_border_width (10);
-
- bt_frame = manage (new Frame);
- bt_frame->set_name ("BaseFrame");
- bt_frame->add (button_table);
- hpacker.pack_start(*bt_frame, true, true);
-
- box = manage (new VBox);
- box->set_border_width (5);
- box->set_spacing (1);
-
- frame = manage (new Frame);
- frame->set_name ("BaseFrame");
- frame->set_label (_("Controls"));
- frame->add (*box);
- hpacker.pack_start(*frame, true, true);
-
- /* find all ports. build control elements for all appropriate control ports */
-
- for (i = 0; i < plugin.parameter_count(); ++i) {
-
- if (plugin.parameter_is_control (i)) {
-
- /* Don't show latency control ports */
-
- if (plugin.describe_parameter (i) == X_("latency")) {
- continue;
- }
-
- ControlUI* cui;
-
- /* if we are scrollable, just use one long column */
-
- if (!is_scrollable) {
- if (x++ > 7){
- frame = manage (new Frame);
- frame->set_name ("BaseFrame");
- box = manage (new VBox);
-
- box->set_border_width (5);
- box->set_spacing (1);
-
- frame->add (*box);
- hpacker.pack_start(*frame,true,true);
-
- x = 0;
- }
- }
-
- if ((cui = build_control_ui (engine, i, plugin.get_nth_midi_control (i))) == 0) {
- error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg;
- continue;
- }
-
- if (cui->control || cui->clickbox || cui->combo) {
-
- box->pack_start (*cui, false, false);
-
- } else if (cui->button) {
-
- if (button_row == button_rows) {
- button_row = 0;
- if (++button_col == button_cols) {
- button_cols += 2;
- button_table.resize (button_rows, button_cols);
- }
- }
-
- button_table.attach (*cui, button_col, button_col + 1, button_row, button_row+1,
- FILL|EXPAND, FILL);
- button_row++;
-
- } else if (cui->display) {
-
- output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1,
- FILL|EXPAND, FILL);
-
- // TODO: The meters should be divided into multiple rows
-
- if (++output_col == output_cols) {
- output_cols ++;
- output_table.resize (output_rows, output_cols);
- }
-
- /* old code, which divides meters into
- * columns first, rows later. New code divides into one row
-
- if (output_row == output_rows) {
- output_row = 0;
- if (++output_col == output_cols) {
- output_cols += 2;
- output_table.resize (output_rows, output_cols);
- }
- }
-
- output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1,
- FILL|EXPAND, FILL);
-
- output_row++;
- */
- }
-
- /* HACK: ideally the preferred height would be queried from
- the complete hpacker, but I can't seem to get that
- information in time, so this is an estimation
- */
-
- prefheight += 30;
-
- }
- }
-
- n_ins = plugin.get_info().n_inputs;
- n_outs = plugin.get_info().n_outputs;
-
- if (box->children().empty()) {
- hpacker.remove (*frame);
- }
-
- if (button_table.children().empty()) {
- hpacker.remove (*bt_frame);
- }
-
- if (!output_table.children().empty()) {
- frame = manage (new Frame);
- frame->set_name ("BaseFrame");
- frame->add (output_table);
- hpacker.pack_end (*frame, true, true);
- }
-
- output_update ();