void on_checkbuttonSpreads_toggled(GtkButton *button, struct _properties *properties)
{
  if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button)) )
  {
    g_print("Use Spreads\n");
    properties->spreads = 1;

    calc_strike_scale(properties);

    if( properties->format != CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 )
    {
      gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleStrikes),"Strike Adj Leg1");
      gtk_widget_show(properties->GtkInfo.scaleStrikes);
      gtk_widget_show(properties->GtkInfo.scaleStrikes2);
    }

    if( properties->format == CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 )
    {
      gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"StrikeLeg1");
      gtk_widget_show(properties->GtkInfo.labelStrikes);
      gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike2);
      gtk_widget_show(properties->GtkInfo.labelStrikes2);
    }

    if( strike_control[properties->strikestoogle].incrementor == 0 && properties->format != CALENDAR_CUSTOM )
    {
      gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"StrikeLeg1");
      gtk_widget_show(properties->GtkInfo.labelStrikes);
      gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes2),"StrikeLeg2");
      gtk_widget_show(properties->GtkInfo.labelStrikes2);

      gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike);
      gtk_widget_hide(properties->GtkInfo.comboboxStrikes);
      gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike2);
    }

    gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleMonths),"Month Adj Leg1");
    gtk_widget_show(properties->GtkInfo.scaleMonths);
    gtk_widget_show(properties->GtkInfo.scaleMonths2);

  } else
  {
    g_print("No Spreads\n");
    properties->spreads = 0;

    calc_strike_scale(properties);

    gtk_widget_hide(properties->GtkInfo.labelSpread);

    if( properties->format != CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 )
    {
      gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleStrikes),"Strike Adjuster");
      gtk_widget_show(properties->GtkInfo.scaleStrikes);
    }

    if( properties->format == CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes )
    {
      gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"Strike");
      gtk_widget_show(properties->GtkInfo.labelStrikes);
      gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike2);
      gtk_widget_hide(properties->GtkInfo.labelStrikes2);
    }

    gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleMonths),"Month Adjuster");
    gtk_widget_hide(properties->GtkInfo.scaleStrikes2);

    if( properties->decimalorcalendar == CALENDAR )
      gtk_widget_show(properties->GtkInfo.scaleMonths);

    gtk_widget_hide(properties->GtkInfo.scaleMonths2);

    if( strike_control[properties->strikestoogle].incrementor == 0 && properties->format != CALENDAR_CUSTOM )
    {
      gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"Strikes");
      gtk_widget_show(properties->GtkInfo.labelStrikes);

      gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes2),"Strike");

      gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike);
      gtk_widget_hide(properties->GtkInfo.scaleStrikes);
      gtk_widget_show(properties->GtkInfo.comboboxStrikes);
    }
  }

  setup_tree_view(properties);

} // void on_checkbuttonSpreads_toggled(GtkButton *button, struct _properties *properties)
Esempio n. 2
0
void on_spinbuttonPrice_value_changed(GtkSpinButton *spinbutton, struct _properties *properties)
{
  //g_print("on_spinbuttonPrice_value_changed(): ");
  properties->data.price = gtk_spin_button_get_value(spinbutton);
  calc_strike_scale(properties);
}