ege-adjustment-action.cpp revision 0a9a46fd9e563adc481afec846ceb7e622b17131
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is EGE Adjustment Action.
*
* The Initial Developer of the Original Code is
* Jon A. Cruz.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Note: this file should be kept compilable as both .cpp and .c */
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtktoolitem.h>
#include <gtk/gtkspinbutton.h>
#include <gtk/gtklabel.h>
#include <gtk/gtktoolbar.h>
#include <gtk/gtktooltips.h>
#include <gtk/gtkradiomenuitem.h>
#include "ege-adjustment-action.h"
static void ege_adjustment_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
static void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
static GtkActionClass* gParentClass = 0;
typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr;
struct _EgeAdjustmentDescr
{
};
struct _EgeAdjustmentActionPrivate
{
};
#define EGE_ADJUSTMENT_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), EGE_ADJUSTMENT_ACTION_TYPE, EgeAdjustmentActionPrivate ) )
enum {
PROP_ADJUSTMENT = 1,
};
enum {
BUMP_TOP = 0,
BUMP_CUSTOM = 100
};
GType ege_adjustment_action_get_type( void )
{
if ( !myType ) {
sizeof( EgeAdjustmentActionClass ),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof( EgeAdjustmentAction ),
0, /* n_preallocs */
};
}
return myType;
}
{
if ( klass ) {
g_param_spec_object( "adjustment",
"Adjustment",
"The adjustment to change",
g_param_spec_pointer( "focus-widget",
"Focus Widget",
"The widget to return focus to",
g_param_spec_double( "climb-rate",
"Climb Rate",
"The acelleraton rate",
g_param_spec_uint( "digits",
"Digits",
"The number of digits to show",
0, 20, 0,
g_param_spec_string( "self-id",
"Self ID",
"Marker for self pointer",
0,
g_param_spec_pointer( "tool-post",
"Tool Widget post process",
"Function for final adjustments",
}
}
{
}
{
EgeAdjustmentAction* action = 0;
}
}
}
{
"name", name,
"label", label,
"tooltip", tooltip,
"stock_id", stock_id,
"adjustment", adjustment,
"climb-rate", climb_rate,
"digits", digits,
NULL );
return action;
}
static void ege_adjustment_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec )
{
switch ( propId ) {
case PROP_ADJUSTMENT:
break;
case PROP_FOCUS_WIDGET:
break;
case PROP_CLIMB_RATE:
break;
case PROP_DIGITS:
break;
case PROP_SELFID:
break;
case PROP_TOOL_POST:
break;
default:
}
}
void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec )
{
switch ( propId ) {
case PROP_ADJUSTMENT:
{
NULL );
}
break;
case PROP_FOCUS_WIDGET:
{
/* TODO unhook prior */
}
break;
case PROP_CLIMB_RATE:
{
/* TODO pass on */
}
break;
case PROP_DIGITS:
{
/* TODO pass on */
}
}
}
break;
case PROP_SELFID:
{
/* TODO pass on */
}
break;
case PROP_TOOL_POST:
{
}
break;
default:
}
}
{
}
{
/* TODO unhook prior */
}
{
}
(void)user_data;
if ( data ) {
}
}
}
{
}
}
{
val = -1;
val = 1;
}
}
return val;
}
void ege_adjustment_action_set_descriptions( EgeAdjustmentAction* action, gchar const** descriptions, gdouble const* values, guint count )
{
guint i = 0;
for ( i = 0; i < count; i++ ) {
action->private_data->descriptions = g_list_insert_sorted( action->private_data->descriptions, (gpointer)descr, egeAct_compare_descriptions );
}
}
}
{
"lower", &lower,
"upper", &upper,
"step-increment", &step,
"page-increment", &page,
NULL );
switch ( what ) {
case BUMP_TOP:
break;
case BUMP_PAGE_UP:
break;
case BUMP_UP:
break;
case BUMP_DOWN:
break;
case BUMP_PAGE_DOWN:
break;
case BUMP_BOTTOM:
break;
default:
if ( what >= BUMP_CUSTOM ) {
EgeAdjustmentDescr* descr = (EgeAdjustmentDescr*)g_list_nth_data( act->private_data->descriptions, index );
if ( descr ) {
}
}
}
}
}
}
static void create_single_menu_item( GCallback toggleCb, int val, GtkWidget* menu, EgeAdjustmentAction* act, GtkWidget** dst, GSList** group, gdouble num, gboolean active )
{
char* str = 0;
EgeAdjustmentDescr* marker = 0;
while ( cur ) {
if ( delta < 0.0 ) {
}
break;
}
}
if ( !*group) {
}
if ( active ) {
}
}
int val,
{
if ( cur ) {
create_single_menu_item( toggleCb, val + g_list_position(act->private_data->descriptions, cur), menu, act, dst, group, descr->value, FALSE );
}
}
}
return cur;
}
{
"lower", &lower,
"upper", &upper,
"step-increment", &step,
"page-increment", &page,
NULL );
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, upper );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_TOP, menu, act, &single, &group, upper, FALSE );
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, base + page );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_PAGE_UP, menu, act, &single, &group, base + page, FALSE );
}
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, base + step );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_UP, menu, act, &single, &group, base + step, FALSE );
}
}
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, base );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_NONE, menu, act, &single, &group, base, TRUE );
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, base - step );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_DOWN, menu, act, &single, &group, base - step, FALSE );
}
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, base - page );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_PAGE_DOWN, menu, act, &single, &group, base - page, FALSE );
}
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, lower );
create_single_menu_item( G_CALLBACK(process_menu_action), BUMP_BOTTOM, menu, act, &single, &group, lower, FALSE );
}
addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value );
}
return menu;
}
{
if ( IS_EGE_ADJUSTMENT_ACTION(action) ) {
} else {
}
return item;
}
{
}
}
{
if ( IS_EGE_ADJUSTMENT_ACTION(act) ) {
}
}
}
return handled;
}
{
if ( IS_EGE_ADJUSTMENT_ACTION(action) ) {
GtkWidget* spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits );
{
}
}
}
}
/* Shrink or whatnot after shown */
}
} else {
}
return item;
}
{
}
{
}
{
}
}
}
{
(void)event;
if ( IS_EGE_ADJUSTMENT_ACTION(data) ) {
}
return FALSE; /* report event not consumed */
}
{
(void)widget;
(void)event;
if ( IS_EGE_ADJUSTMENT_ACTION(data) ) {
}
return FALSE; /* report event not consumed */
}
{
if ( kids ) {
}
if ( curr ) {
while ( mid ) {
/* potential target */
if ( subChildren ) {
if ( last && GTK_IS_SPIN_BUTTON(last->data) && GTK_WIDGET_IS_SENSITIVE( GTK_WIDGET(last->data) ) ) {
mid = 0; /* to stop loop */
}
}
}
}
}
}
g_list_free( kids );
}
}
return handled;
}
{
0, &key, 0, 0, 0 );
switch ( key ) {
case GDK_Escape:
{
wasConsumed = TRUE;
}
break;
case GDK_Return:
case GDK_KP_Enter:
{
wasConsumed = TRUE;
}
break;
case GDK_Tab:
{
}
break;
case GDK_ISO_Left_Tab:
{
}
break;
case GDK_Up:
case GDK_KP_Up:
{
wasConsumed = TRUE;
}
break;
case GDK_Down:
case GDK_KP_Down:
{
wasConsumed = TRUE;
}
break;
case GDK_Page_Up:
case GDK_KP_Page_Up:
{
wasConsumed = TRUE;
}
break;
case GDK_Page_Down:
case GDK_KP_Page_Down:
{
wasConsumed = TRUE;
}
break;
case GDK_z:
case GDK_Z:
{
wasConsumed = TRUE;
}
break;
}
return wasConsumed;
}