Exemple #1
0
static bool refresh_tip_dialog(Widget w)
{
    MString tip = get_tip_of_the_day(w, app_data.startup_tip_count);
    if (!is_tip(tip))
    {
	// Restart from first tip
	app_data.startup_tip_count = 0;
	tip = get_tip_of_the_day(w, app_data.startup_tip_count);
    }
    if (!is_tip(tip))
	return false;

    XtVaSetValues(w, XmNmessageString, tip.xmstring(), XtPointer(0));

    MString next_tip = get_tip_of_the_day(w, app_data.startup_tip_count + 1);
    MString prev_tip = get_tip_of_the_day(w, app_data.startup_tip_count - 1);

    set_sensitive(XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON),
		  is_tip(prev_tip));
    set_sensitive(XmMessageBoxGetChild(w, XmDIALOG_HELP_BUTTON),
		  is_tip(next_tip));

    string title = DDD_NAME " Tip of the Day #" + 
	itostring(app_data.startup_tip_count);
    XtVaSetValues(XtParent(w), XmNtitle, title.chars(), XtPointer(0));

    return true;
}
Exemple #2
0
void channel_section_set_patch(ChannelSection* self, int patch)
{
    int channel, lower_vel, upper_vel;

    self->patch = patch;

    if (patch < 0)
        set_sensitive(self, FALSE);
    else
    {
        set_sensitive(self, TRUE);
        channel = patch_get_channel(patch);
        lower_vel = patch_get_lower_vel(patch);
        upper_vel = patch_get_upper_vel(patch);

        block(self);
        phin_slider_button_set_value(PHIN_SLIDER_BUTTON(self->chan_sb),
                                                                channel+1);
        phin_slider_button_set_value(PHIN_SLIDER_BUTTON(self->lower_vel_sb),
                                                                lower_vel);
        phin_slider_button_set_value(PHIN_SLIDER_BUTTON(self->upper_vel_sb),
                                                                upper_vel);
        unblock(self);
    }
}
Exemple #3
0
static void reflect_file_in_region_browser(ss_watcher_reason_t reason, void *ignore)
{
  if (region_dialog)
    {
      bool file_p;
      file_p = (bool)(any_selected_sound());
      set_sensitive(mix_button, file_p);
      set_sensitive(insert_button, file_p);
    }
}
Exemple #4
0
void MidiControllerDisplay::midi_value_changed(int c, int v) {
    if (c != ctr) {
        return;
    }
    if (v >= 0) {
        set_sensitive(true);
        set_fraction(v / 127.0);
    } else {
        set_sensitive(false);
    }
}
Exemple #5
0
static gboolean region_down_arrow_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
{
  chan_info *cp;
  cp = rsp->chans[0];
  cp->sound = rsp;
  if ((cp->chan + 1) < region_chans(region_list_position_to_id(current_region)))
    {
      cp->chan++;
      set_sensitive(channel_f(cp), true);
      set_sensitive(channel_w(cp), (region_chans(region_list_position_to_id(current_region)) > (cp->chan + 1)));
      fixup_region_data(cp, cp->chan, current_region);
      region_update_graph(cp);
    }
  return(false);
}
Exemple #6
0
static gboolean region_up_arrow_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
{
  chan_info *cp;
  cp = rsp->chans[0];
  cp->sound = rsp;
  if (cp->chan > 0)
    {
      cp->chan--;
      set_sensitive(channel_f(cp), (cp->chan > 0));
      set_sensitive(channel_w(cp), true);
      fixup_region_data(cp, cp->chan, current_region);
      region_update_graph(cp);
    }
  return(false);
}
Exemple #7
0
static void EnableApplyCB(Widget, XtPointer client_data, XtPointer call_data)
{
    Widget apply = (Widget)client_data;
    XmCommandCallbackStruct *cbs = (XmCommandCallbackStruct *)call_data;

    set_sensitive(apply, cbs->length > 0);
}
// update all GUI elements according to current gig::Region informations
void DimensionManager::refreshManager() {
    set_sensitive(false);
    refTableModel->clear();
    if (allRegions()) {
        if (region) {
            _Dimensions dims;
            gig::Instrument* instr = (gig::Instrument*)region->GetParent();
            int iRegionsCount = 0;
            for (gig::Region* rgn = instr->GetFirstRegion(); rgn; rgn = instr->GetNextRegion(), ++iRegionsCount) {
                for (uint i = 0; i < rgn->Dimensions; i++) {
                    gig::dimension_def_t* dim = &rgn->pDimensionDefinitions[i];
                    dims[dim->dimension].bits.insert(dim->bits);
                    dims[dim->dimension].zones.insert(dim->zones);
                    dims[dim->dimension].usageCount++;
                }
            }
            for (_Dimensions::const_iterator it = dims.begin(); it != dims.end(); ++it) {
                Gtk::TreeModel::Row row = *(refTableModel->append());
                row[tableModel.m_type] = it->first;
                row[tableModel.m_bits] = it->second.bits;
                row[tableModel.m_zones] = it->second.zones;
                row[tableModel.m_description] = __dimDescriptionAsString(it->first);
                row[tableModel.m_usageCount] = it->second.usageCount;
                row[tableModel.m_totalRegions] = iRegionsCount;
            }
        }
    } else {
        if (region) {
            for (uint i = 0; i < region->Dimensions; i++) {
                gig::dimension_def_t* dim = &region->pDimensionDefinitions[i];
                Gtk::TreeModel::Row row = *(refTableModel->append());
                std::set<int> vBits;
                vBits.insert(dim->bits);
                row[tableModel.m_bits] = vBits;
                std::set<int> vZones;
                vZones.insert(dim->zones);
                row[tableModel.m_zones] = vZones;
                row[tableModel.m_description] = __dimDescriptionAsString(dim->dimension);
                row[tableModel.m_type] = dim->dimension;
                row[tableModel.m_usageCount] = 1;
                row[tableModel.m_totalRegions] = 1;
            }
        }
    }
    set_sensitive(region);
}
Exemple #9
0
control::control(std::auto_ptr<idata_proxy> Data) :
	m_data(Data)
{
	set_name("k3d-check-button");
	attach();

	set_sensitive(m_data.get() && m_data->writable());
}
Exemple #10
0
static void region_focus_callback(GtkWidget *w, gpointer context) /* button clicked callback */
{
  chan_info *cp;
  regrow *r = (regrow *)context;
  unhighlight_region();
  if (region_list_position_to_id(r->pos) == INVALID_REGION) return; /* needed by auto-tester */
  set_current_region(r->pos);
  cp = rsp->chans[0];
  cp->sound = rsp;
  cp->chan  = 0;
  highlight_region();
  set_sensitive(channel_f(cp), false);
  set_sensitive(channel_w(cp), (region_chans(region_list_position_to_id(current_region)) > 1));
  rsp->hdr = fixup_region_data(cp, 0, current_region);
  make_region_labels(rsp->hdr);
  region_update_graph(cp);
}
void SoundShaderPreview::update()
{
	// Clear the current treeview model
	_treeView->unset_model();

	// If the soundshader string is empty, desensitise the widgets
	set_sensitive(!_soundShader.empty());

	if (!_soundShader.empty())
	{
		// We have a sound shader, update the liststore

		// Get the list of sound files associated to this shader
		const ISoundShaderPtr& shader = GlobalSoundManager().getSoundShader(_soundShader);

		if (!shader->getName().empty())
		{
			// Create a new liststore and pack it into the treeview
			_listStore = Gtk::ListStore::create(_columns);
			_treeView->set_model(_listStore);

			// Retrieve the list of associated filenames (VFS paths)
			SoundFileList list = shader->getSoundFileList();

			for (std::size_t i = 0; i < list.size(); ++i)
			{
				Gtk::TreeModel::iterator iter = _listStore->append();
				Gtk::TreeModel::Row row = *iter;

				row[_columns.shader] = list[i];

				// Pre-select the first sound file, for the user's convenience
				if (i == 0)
				{
					_selection->select(iter);
				}
			}
		}
		else
		{
			// Not a valid soundshader, switch to inactive
			set_sensitive(false);
		}
	}
}
Exemple #12
0
control::control(std::auto_ptr<idata_proxy> Data, const Glib::ustring& label, bool mnemonic) :
	base(label, mnemonic),
	m_data(Data)
{
	set_name("k3d-check-button");
	attach();

	set_sensitive(m_data.get() && m_data->writable());
}
Exemple #13
0
// Make window popup
void GUI::popupwindow() {

	// Make window popup
	popup.set_values( this, &classtree, &error );
	int x, y;
	get_position( x, y );
	popup.move( x + 15, y + 50 );
	set_sensitive( false );
	popup.show();
}
static void
set_enable_screen_part_ui (GtkWidget *widget, ZoomOptionsPrivate *priv)
{
    gboolean screen_part;

    /* If the "screen part" radio is not checked, then the "follow mouse" radio
     * is checked (== lens mode). Set mouse tracking back to the default.
     */
    screen_part = get_active (priv->screen_part_radio);
    if (!screen_part)
      {
        g_settings_set_string (priv->settings,
                               "mouse-tracking", "proportional");
      }

    set_sensitive (priv->centered_radio, screen_part);
    set_sensitive (priv->push_radio, screen_part);
    set_sensitive (priv->proportional_radio, screen_part);
    set_sensitive (priv->extend_beyond_checkbox, screen_part);
}
Exemple #15
0
void update_region_browser(bool grf_too)
{
  int i, len;
  region_state *rs;
  rs = region_report();
  len = rs->len;
  for (i = 0; i < len; i++) 
    {
      regrow *r;
      r = region_row(i);
      set_button_label(r->nm, rs->name[i]);
      set_toggle_button(r->pl, false, false, (void *)r);
      gtk_widget_show(r->rw);
    }
  for (i = len; i < max_regions(ss); i++) 
    if (region_rows[i])
      gtk_widget_hide(region_rows[i]->rw);
  free_region_state(rs);
  if (len == 0) return;
  gtk_widget_show(region_list);
  if (grf_too)
    {
      chan_info *cp;
      unhighlight_region();
      set_current_region(0);
      highlight_region();
      goto_window(region_rows[0]->nm);
      cp = rsp->chans[0];
      if (cp) 
	{
	  cp->sound = rsp;
	  cp->chan = 0;
	  set_sensitive(channel_f(cp), false);
	  set_sensitive(channel_w(cp), (region_chans(region_list_position_to_id(0)) > 1));
	  rsp->hdr = fixup_region_data(cp, 0, 0);
	  make_region_labels(rsp->hdr);
	  region_update_graph(cp);
	}
    }
}
Exemple #16
0
void
RegisteredRandom::on_value_changed()
{
    if (setProgrammatically) {
        setProgrammatically = false;
        return;
    }

    if (_wr->isUpdating()) {
        return;
    }
    _wr->setUpdating (true);

    Inkscape::SVGOStringStream os;
    os << getValue() << ';' << getStartSeed();

    set_sensitive(false);
    write_to_xml(os.str().c_str());
    set_sensitive(true);

    _wr->setUpdating (false);
}
Exemple #17
0
void LayerWindow::currentModelChanged(Model * model)
{
    if (model == m_currentModel) {
        return;
    }

    if (m_currentModel != NULL) {
        m_updateSignal.disconnect();
    }

    m_currentModel = model;
    m_treeModel->clear();

    if (m_currentModel == NULL) {
        set_sensitive(false);
        return;
    }

    m_updateSignal = m_currentModel->layersChanged.connect(sigc::mem_fun(*this, &LayerWindow::layersChanged));
    layersChanged();

    set_sensitive(true);
}
Exemple #18
0
void
RegisteredText::on_activate()
{
    if (setProgrammatically) {
        setProgrammatically = false;
        return;
    }

    if (_wr->isUpdating()) {
        return;
    }
    _wr->setUpdating (true);

    Inkscape::SVGOStringStream os;
    os << getText();

    set_sensitive(false);
    write_to_xml(os.str().c_str());
    set_sensitive(true);

    setText(os.str().c_str());

    _wr->setUpdating (false);
}
Exemple #19
0
static void update_recent_menu(const MMDesc *items)
{
    StringArray recent_files;
    {
	StringArray r;
	get_recent(r);
	for (int i = 0; i < r.size() && items[i].widget != 0; i++)
	    recent_files += r[i];
    }

    // Uniquify labels
    char sep = '/';
    if (gdb->type() == JDB)
	sep = '.';

    StringArray labels;
    uniquify(recent_files, labels, sep);

    // Set labels
    int i;
    for (i = 0; i < labels.size(); i++)
    {
	MString label(itostring(i + 1) + " ");
	label += tt(labels[i]);

	Widget w = items[i].widget;
	set_label(w, label);

	const string& file = recent_files[i];

	bool sens = true;
	if (!remote_gdb())
	{
	    if (gdb->has_exec_files() && !is_debuggee_file(file))
		sens = false;	// File not accessible
	    else if (!gdb->has_classes() && !is_regular_file(file))
		sens = false;	// File not accessible
	}

	set_sensitive(w, sens);
	XtManageChild(w);
    }

    // Unmanage remaining items
    for (; items[i].widget != 0; i++)
	XtUnmanageChild(items[i].widget);
}
Exemple #20
0
static void PlotCommandCB(Widget, XtPointer client_data, XtPointer)
{
    PlotWindowInfo *plot = (PlotWindowInfo *)client_data;

    if (plot->command_dialog == 0)
    {
	Arg args[10];
	Cardinal arg = 0;
	Widget dialog = 
	    verify(XmCreatePromptDialog(plot->shell,
					XMST("plot_command_dialog"),
					args, arg));
	Delay::register_shell(dialog);
	plot->command_dialog = dialog;

	Widget apply = XmSelectionBoxGetChild(dialog, XmDIALOG_APPLY_BUTTON);
	XtManageChild(apply);
    
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_OK_BUTTON));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_SELECTION_LABEL));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, XmDIALOG_TEXT));

	XtAddCallback(dialog, XmNapplyCallback,
		      ApplyPlotCommandCB, XtPointer(client_data));
	XtAddCallback(dialog, XmNhelpCallback,
		      ImmediateHelpCB, XtPointer(client_data));

	arg = 0;
	Widget command = 
	    verify(XmCreateCommand(dialog, XMST("plot_command"), args, arg));
	plot->command = command;
	XtManageChild(command);

	XtAddCallback(command, XmNcommandEnteredCallback, 
		      DoPlotCommandCB, XtPointer(client_data));
	XtAddCallback(command, XmNcommandChangedCallback, 
		      EnableApplyCB, XtPointer(apply));
	set_sensitive(apply, false);
    }

    manage_and_raise(plot->command_dialog);
}
Exemple #21
0
void ofxGtkSwitch::set(ofParameter<bool> &p){
	param.makeReferenceTo(p);
	if(p.isReadOnly())
		set_sensitive(false);

	listener.unsubscribe();

	update();

	listener = param.newListener([&](const bool& b){
		set_state(param);
	});

	if(!con){
		con = connect_property_changed_with_return("state", [&](){
			param.set(get_state());
		});
	}
}
void AIVocalSetPreview::update()
{
	_setShaders.clear();

	if (_vocalSetDef != NULL)
	{
        eclass::AttributeList sndAttrs = eclass::getSpawnargsWithPrefix(
            *_vocalSetDef, "snd_"
        );

		for (eclass::AttributeList::const_iterator i = sndAttrs.begin();
			i != sndAttrs.end(); ++i)
		{
			_setShaders.push_back(i->getValue());
		}
	}

	// If the soundshader string is empty, desensitise the widgets
	set_sensitive(_vocalSetDef != NULL && !_setShaders.empty());
}
Exemple #23
0
void LayerWindow::modelAdded(Model * model)
{
    std::cout << "Got add model" << std::endl << std::flush;
    Gtk::Menu * menu = m_modelMenu->get_menu();
    bool newMenu = false;

    if (menu == NULL) {
        newMenu = true;
        menu = manage( new Gtk::Menu() );
        m_modelMenu->set_menu(*menu);
        set_sensitive(true);
    }
    
    Gtk::Menu_Helpers::MenuList& model_menu = menu->items();
    std::stringstream ident;
    ident << model->getName() << "-" << model->getModelNo();
    model_menu.push_back(Gtk::Menu_Helpers::MenuElem(ident.str(), sigc::bind<Model*>(sigc::mem_fun(*this, &LayerWindow::currentModelChanged),model)));
    if (newMenu) {
        m_modelMenu->set_history(0);
        currentModelChanged(model);
    }
}
Exemple #24
0
void midi_section_set_patch(MidiSection* self, int patch)
{
    MidiSectionPrivate* p = MIDI_SECTION_GET_PRIVATE(self);
    int note;
    int lower;
    int upper;

    p->patch = patch;

    if (patch < 0)
    {
        set_sensitive(p, FALSE);
        gnome_canvas_item_hide(p->note);
        gnome_canvas_item_hide(p->range);

        if (p->ignore)
            p->ignore = FALSE;
        else
            gtk_adjustment_set_value(p->adj,
                (0.5 * gtk_adjustment_get_upper(p->adj)
                    - gtk_adjustment_get_page_size(p->adj) / 2));
    }
    else
    {

        set_sensitive(p, TRUE);

        note =  patch_get_root_note(patch);
        lower = patch_get_lower_note(patch);
        upper = patch_get_upper_note(patch);

        block(p);

        gnome_canvas_item_set(p->note, "x1",
                (gdouble)(note * PHIN_KEYBOARD_KEY_WIDTH - 1), NULL);
        gnome_canvas_item_set(p->note, "x2",
                (gdouble)(note * PHIN_KEYBOARD_KEY_WIDTH
                               + PHIN_KEYBOARD_KEY_WIDTH - 1), NULL);
        gnome_canvas_item_show(p->note);

        gnome_canvas_item_set(p->range, "x1",
                (gdouble) (lower * PHIN_KEYBOARD_KEY_WIDTH - 1), NULL);
        gnome_canvas_item_set(p->range, "x2",
                (gdouble) (upper * PHIN_KEYBOARD_KEY_WIDTH
                                 + PHIN_KEYBOARD_KEY_WIDTH - 1), NULL);
        if (lower != upper)
            gnome_canvas_item_show(p->range);
        else
            gnome_canvas_item_hide(p->range);

        /* scroll the keyboard to show the root note */
        if (p->ignore)
            p->ignore = FALSE;
        else
            gtk_adjustment_set_value(p->adj,
                ((note + 1.0) / MIDI_NOTES)
                    * gtk_adjustment_get_upper(p->adj)
                    - gtk_adjustment_get_page_size(p->adj) / 2);

        unblock(p);
    }
}
void DimRegionEdit::set_dim_region(gig::DimensionRegion* d)
{
    dimregion = d;

    set_sensitive(d);
    if (!d) return;

    update_model++;
    eEG1PreAttack.set_value(d->EG1PreAttack);
    eEG1Attack.set_value(d->EG1Attack);
    eEG1Decay1.set_value(d->EG1Decay1);
    eEG1Decay2.set_value(d->EG1Decay2);
    eEG1InfiniteSustain.set_value(d->EG1InfiniteSustain);
    eEG1Sustain.set_value(d->EG1Sustain);
    eEG1Release.set_value(d->EG1Release);
    eEG1Hold.set_value(d->EG1Hold);
    eEG1Controller.set_value(d->EG1Controller);
    eEG1ControllerInvert.set_value(d->EG1ControllerInvert);
    eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
    eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
    eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
    eLFO1Frequency.set_value(d->LFO1Frequency);
    eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
    eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
    eLFO1Controller.set_value(d->LFO1Controller);
    eLFO1FlipPhase.set_value(d->LFO1FlipPhase);
    eLFO1Sync.set_value(d->LFO1Sync);
    eEG2PreAttack.set_value(d->EG2PreAttack);
    eEG2Attack.set_value(d->EG2Attack);
    eEG2Decay1.set_value(d->EG2Decay1);
    eEG2Decay2.set_value(d->EG2Decay2);
    eEG2InfiniteSustain.set_value(d->EG2InfiniteSustain);
    eEG2Sustain.set_value(d->EG2Sustain);
    eEG2Release.set_value(d->EG2Release);
    eEG2Controller.set_value(d->EG2Controller);
    eEG2ControllerInvert.set_value(d->EG2ControllerInvert);
    eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
    eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
    eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
    eLFO2Frequency.set_value(d->LFO2Frequency);
    eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
    eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
    eLFO2Controller.set_value(d->LFO2Controller);
    eLFO2FlipPhase.set_value(d->LFO2FlipPhase);
    eLFO2Sync.set_value(d->LFO2Sync);
    eEG3Attack.set_value(d->EG3Attack);
    eEG3Depth.set_value(d->EG3Depth);
    eLFO3Frequency.set_value(d->LFO3Frequency);
    eLFO3InternalDepth.set_value(d->LFO3InternalDepth);
    eLFO3ControlDepth.set_value(d->LFO3ControlDepth);
    eLFO3Controller.set_value(d->LFO3Controller);
    eLFO3Sync.set_value(d->LFO3Sync);
    eVCFEnabled.set_value(d->VCFEnabled);
    eVCFType.set_value(d->VCFType);
    eVCFCutoffController.set_value(d->VCFCutoffController);
    eVCFCutoffControllerInvert.set_value(d->VCFCutoffControllerInvert);
    eVCFCutoff.set_value(d->VCFCutoff);
    eVCFVelocityCurve.set_value(d->VCFVelocityCurve);
    eVCFVelocityScale.set_value(d->VCFVelocityScale);
    eVCFVelocityDynamicRange.set_value(d->VCFVelocityDynamicRange);
    eVCFResonance.set_value(d->VCFResonance);
    eVCFResonanceDynamic.set_value(d->VCFResonanceDynamic);
    eVCFResonanceController.set_value(d->VCFResonanceController);
    eVCFKeyboardTracking.set_value(d->VCFKeyboardTracking);
    eVCFKeyboardTrackingBreakpoint.set_value(d->VCFKeyboardTrackingBreakpoint);
    eVelocityResponseCurve.set_value(d->VelocityResponseCurve);
    eVelocityResponseDepth.set_value(d->VelocityResponseDepth);
    eVelocityResponseCurveScaling.set_value(d->VelocityResponseCurveScaling);
    eReleaseVelocityResponseCurve.set_value(d->ReleaseVelocityResponseCurve);
    eReleaseVelocityResponseDepth.set_value(d->ReleaseVelocityResponseDepth);
    eReleaseTriggerDecay.set_value(d->ReleaseTriggerDecay);
    eCrossfade_in_start.set_value(d->Crossfade.in_start);
    eCrossfade_in_end.set_value(d->Crossfade.in_end);
    eCrossfade_out_start.set_value(d->Crossfade.out_start);
    eCrossfade_out_end.set_value(d->Crossfade.out_end);
    ePitchTrack.set_value(d->PitchTrack);
    eDimensionBypass.set_value(d->DimensionBypass);
    ePan.set_value(d->Pan);
    eSelfMask.set_value(d->SelfMask);
    eAttenuationController.set_value(d->AttenuationController);
    eInvertAttenuationController.set_value(d->InvertAttenuationController);
    eAttenuationControllerThreshold.set_value(d->AttenuationControllerThreshold);
    eChannelOffset.set_value(d->ChannelOffset);
    eSustainDefeat.set_value(d->SustainDefeat);
    eMSDecode.set_value(d->MSDecode);
    eSampleStartOffset.set_value(d->SampleStartOffset);
    eUnityNote.set_value(d->UnityNote);
    eFineTune.set_value(d->FineTune);
    eGain.set_value(d->Gain);
    eGainPlus6.set_value(d->Gain);
    eSampleLoopEnabled.set_value(d->SampleLoops);
    eSampleLoopType.set_value(
        d->SampleLoops ? d->pSampleLoops[0].LoopType : 0);
    eSampleLoopStart.set_value(
        d->SampleLoops ? d->pSampleLoops[0].LoopStart : 0);
    eSampleLoopLength.set_value(
        d->SampleLoops ? d->pSampleLoops[0].LoopLength : 0);
    eSampleLoopInfinite.set_value(
        d->pSample && d->pSample->LoopPlayCount == 0);
    eSampleLoopPlayCount.set_value(
        d->pSample ? d->pSample->LoopPlayCount : 0);
    update_model--;

    wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL");

    update_loop_elements();
    VCFEnabled_toggled();
}
Exemple #26
0
LayerWindow::LayerWindow(MainWindow & mw) : OptionBox("Layers"),
                                            m_currentModel(0)
{
    // destroy.connect(slot(this, &LayerWindow::destroy_handler));
    // Gtk::VBox * vbox = manage( new Gtk::VBox(false, 2) );
    Gtk::VBox * vbox = this;

    Gtk::HBox * tophbox = manage( new Gtk::HBox() );

    tophbox->pack_start(*(manage( new Gtk::Label("Model:") )), Gtk::PACK_SHRINK, 2);
    m_modelMenu = manage( new Gtk::OptionMenu() );

    tophbox->pack_start(*m_modelMenu, Gtk::PACK_EXPAND_WIDGET, 2);
    tophbox->pack_start(*(manage( new Gtk::Label("WOOT") ) ), Gtk::PACK_SHRINK, 2);
   
    vbox->pack_start(*tophbox, Gtk::PACK_SHRINK, 2);
    
    m_columns = new Gtk::TreeModelColumnRecord();
    m_visColumn = new Gtk::TreeModelColumn<bool>();
    m_typeColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_nameColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_ptrColumn = new Gtk::TreeModelColumn<Layer*>();
    m_columns->add(*m_visColumn);
    m_columns->add(*m_typeColumn);
    m_columns->add(*m_nameColumn);
    m_columns->add(*m_ptrColumn);

    m_treeModel = Gtk::ListStore::create(*m_columns);

    m_treeView = manage( new Gtk::TreeView() );

    m_treeView->set_model( m_treeModel );

    Gtk::CellRendererToggle * crt = manage( new Gtk::CellRendererToggle() );
    crt->signal_toggled().connect( sigc::mem_fun(*this, &LayerWindow::visibleToggled) );
    int column_no = m_treeView->append_column("Visible", *crt);
    Gtk::TreeViewColumn * column = m_treeView->get_column(column_no - 1);
    column->add_attribute(crt->property_active(), *m_visColumn);
    column->set_clickable();

    m_treeView->append_column("Type", *m_typeColumn);
    m_treeView->append_column("Name", *m_nameColumn);

    m_refTreeSelection = m_treeView->get_selection();
    m_refTreeSelection->set_mode(Gtk::SELECTION_SINGLE);
    m_refTreeSelection->signal_changed().connect( sigc::mem_fun(*this, &LayerWindow::selectionChanged) );

    vbox->pack_start(*manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK);

    Gtk::ScrolledWindow *scrolled_window = manage(new Gtk::ScrolledWindow());
    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
    scrolled_window->set_size_request(250,150);
    scrolled_window->add(*m_treeView);

    vbox->pack_start(*scrolled_window);

    Gtk::HBox * bothbox = manage( new Gtk::HBox() );
    Gtk::Button * b = manage( new Gtk::Button() );


    Glib::RefPtr<Gdk::Bitmap> pixmask;
    Glib::RefPtr<Gdk::Pixmap> p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, newlayer_xpm);
    b->add_pixmap(p, pixmask);

    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::newLayerRequested));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, raise_xpm);
    b->add_pixmap(p, pixmask);
    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::raiseLayer));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, lower_xpm);
    b->add_pixmap(p, pixmask);
    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::lowerLayer));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, duplicate_xpm);
    b->add_pixmap(p, pixmask);
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, delete_xpm);
    b->add_pixmap(p, pixmask);
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    vbox->pack_start(*bothbox, Gtk::PACK_SHRINK, 6);

    // add(*vbox);
    // set_title("Layers");
    set_sensitive(false);

    // FIXME Organise the xpms
    //m_eye = gdk_pixmap_create_from_xpm_d(m_clist->gtkobj()->clist_window,
            //&m_eyemask, &GTK_WIDGET(m_clist->gtkobj())->style->white, eye_xpm);

    //m_null = gdk_pixmap_create_from_xpm_d(m_clist->gtkobj()->clist_window,
           //&m_nullmask, &GTK_WIDGET(m_clist->gtkobj())->style->white, null_xpm);

    m_newLayerWindow = new NewLayerWindow();
    // show_all();

    mw.modelAdded.connect(sigc::mem_fun(*this, &LayerWindow::modelAdded));
    mw.currentModelChanged.connect(sigc::mem_fun(*this, &LayerWindow::currentModelChanged));

    signal_delete_event().connect(sigc::mem_fun(*this, &LayerWindow::deleteEvent));
}
Exemple #27
0
void deactivate (void)
{
  set_sensitive_dep(FALSE, FALSE, FALSE, FALSE, FALSE);
  set_sensitive();
}
Exemple #28
0
void
on_ok_fileselection_clicked(GtkWidget *file, GtkFileSelection *fs)
{
  int fd, i, size;
  char *cmd, buf[MAX_BUF];
#ifdef DEBUG  
  GtkWidget *error_dialog = NULL;
#endif

  size = strlen(exec_path) + strlen(" -c ") + strlen(gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs))) + 1;
  cmd = (char *) malloc (size*sizeof(char));
  strcpy (cmd, exec_path);
  strcat (cmd, " -c ");
  strcat (cmd, gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));

  for(i = 0; i < MAX_PID; i++) {   
  	if(table[i].process == NULL) {
		cur_pid = i;
		break;
	}
  }	

  runPeos(cmd);
  free(cmd);
  cmd = NULL;

  fd = open ("message", O_RDONLY);
  if(fd < 0) {
  	perror("An error has occurred when attempting to open 'message' \n");
	exit(1);
  }
  read (fd, buf, MAX_BUF);
  close (fd);

#ifdef DEBUG
  if (strncmp ("Executing", buf, 9) != 0) {
	error_dialog = create_errordialog();
  	gtk_widget_show (error_dialog);
  } else {
#endif

  gtk_widget_destroy (notebook);
  freeAll_extra();

  notebook = create_notebook();
  gtk_widget_set_name (notebook, "notebook");
  gtk_widget_ref (notebook);
  gtk_object_set_data_full (GTK_OBJECT (Peos), "notebook", notebook,
                            (GtkDestroyNotify) gtk_widget_unref);
  set_selection(1);	/* with current action selected */
  gtk_widget_show (notebook);
  gtk_container_add (GTK_CONTAINER (vbox), notebook);

  redisplay_menu();
  check_state();
  
}

void check_state(void)
{
  char *state;
  if ( table[cur_pid].page.curr != NULL && strcmp (table[cur_pid].page.curr->name , "action") == 0) {
	state = xmlGetProp(table[cur_pid].page.curr, "state");
	if ( strcmp(state, "NONE") == 0) {
		set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);

	} else if ( strcmp(state, "BLOCKED") == 0) {
		set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);

	} else if ( strcmp(state, "RUN") == 0) {
		set_sensitive_dep(FALSE, TRUE, TRUE, TRUE, NULL);

	} else if ( strcmp(state, "SUSPEND") == 0) {
		set_sensitive_dep(TRUE, TRUE, FALSE, TRUE, NULL);

	} else if ( strcmp(state, "DONE") == 0) {
		set_sensitive_dep(TRUE, FALSE, FALSE, FALSE, NULL);

	} else if ( strcmp(state, "READY") == 0) {
		set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);

	} else if ( strcmp(state, "AVAILABLE") == 0) {
		set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);

	} else if ( strcmp(state, "PENDING") == 0) {
		set_sensitive_dep(TRUE, TRUE, FALSE, FALSE, NULL);

	} 
  	if (GTK_IS_WIDGET (table[cur_pid].page.Start)) gtk_widget_destroy (table[cur_pid].page.Start);
  	table[cur_pid].page.Start = start_label(state);
  } else {
	set_sensitive_dep(FALSE, FALSE, FALSE, FALSE, FALSE);

  	if (GTK_IS_WIDGET (table[cur_pid].page.Start)) gtk_widget_destroy (table[cur_pid].page.Start);
  	table[cur_pid].page.Start = start_label("Start");
  }
  gtk_widget_ref (table[cur_pid].page.Start);
  gtk_object_set_data_full (GTK_OBJECT (Peos), "Start", table[cur_pid].page.Start,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table[cur_pid].page.Start);
  gtk_fixed_put (GTK_FIXED (table[cur_pid].page.fixed), table[cur_pid].page.Start, 16, 8);
  gtk_widget_set_uposition (table[cur_pid].page.Start, 16, 8);
  gtk_widget_set_usize (table[cur_pid].page.Start, 55, 22);
  gtk_signal_connect (GTK_OBJECT (table[cur_pid].page.Start), "clicked",
                      GTK_SIGNAL_FUNC (on_Start_clicked),
                      NULL);
  set_sensitive();
}
Exemple #29
0
void set_buttons_from_gdb(Widget buttons, string& text)
{
    bool yn = gdb->ends_with_yn(text);

    if (yn)
    {
	if (!gdb_asks_yn)
	    annotate("query");

	gdb_asks_yn = true;
    }
    else if (gdb->isReadyWithPrompt())
    {
	if (gdb_asks_yn)
	    annotate("post-query");

	gdb_asks_yn = false;
	unpost_gdb_yn();
    }

    if (yn && !gdb_keyboard_command)
    {
	// Fetch previous output lines, in case this is a multi-line message.
	String s = XmTextGetString(gdb_w);
	string prompt(s);
	XtFree(s);

	// FIXME: Handle JDB
	char prompt_start = (gdb->type() == XDB ? '>' : '(');

	int pos = prompt.index(prompt_start, -1);
	if (pos >= 0)
	    pos = prompt.index('\n', pos) + 1;
	if (pos == 0)
	    pos = messagePosition;

	XmTextReplace(gdb_w, pos, XmTextGetLastPosition(gdb_w), XMST(""));
	promptPosition = pos;

	prompt = prompt.from(pos);
	if (text.contains('('))
	    prompt += text.before('(', -1); // Don't repeat `(y or n)'
	else
	    prompt += text;

	post_gdb_yn(prompt);
	text = "";
	return;
    }

    if (buttons == 0)
	return;

    static bool last_yn = false;
    if (yn == last_yn)
	return;

    last_yn = yn;

    if (XtIsComposite(buttons))
    {
	set_sensitive(buttons, false);

	WidgetList children   = 0;
	Cardinal num_children = 0;

	XtVaGetValues(buttons,
		      XmNchildren, &children,
		      XmNnumChildren, &num_children,
		      XtPointer(0));

	int i;
	for (i = 0; i < int(num_children); i++)
	    XtManageChild(children[i]);
	for (i = 0; i < int(num_children); i++)
	{
	
	    Widget w = children[i];
	    string name = XtName(w);

	    if (yn == (name == "Yes" || name == "No"))
		XtManageChild(w);
	    else
		XtUnmanageChild(w);
	}

	set_sensitive(buttons, true);
    }
}
Exemple #30
0
static void configure_plot(PlotWindowInfo *plot)
{
    if (plot->plotter == 0)
	return;

    int ndim = plot->plotter->dimensions();

    // Set up plot menu
    int i;
    for (i = 0; plot_menu[i].name != 0; i++)
    {
	if ((plot_menu[i].type & MMTypeMask) != MMToggle)
	    continue;

	string name = plot_menu[i].name;

	const string s1 = "*" + name;
	Widget w = XtNameToWidget(plot->shell, s1.chars());

	if (name.contains("2d", -1))
	    XtSetSensitive(w, ndim == 2);
	else if (name.contains("3d", -1))
	    XtSetSensitive(w, ndim >= 3);
	else
	    XtSetSensitive(w, ndim >= 2);
    }

    // Log scale is available only iff all values are non-negative
    Widget logscale = XtNameToWidget(plot->shell, "*logscale");
    XtSetSensitive(logscale, plot->plotter->min_v() >= 0.0);

    // Axes can be toggled in 2d mode only
    Widget xzeroaxis = XtNameToWidget(plot->shell, "*xzeroaxis");
    Widget yzeroaxis = XtNameToWidget(plot->shell, "*yzeroaxis");
    XtSetSensitive(xzeroaxis, ndim <= 2);
    XtSetSensitive(yzeroaxis, ndim <= 2);

    // Z Tics are available in 3d mode only
    Widget ztics = XtNameToWidget(plot->shell, "*ztics");
    XtSetSensitive(ztics, ndim >= 3);

    // Contour drawing is available in 3d mode only
    Widget base    = XtNameToWidget(plot->shell, "*base");
    Widget surface = XtNameToWidget(plot->shell, "*surface");
    XtSetSensitive(base,    ndim >= 3);
    XtSetSensitive(surface, ndim >= 3);

    // Set scrollbars
    manage_child(plot->hsb, ndim >= 3);
    manage_child(plot->vsb, ndim >= 3);

    // Check if we can export something
    bool have_source = false;
    bool can_export  = false;
    const StringArray& sources = plot->plotter->data_files();
    for (i = 0; i < sources.size(); i++)
    {
	if (!sources[i].empty())
	{
	    if (have_source)
		can_export  = false; // Multiple source files
	    else
		can_export = have_source = true;
	}
    }

    Widget export_w = XtNameToWidget(plot->shell, "*export");
    set_sensitive(export_w, can_export);

    // The remainder requires settings
    if (plot->settings.empty())
    {
	// No settings yet
	if (plot->settings_timer == 0)
	{
	    plot->settings_delay = 
		new StatusDelay("Retrieving Plot Settings");

	    // Save settings...
	    plot->settings_file = tempfile();
	    string cmd = "save " + quote(plot->settings_file) + "\n";
	    send(plot, cmd);

	    // ...and try again in 250ms
	    plot->settings_timer = 
		XtAppAddTimeOut(XtWidgetToApplicationContext(plot->shell), 250,
				GetPlotSettingsCB, XtPointer(plot));

	    // Set initial scrollbar defaults
	    XtVaSetValues(plot->vsb, XmNvalue, 60, XtPointer(0));
	    XtVaSetValues(plot->hsb, XmNvalue, 30, XtPointer(0));
	}

	return;
    }

    configure_options(plot, view_menu,    plot->settings);
    configure_options(plot, contour_menu, plot->settings);
    configure_options(plot, scale_menu,   plot->settings);

    // Get style
    for (i = 0; plot_menu[i].name != 0; i++)
    {
	if ((plot_menu[i].type & MMTypeMask) != MMToggle)
	    continue;

	string name = plot_menu[i].name;

	const string s1 = "*" + name;
	Widget w = XtNameToWidget(plot->shell, s1.chars());

	bool set = plot->settings.contains("\nset data style " + name + "\n");
	XmToggleButtonSetState(w, set, False);
    }

    // Get position
    int rot_x = 60;
    int rot_z = 30;

    int view_index = plot->settings.index("set view ");
    if (view_index >= 0)
    {
	// `set view <rot_x> {,{<rot_z>}{,{<scale>}{,<scale_z>}}}'
	string view_setting = plot->settings.after("set view ");
	rot_x = atoi(view_setting.chars());
	view_setting = view_setting.after(", ");
	rot_z = atoi(view_setting.chars());
    }

    XtVaSetValues(plot->vsb, XmNvalue, rot_x, XtPointer(0));
    XtVaSetValues(plot->hsb, XmNvalue, rot_z, XtPointer(0));
}