Esempio n. 1
0
Etk_Bool
_state_AspectSpinner_value_changed_cb(Etk_Range *range, double value, void *data)
{
   printf("Value Changed Signal on AspectMinSpinner EMITTED\n");
   edje_edit_state_aspect_min_set(edje_o, Cur.part->string, Cur.state->string,
                           etk_range_value_get(ETK_RANGE(UI_AspectMinSpinner)));
   edje_edit_state_aspect_max_set(edje_o, Cur.part->string, Cur.state->string,
                           etk_range_value_get(ETK_RANGE(UI_AspectMaxSpinner)));
   return ETK_TRUE;
}
Esempio n. 2
0
/* Called when the step-increment of the spinner is changed:
 * We correct the value if the "snap-to-ticks" setting is on */
static void _etk_spinner_step_increment_changed_cb(Etk_Object *object, const char *property_name, void *data)
{
   Etk_Spinner *spinner;
   double value;

   if (!(spinner = ETK_SPINNER(object)))
      return;

   if (spinner->snap_to_ticks)
   {
      value = etk_range_value_get(ETK_RANGE(spinner));
      value = _etk_spinner_value_snap(spinner, value);
      etk_range_value_set(ETK_RANGE(spinner), value);
   }
}
Esempio n. 3
0
/* Initializes the default values of the spinner */
static void _etk_spinner_constructor(Etk_Spinner *spinner)
{
   if (!spinner)
      return;

   spinner->digits = 0;
   strcpy(spinner->value_format, "%.0f");
   spinner->snap_to_ticks = ETK_FALSE;
   spinner->wrap = ETK_FALSE;
   spinner->step_timer = NULL;
   spinner->successive_steps = 0;
   spinner->editable_object = NULL;
   spinner->selection_dragging = ETK_FALSE;

   ETK_RANGE(spinner)->value_changed_handler = _etk_spinner_value_changed_handler;
   ETK_WIDGET(spinner)->size_allocate = _etk_spinner_size_allocate;

   etk_signal_connect_by_code(ETK_WIDGET_REALIZED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_realized_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_UNREALIZED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_unrealized_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_KEY_DOWN_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_key_down_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_KEY_UP_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_key_up_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_FOCUSED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_focused_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_UNFOCUSED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_unfocused_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_ENABLED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_enabled_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_DISABLED_SIGNAL, ETK_OBJECT(spinner), ETK_CALLBACK(_etk_spinner_disabled_cb), NULL);
   etk_signal_connect_by_code(ETK_WIDGET_SELECTION_RECEIVED_SIGNAL, ETK_OBJECT(spinner),
         ETK_CALLBACK(_etk_spinner_selection_received_cb), NULL);
   etk_object_notification_callback_add(ETK_OBJECT(spinner), "step-increment",
         _etk_spinner_step_increment_changed_cb, NULL);
}
Esempio n. 4
0
/* Increases the spinner's value by "increment" */
static void _etk_spinner_spin(Etk_Spinner *spinner, double increment)
{
   Etk_Range *range;
   double value;

   if (!(range = ETK_RANGE(spinner)))
      return;

   if (spinner->wrap)
   {
      if (range->value == range->lower && increment < 0)
         value = range->upper;
      else if (range->value == range->upper && increment > 0)
         value = range->lower;
      else
         value = range->value + increment;
   }
   else
      value = range->value + increment;

   if (spinner->snap_to_ticks)
      value = _etk_spinner_value_snap(spinner, value);

   etk_range_value_set(range, value);
   spinner->successive_steps++;
}
Esempio n. 5
0
/**
 * @brief Sets whether or not the value of the spinner should be automatically
 * corrected to the nearest step-increment
 * @param spinner a spinner
 * @param snap_to_ticks ETK_TRUE if you want the value to be corrected, ETK_FALSE otherwise
 */
void etk_spinner_snap_to_ticks_set(Etk_Spinner *spinner, Etk_Bool snap_to_ticks)
{
   if (!spinner || spinner->snap_to_ticks == snap_to_ticks)
      return;

   spinner->snap_to_ticks = snap_to_ticks;

   if (snap_to_ticks)
   {
      double new_value;

      new_value = _etk_spinner_value_snap(spinner, etk_range_value_get(ETK_RANGE(spinner)));
      etk_range_value_set(ETK_RANGE(spinner), new_value);
   }
   etk_object_notify(ETK_OBJECT(spinner), "snap-to-ticks");
}
Esempio n. 6
0
void bootpanel_update_timeout(boot_panel* pnl)
{
    int timeout;
    EXALT_ASSERT_RETURN_VOID(pnl!=NULL);

    timeout = exalt_dbus_bootprocess_timeout_get(exalt_conn);
    etk_range_value_set(ETK_RANGE(pnl->slider),timeout);
}
Esempio n. 7
0
Etk_Bool
_state_MinMaxSpinner_value_changed_cb(Etk_Range *range, double value, void *data)
{
   printf("Active Item Changed Signal on MinMaxSpinners EMITTED\n");

   edje_edit_state_min_w_set(edje_o, Cur.part->string, Cur.state->string,
                           etk_range_value_get(ETK_RANGE(UI_StateMinWSpinner)));
   edje_edit_state_min_h_set(edje_o, Cur.part->string, Cur.state->string,
                           etk_range_value_get(ETK_RANGE(UI_StateMinHSpinner)));
   edje_edit_state_max_w_set(edje_o, Cur.part->string, Cur.state->string,
                           etk_range_value_get(ETK_RANGE(UI_StateMaxWSpinner)));
   edje_edit_state_max_h_set(edje_o, Cur.part->string, Cur.state->string,
                           etk_range_value_get(ETK_RANGE(UI_StateMaxHSpinner)));

   canvas_redraw();
   return ETK_TRUE;
}
Esempio n. 8
0
Etk_Bool
_image_border_spinners_value_changed_cb(Etk_Range *range, double value, void *data)
{
   printf("Value Changed signal on BorderSpinner EMITTED (value: %f)\n",etk_range_value_get(range));

   if (!etk_string_length_get(Cur.state)) return ETK_TRUE;
   if (!etk_string_length_get(Cur.part)) return ETK_TRUE;
   edje_edit_state_image_border_set(edje_o, Cur.part->string, Cur.state->string,
      (int)etk_range_value_get(ETK_RANGE(UI_BorderLeftSpinner)),
      (int)etk_range_value_get(ETK_RANGE(UI_BorderRightSpinner)),
      (int)etk_range_value_get(ETK_RANGE(UI_BorderTopSpinner)),
      (int)etk_range_value_get(ETK_RANGE(UI_BorderBottomSpinner)));

   canvas_redraw();

   return ETK_TRUE;
}
Esempio n. 9
0
/* Updates the text of the spinner from its value */
static void _etk_spinner_update_text_from_value(Etk_Spinner *spinner)
{
   char text[MAX_TEXT_LEN];

   if (!spinner || !spinner->editable_object)
      return;

   snprintf(text, MAX_TEXT_LEN, spinner->value_format, etk_range_value_get(ETK_RANGE(spinner)));
   etk_editable_text_set(spinner->editable_object, text);
}
Esempio n. 10
0
/* Gets the value corrected to the nearest step-increment */
static double _etk_spinner_value_snap(Etk_Spinner *spinner, double value)
{
   Etk_Range *range;
   int factor;

   if (!(range = ETK_RANGE(spinner)))
      return 0.0;

   factor = ETK_ROUND(value / range->step_increment);
   return range->step_increment * factor;
}
Esempio n. 11
0
void
emphasis_configgui_autoset(Emphasis_Config_Gui *configgui)
{
  Emphasis_Config *config;

  config = config_load();

  if(config->port)
    {
      etk_range_value_set(ETK_RANGE(configgui->port), config->port);
    }
  if(config->hostname)
    {
      etk_entry_text_set(ETK_ENTRY(configgui->hostname),
                         config->hostname);
    }
  if(config->password)
    {
      etk_entry_text_set(ETK_ENTRY(configgui->password),
                         config->password);
    }

  if(!mpc_assert_status(MPD_PLAYER_STOP) || mpc_get_crossfade())
    {
      etk_range_value_set(ETK_RANGE(configgui->xfade),
                          mpc_get_crossfade());
    }
  else
    {
      etk_range_value_set(ETK_RANGE(configgui->xfade),
                          config->crossfade);
    }
  etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(configgui->stop),
                               config->stop_on_exit);
  etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(configgui->aspect),
                               config->keep_aspect);

  config_free(config);
}
Esempio n. 12
0
/* A timer used to increment the value */
static int _etk_spinner_step_increment_timer_cb(void *data)
{
   Etk_Spinner *spinner;

   if (!(spinner = ETK_SPINNER(data)))
      return 1;

   _etk_spinner_update_value_from_text(spinner);

   ecore_timer_interval_set(spinner->step_timer, (spinner->successive_steps == 0) ? FIRST_DELAY : REPEAT_DELAY);
   _etk_spinner_spin(spinner, ETK_RANGE(spinner)->step_increment);

   return 1;
}
Esempio n. 13
0
/* Updates the value of the spinner from its text */
static void _etk_spinner_update_value_from_text(Etk_Spinner *spinner)
{
   const char *text;
   float value;

   if (!spinner || !spinner->editable_object)
      return;

   text = etk_editable_text_get(spinner->editable_object);
   if (sscanf(text, "%f", &value) != 1)
      value = 0.0;

   if (spinner->snap_to_ticks)
      value = _etk_spinner_value_snap(spinner, value);

   if (!etk_range_value_set(ETK_RANGE(spinner), value))
      _etk_spinner_update_text_from_value(spinner);
}
Esempio n. 14
0
/* Default handler for the "value-changed" signal of a spinner */
static Etk_Bool _etk_spinner_value_changed_handler(Etk_Range *range, double value)
{
   Etk_Spinner *spinner;

   if (!(spinner = ETK_SPINNER(range)))
      return ETK_TRUE;

   if (spinner->snap_to_ticks)
   {
      double new_value;

      new_value = _etk_spinner_value_snap(spinner, value);
      if (value != range->lower && value != range->upper && value != value)
         etk_range_value_set(ETK_RANGE(spinner), new_value);
   }

   _etk_spinner_update_text_from_value(spinner);
   return ETK_TRUE;
}
Esempio n. 15
0
/**
 * @brief Set the volume slider to the value position
 * @param value A vol value in percent
 * @param gui A Emphasis_Gui
 */
void
emphasis_player_vol_slider_set(Emphasis_Player_Gui *player, int value)
{
  etk_range_value_set(ETK_RANGE(player->full.sound_slider) , (double) value);
  etk_range_value_set(ETK_RANGE(player->small.sound_slider), (double) value);
}
Esempio n. 16
0
void
emphasis_configgui_save(Emphasis_Config_Gui *configgui)
{
  Emphasis_Config *config;
  char *key = NULL, *value = NULL;
  int reconnect = 0;

  config = config_load();

  if((key = config->hostname))
    {
      value = strdup(etk_entry_text_get(ETK_ENTRY(configgui->hostname)));
      if(strcmp(key,value)) { reconnect = 1; }
      free(config->hostname);
    }
  config->hostname = value;

  if((key = config->password))
    {
      value = strdup(etk_entry_text_get(ETK_ENTRY(configgui->password)));
      if(!reconnect && strcmp(key,value)) { reconnect = 1; }
      free(config->password);
    }
  config->password = value;
  
  if(!reconnect && config->port != etk_range_value_get(ETK_RANGE(configgui->port)))
    {
      reconnect = 1;
    }
  config->port = etk_range_value_get(ETK_RANGE(configgui->port));


  config->crossfade    =
   etk_range_value_get(ETK_RANGE(configgui->xfade));
  config->stop_on_exit =
   etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(configgui->stop));
  config->keep_aspect  =
   etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(configgui->aspect));

  if(configgui->data)
    {
      etk_image_keep_aspect_set
        (ETK_IMAGE(((Emphasis_Gui*)configgui->data)->player->small.cover),
         config->keep_aspect);
      etk_image_keep_aspect_set
        (ETK_IMAGE(((Emphasis_Gui*)configgui->data)->player->full.cover),
         config->keep_aspect);
    }
  mpc_set_crossfade(config->crossfade);

  config_save(config);
  config_free(config);

  if(reconnect)
    {
      Emphasis_Gui *gui = configgui->data;
      emphasis_player_cover_set(gui->player, NULL);
      emphasis_player_progress_set(gui->player, 0.0, 0.001);
      mpc_disconnect();
    }
}
Esempio n. 17
0
void
gradient_frame_update(void)
{
   const char *type;
   char *p;
   int i;
   int alpha;
   Etk_Combobox_Item *item;

   //Disable signal propagation
   etk_signal_block("item-activated", ETK_OBJECT(UI_GradientTypeComboBox),
                     ETK_CALLBACK(_gradient_type_combo_activated_cb), NULL);
   etk_signal_block("item-activated", ETK_OBJECT(UI_GradientSpectraComboBox),
                     ETK_CALLBACK(_gradient_spectra_combo_activated_cb), NULL);

   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientAlphaSlider),
                    ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientAngleSlider),
                  ETK_CALLBACK(_gradient_AngleSlider_value_changed_cb), NULL);

   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel1XSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1X_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel1YSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1Y_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel2XSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2X_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel2YSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2Y_SPINNER);

   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel1XOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1XO_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel1YOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1YO_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel2XOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2XO_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_GradientRel2YOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2YO_SPINNER);

   //Set Gradient Type Combo
   type = edje_edit_state_gradient_type_get(edje_o, Cur.part->string, Cur.state->string);
   if (type)
   {
      i=0;
      while ((item = etk_combobox_nth_item_get(ETK_COMBOBOX(UI_GradientTypeComboBox), i)))
      {
         p = etk_combobox_item_field_get(item, 1);
         if (strcmp(p, type) == 0)
            etk_combobox_active_item_set(ETK_COMBOBOX(UI_GradientTypeComboBox), item);
         i++;
      }
      edje_edit_string_free(type);
   }
   else
      etk_combobox_active_item_set(ETK_COMBOBOX(UI_GradientTypeComboBox),
            etk_combobox_nth_item_get(ETK_COMBOBOX(UI_GradientTypeComboBox), 0));

   //Set Gradient Spectra Combo
   type = edje_edit_state_gradient_spectra_get(edje_o, Cur.part->string, Cur.state->string);
   if (type)
   {
      i=0;
      while ((item = etk_combobox_nth_item_get(ETK_COMBOBOX(UI_GradientSpectraComboBox), i)))
      {
         p = etk_combobox_item_field_get(item, 1);
         if (strcmp(p, type) == 0)
         {
            etk_combobox_active_item_set(ETK_COMBOBOX(UI_GradientSpectraComboBox), item);
            break;
         }
         i++;
      }
      edje_edit_string_free(type);
   }
   else
      etk_combobox_active_item_set(ETK_COMBOBOX(UI_GradientSpectraComboBox),
            etk_combobox_nth_item_get(ETK_COMBOBOX(UI_GradientSpectraComboBox), 0));

   //Set alpha slider
   edje_edit_state_color_get(edje_o, Cur.part->string, Cur.state->string,
                             NULL, NULL, NULL, &alpha);
   etk_range_value_set(ETK_RANGE(UI_GradientAlphaSlider), alpha);
   //Set Angle slider
   etk_range_value_set(ETK_RANGE(UI_GradientAngleSlider),
                       edje_edit_state_gradient_angle_get(edje_o,
                           Cur.part->string, Cur.state->string));
   
   //Update Rels spinners
   etk_range_value_set(ETK_RANGE(UI_GradientRel1XSpinner),
      edje_edit_state_gradient_rel1_relative_x_get(edje_o, Cur.part->string,
                                                   Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel1YSpinner),
      edje_edit_state_gradient_rel1_relative_y_get(edje_o, Cur.part->string,
                                                   Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel1XOffsetSpinner),
      edje_edit_state_gradient_rel1_offset_x_get(edje_o, Cur.part->string,
                                                 Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel1YOffsetSpinner),
      edje_edit_state_gradient_rel1_offset_y_get(edje_o, Cur.part->string,
                                                 Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel2XSpinner),
      edje_edit_state_gradient_rel2_relative_x_get(edje_o, Cur.part->string,
                                                   Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel2YSpinner),
      edje_edit_state_gradient_rel2_relative_y_get(edje_o, Cur.part->string,
                                                   Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel2XOffsetSpinner),
      edje_edit_state_gradient_rel2_offset_x_get(edje_o, Cur.part->string,
                                                 Cur.state->string));
   etk_range_value_set(ETK_RANGE(UI_GradientRel2YOffsetSpinner),
      edje_edit_state_gradient_rel2_offset_y_get(edje_o, Cur.part->string,
                                                 Cur.state->string));

   //Reenable signal propagation
   etk_signal_unblock("item-activated", ETK_OBJECT(UI_GradientTypeComboBox),
                     ETK_CALLBACK(_gradient_type_combo_activated_cb), NULL);
   etk_signal_unblock("item-activated", ETK_OBJECT(UI_GradientSpectraComboBox),
                     ETK_CALLBACK(_gradient_spectra_combo_activated_cb), NULL);

   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientAlphaSlider),
                    ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientAngleSlider),
                  ETK_CALLBACK(_gradient_AngleSlider_value_changed_cb), NULL);

   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel1XSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1X_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel1YSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1Y_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel2XSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2X_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel2YSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2Y_SPINNER);

   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel1XOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1XO_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel1YOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL1YO_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel2XOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2XO_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_GradientRel2YOffsetSpinner),
                    ETK_CALLBACK(_gradient_RelSpinners_value_changed_cb),
                    (void *)REL2YO_SPINNER);
}
Esempio n. 18
0
/* Called when the user presses a key */
static Etk_Bool _etk_spinner_key_down_cb(Etk_Object *object, Etk_Event_Key_Down *event, void *data)
{
   Etk_Spinner *spinner;
   Etk_Range *range;
   Evas_Object *editable;
   int cursor_pos, selection_pos;
   int start_pos, end_pos;
   int climb_factor;
   Etk_Bool selecting;
   Etk_Bool changed = ETK_FALSE;
   Etk_Bool selection_changed = ETK_FALSE;
   Etk_Bool stop_signal = ETK_TRUE;

   if (!(spinner = ETK_SPINNER(object)))
     return ETK_TRUE;

   range = ETK_RANGE(spinner);
   editable = spinner->editable_object;
   cursor_pos = etk_editable_cursor_pos_get(editable);
   selection_pos = etk_editable_selection_pos_get(editable);
   start_pos = ETK_MIN(cursor_pos, selection_pos);
   end_pos = ETK_MAX(cursor_pos, selection_pos);
   selecting = (start_pos != end_pos);

   /* TODO: increment faster if the key has been pressed for a long time... */
   climb_factor = 1;

   /* Move the cursor/selection to the left */
   if (strcmp(event->keyname, "Left") == 0)
   {
      if (event->modifiers & ETK_MODIFIER_SHIFT)
      {
         etk_editable_cursor_move_left(editable);
         selection_changed = ETK_TRUE;
      }
      else if (selecting)
      {
         if (cursor_pos < selection_pos)
            etk_editable_selection_pos_set(editable, cursor_pos);
         else
            etk_editable_cursor_pos_set(editable, selection_pos);
      }
      else
      {
         etk_editable_cursor_move_left(editable);
         etk_editable_selection_pos_set(editable, etk_editable_cursor_pos_get(editable));
      }
   }
   /* Move the cursor/selection to the right */
   else if (strcmp(event->keyname, "Right") == 0)
   {
      if (event->modifiers & ETK_MODIFIER_SHIFT)
      {
         etk_editable_cursor_move_right(editable);
         selection_changed = ETK_TRUE;
      }
      else if (selecting)
      {
         if (cursor_pos > selection_pos)
            etk_editable_selection_pos_set(editable, cursor_pos);
         else
            etk_editable_cursor_pos_set(editable, selection_pos);
      }
      else
      {
         etk_editable_cursor_move_right(editable);
         etk_editable_selection_pos_set(editable, etk_editable_cursor_pos_get(editable));
      }
   }
   /* Move the cursor/selection to the start of the spinner */
   else if (strcmp(event->keyname, "Home") == 0)
   {
      etk_editable_cursor_move_to_start(editable);
      if (!(event->modifiers & ETK_MODIFIER_SHIFT))
         etk_editable_selection_pos_set(editable, etk_editable_cursor_pos_get(editable));
      else
         selection_changed = ETK_TRUE;
   }
   /* Move the cursor/selection to the end of the spinner */
   else if (strcmp(event->keyname, "End") == 0)
   {
      etk_editable_cursor_move_to_end(editable);
      if (!(event->modifiers & ETK_MODIFIER_SHIFT))
         etk_editable_selection_pos_set(editable, etk_editable_cursor_pos_get(editable));
      else
         selection_changed = ETK_TRUE;
   }
   /* Delete the previous character */
   else if (strcmp(event->keyname, "BackSpace") == 0)
   {
      if (selecting)
         changed = etk_editable_delete(editable, start_pos, end_pos);
      else
         changed = etk_editable_delete(editable, cursor_pos - 1, cursor_pos);
   }
   /* Delete the next character */
   else if (strcmp(event->keyname, "Delete") == 0)
   {
      if (selecting)
         changed = etk_editable_delete(editable, start_pos, end_pos);
      else
         changed = etk_editable_delete(editable, cursor_pos, cursor_pos + 1);
   }
   /* Increment the value */
   else if (strcmp(event->keyname, "Up") == 0)
   {
      _etk_spinner_spin(spinner, climb_factor * range->step_increment);
   }
   /* Decrement the value */
   else if (strcmp(event->keyname, "Down") == 0)
   {
      _etk_spinner_spin(spinner, -(climb_factor * range->step_increment));
   }
   /* Increment the value by the page-increment */
   else if (strcmp(event->keyname, "Prior") == 0)
   {
      _etk_spinner_spin(spinner, climb_factor * range->page_increment);
   }
   /* Decrement the value by the page-increment */
   else if (strcmp(event->keyname, "Next") == 0)
   {
      _etk_spinner_spin(spinner, -(climb_factor * range->page_increment));
   }
   /* Validate the value entered in the spinner */
   else if (strcmp(event->keyname, "Return") == 0 || strcmp(event->keyname, "KP_Enter") == 0)
   {
      _etk_spinner_update_value_from_text(spinner);
   }
   /* Ctrl + A,C,X,V */
   else if (event->modifiers & ETK_MODIFIER_CTRL)
   {
      if (strcmp(event->keyname, "a") == 0)
      {
         etk_editable_select_all(editable);
         selection_changed = ETK_TRUE;
      }
      else if (strcmp(event->keyname, "x") == 0 || strcmp(event->keyname, "c") == 0)
         _etk_spinner_selection_copy(spinner, ETK_SELECTION_CLIPBOARD, (strcmp(event->keyname, "x") == 0));
      else if (strcmp(event->keyname, "v") == 0)
         etk_selection_text_request(ETK_SELECTION_CLIPBOARD, ETK_WIDGET(spinner));
      else
         stop_signal = ETK_FALSE;
   }
   /* Otherwise, we insert the corresponding character */
   else if (event->string && *event->string && (strlen(event->string) != 1 || event->string[0] >= 0x20))
   {
      if (selecting)
         changed |= etk_editable_delete(editable, start_pos, end_pos);
      changed |= etk_editable_insert(editable, start_pos, event->string);
   }
   else
      stop_signal = ETK_FALSE;

   if (selection_changed)
      _etk_spinner_selection_copy(spinner, ETK_SELECTION_PRIMARY, ETK_FALSE);

   return (!stop_signal);
}
Esempio n. 19
0
void
image_frame_update(void)
{
   //Etk_Combobox_Item *item = NULL;
   const char *im;

   //Stop signal propagation
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderLeftSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_LEFT);
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderRightSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_RIGHT);
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderTopSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_TOP);
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderBottomSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_BOTTOM);
   etk_signal_block("value-changed",ETK_OBJECT(UI_ImageAlphaSlider),
                    ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL);
   etk_signal_block("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox),
                    ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL);
   etk_signal_block("toggled", ETK_OBJECT(UI_BorderMiddleCheck),
                    ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL);

   if (!etk_string_length_get(Cur.state)) return;
   if (!etk_string_length_get(Cur.part)) return;

   image_tweenlist_populate();
   etk_widget_disabled_set(UI_DeleteTweenButton, TRUE);
   etk_widget_disabled_set(UI_MoveDownTweenButton, TRUE);
   etk_widget_disabled_set(UI_MoveUpTweenButton, TRUE);

   /* Update Image Browser */
   image_browser_update();

   //Set the images label for normal image
   im = edje_edit_state_image_get(edje_o, Cur.part->string, Cur.state->string);
   if (im)
   {
      etk_label_set(ETK_LABEL(UI_ImageNameLabel), im);
      edje_edit_string_free(im);
   }
   else
   {
      etk_label_set(ETK_LABEL(UI_ImageNameLabel), "none");
   }

   //Set alpha and borders
   int alpha, t, l, r, b;
   edje_edit_state_color_get(edje_o, Cur.part->string, Cur.state->string,
                             NULL, NULL, NULL, &alpha);
   edje_edit_state_image_border_get(edje_o, Cur.part->string, Cur.state->string,
                                    &l, &r, &t, &b);
   etk_range_value_set(ETK_RANGE(UI_ImageAlphaSlider), alpha);
   etk_range_value_set(ETK_RANGE(UI_BorderLeftSpinner), l);
   etk_range_value_set(ETK_RANGE(UI_BorderRightSpinner), r);
   etk_range_value_set(ETK_RANGE(UI_BorderTopSpinner), t);
   etk_range_value_set(ETK_RANGE(UI_BorderBottomSpinner), b);
   etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_BorderMiddleCheck),
         edje_edit_state_image_border_fill_get(edje_o, Cur.part->string,
                                                      Cur.state->string));

   //ReEnable Signal Propagation
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderLeftSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_LEFT);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderRightSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_RIGHT);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderTopSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_TOP);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderBottomSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_BOTTOM);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_ImageAlphaSlider),
                      _image_AlphaSlider_value_changed_cb, NULL);
   etk_signal_unblock("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox),
                      ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL);
   etk_signal_unblock("toggled", ETK_OBJECT(UI_BorderMiddleCheck),
                      ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL);
}
Esempio n. 20
0
void
state_frame_update(void)
{
   const char* cc;
   
   //Stop signal propagation
   etk_signal_block("text-changed", ETK_OBJECT(UI_StateEntry),
                    _group_NamesEntry_text_changed_cb, NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_AspectMinSpinner),
                    ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_AspectMaxSpinner),
                    ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL);
   etk_signal_block("active-item-changed", ETK_OBJECT(UI_AspectComboBox),
                    ETK_CALLBACK(_state_AspectComboBox_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_StateMinWSpinner),
                    ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_StateMinHSpinner),
                    ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_StateMaxWSpinner),
                    ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_StateMaxHSpinner),
                    ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_block("value-changed", ETK_OBJECT(UI_StateAlignVSpinner),
                    ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb),
                    (void*)STATE_ALIGNV_SPINNER);
   etk_signal_block("value-changed", ETK_OBJECT(UI_StateAlignHSpinner),
                    ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb),
                    (void*)STATE_ALIGNH_SPINNER);
   etk_signal_block("toggled", ETK_OBJECT(UI_StateVisibleCheck),
                    ETK_CALLBACK(_state_VisibleCheck_toggled_cb), NULL);
   etk_signal_block("text-changed", ETK_OBJECT(UI_StateCCEntry),
                    ETK_CALLBACK(_state_CCEntry_text_changed_cb), NULL);

   if (etk_string_length_get(Cur.state))
   {
      //Set description name & index
      etk_entry_text_set(ETK_ENTRY(UI_StateEntry),Cur.state->string);
      etk_widget_hide(ETK_WIDGET(UI_StateEntryImage));
      if (!strcmp(Cur.state->string, "default 0.00"))
         etk_widget_disabled_set(ETK_WIDGET(UI_StateEntry), ETK_TRUE);
      else
         etk_widget_disabled_set(ETK_WIDGET(UI_StateEntry), ETK_FALSE);

      //Set aspect min & max
      etk_range_value_set(ETK_RANGE(UI_AspectMinSpinner),
         edje_edit_state_aspect_min_get(edje_o, Cur.part->string, Cur.state->string));
      etk_range_value_set(ETK_RANGE(UI_AspectMaxSpinner),
         edje_edit_state_aspect_max_get(edje_o, Cur.part->string, Cur.state->string));

      //Set aspect pref Combo
      etk_combobox_active_item_set(ETK_COMBOBOX(UI_AspectComboBox),
         etk_combobox_nth_item_get(ETK_COMBOBOX(UI_AspectComboBox), 
            edje_edit_state_aspect_pref_get(edje_o, Cur.part->string, Cur.state->string)));

      //Set min e max size
      etk_range_value_set(ETK_RANGE(UI_StateMinWSpinner),
         edje_edit_state_min_w_get(edje_o, Cur.part->string, Cur.state->string));
      etk_range_value_set(ETK_RANGE(UI_StateMinHSpinner),
         edje_edit_state_min_h_get(edje_o, Cur.part->string, Cur.state->string));
      etk_range_value_set(ETK_RANGE(UI_StateMaxWSpinner),
         edje_edit_state_max_w_get(edje_o, Cur.part->string, Cur.state->string));
      etk_range_value_set(ETK_RANGE(UI_StateMaxHSpinner),
         edje_edit_state_max_h_get(edje_o, Cur.part->string, Cur.state->string));

      //Set description align & valign
      etk_range_value_set(ETK_RANGE(UI_StateAlignHSpinner),
         edje_edit_state_align_x_get(edje_o, Cur.part->string, Cur.state->string));
      etk_range_value_set(ETK_RANGE(UI_StateAlignVSpinner),
         edje_edit_state_align_y_get(edje_o, Cur.part->string, Cur.state->string));

      //Set visible checkbox
      etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_StateVisibleCheck),
         edje_edit_state_visible_get(edje_o, Cur.part->string, Cur.state->string));
      
      //Set Color Class Entry
      cc = edje_edit_state_color_class_get(edje_o, Cur.part->string, Cur.state->string);
      etk_entry_text_set(ETK_ENTRY(UI_StateCCEntry), cc);
      edje_edit_string_free(cc);
   }

   //ReEnable Signal Propagation
   etk_signal_unblock("text-changed", ETK_OBJECT(UI_StateEntry),
                      _group_NamesEntry_text_changed_cb, NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_AspectMinSpinner),
                      ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_AspectMaxSpinner),
                      ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL);
   etk_signal_unblock("active-item-changed", ETK_OBJECT(UI_AspectComboBox),
                      ETK_CALLBACK(_state_AspectComboBox_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMinWSpinner),
                      ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMinHSpinner),
                      ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMaxWSpinner),
                      ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMaxHSpinner),
                      ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateAlignVSpinner),
                      ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb),
                      (void*)STATE_ALIGNV_SPINNER);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateAlignHSpinner),
                      ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb),
                      (void*)STATE_ALIGNH_SPINNER);
   etk_signal_unblock("toggled", ETK_OBJECT(UI_StateVisibleCheck),
                      ETK_CALLBACK(_state_VisibleCheck_toggled_cb), NULL);
   etk_signal_unblock("text-changed", ETK_OBJECT(UI_StateCCEntry),
                      ETK_CALLBACK(_state_CCEntry_text_changed_cb), NULL);

}