summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-08-05 03:06:50 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-08-05 03:06:50 +0000
commit94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3 (patch)
tree317019f306f7195c07d3c0d943c829ed11ba8cca /ui
parent50aa5cd62ef4a66da41d68f4a50ddfca97863c38 (diff)
downloadlibrcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.tar.gz
librcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.tar.bz2
librcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.tar.xz
librcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.zip
Language AutoDetection Improvements
- Fix: Loading/Saving range options. - Fix: Language AutoDetection. Using locale language instead of selected one. - Support for range options in GTK UI. - Option to control recoding timeout is provided. - LibRCC.h is updated (Translate, Spell, IConv). - Documentation is updated. - Add 'rcc-config' alias to 'rcc-gtk2-config' in spec. - Implemented concept of parrent languages + The concept is used in language autodetection. The string in considered language is permited to have words from all it's parrent languages. + English is assumed to be parrent for all other languages by default. + Russian is parrent language for Ukrainian and Belorussian. - No translation to english if translation between related (one of the languages is parrent for another one) languages is failed.
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk.c27
-rw-r--r--ui/librccui.c24
-rw-r--r--ui/librccui.h3
-rw-r--r--ui/rccmenu.c40
-rw-r--r--ui/rccmenu.h5
-rw-r--r--ui/rccnames.c1
6 files changed, 94 insertions, 6 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index a148210..7de5406 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -33,8 +33,19 @@ rcc_ui_id rccUiMenuGet(rcc_ui_menu_context ctx) {
if (!ctx) return (rcc_ui_id)-1;
- if ((ctx->type == RCC_UI_MENU_OPTION)&&(rccUiMenuGetRangeType(ctx)==RCC_OPTION_RANGE_TYPE_BOOLEAN))
- return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->widget));
+ if (ctx->type == RCC_UI_MENU_OPTION) {
+ switch (rccUiMenuGetRangeType(ctx)) {
+
+ case RCC_OPTION_RANGE_TYPE_BOOLEAN:
+ return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->widget));
+ case RCC_OPTION_RANGE_TYPE_MENU:
+ break;
+ case RCC_OPTION_RANGE_TYPE_RANGE:
+ return gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(ctx->widget));
+ default:
+ return (rcc_ui_id)-1;
+ }
+ }
menu = gtk_option_menu_get_menu(ctx->widget);
return g_list_index(GTK_MENU_SHELL(menu)->children, gtk_menu_get_active(GTK_MENU(menu)));
@@ -52,6 +63,8 @@ int rccUiMenuSet(rcc_ui_menu_context ctx, rcc_ui_id id) {
case RCC_OPTION_RANGE_TYPE_MENU:
gtk_option_menu_set_history(ctx->widget, id);
break;
+ case RCC_OPTION_RANGE_TYPE_RANGE:
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(ctx->widget), id);
default:
return -1;
}
@@ -84,10 +97,12 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
rcc_charset_id charset_id;
rcc_engine_id engine_id;
+ rcc_option_range *range;
rcc_option_name *option_name;
rcc_option_value_names optnames;
GtkWidget *list, *item, *menu;
+ GtkObject *adjustment;
if (!ctx) return -1;
@@ -203,6 +218,14 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
}
gtk_option_menu_set_history(GTK_OPTION_MENU(ctx->widget), rccGetOption(rccctx, rccUiMenuGetOption(ctx)));
break;
+ case RCC_OPTION_RANGE_TYPE_RANGE:
+ range = rccUiMenuGetRange(ctx);
+ adjustment = gtk_adjustment_new(rccGetOption(rccctx, rccUiMenuGetOption(ctx)), range->min, range->max, range->step, range->step*5, range->step*5);
+/* item = gtk_hscale_new(GTK_ADJUSTMENT(adjustment));
+ gtk_scale_set_digits(GTK_SCALE(item), 0);*/
+ item = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), range->step, 0);
+ ctx->widget = item;
+ break;
default:
return -1;
}
diff --git a/ui/librccui.c b/ui/librccui.c
index c4ac1c0..c38cb58 100644
--- a/ui/librccui.c
+++ b/ui/librccui.c
@@ -525,6 +525,30 @@ void rccUiFreeContext(rcc_ui_context ctx) {
free(ctx);
}
+int rccUiHideOption(rcc_ui_context ctx, rcc_option option) {
+ unsigned int i;
+ if ((!ctx)||((option > RCC_MAX_OPTIONS)&&(option != RCC_OPTION_ALL))) return -1;
+
+ if (option != RCC_OPTION_ALL) return rccUiMenuHide(ctx->options[option]);
+
+ for (i=0;i<RCC_MAX_OPTIONS;i++)
+ rccUiMenuHide(ctx->options[i]);
+
+ return 0;
+}
+
+int rccUiUnHideOption(rcc_ui_context ctx, rcc_option option) {
+ unsigned int i;
+ if ((!ctx)||((option > RCC_MAX_OPTIONS)&&(option != RCC_OPTION_ALL))) return -1;
+
+ if (option != RCC_OPTION_ALL) return rccUiMenuUnHide(ctx->options[option]);
+
+ for (i=0;i<RCC_MAX_OPTIONS;i++)
+ rccUiMenuUnHide(ctx->options[i]);
+
+ return 0;
+}
+
int rccUiSetLanguageNames(rcc_ui_context ctx, rcc_name *names) {
if (!ctx) return -1;
diff --git a/ui/librccui.h b/ui/librccui.h
index 2c72678..6ae36d7 100644
--- a/ui/librccui.h
+++ b/ui/librccui.h
@@ -104,6 +104,9 @@ rcc_ui_context rccUiCreateContext(rcc_context rccctx);
*/
void rccUiFreeContext(rcc_ui_context ctx);
+int rccUiHideOption(rcc_ui_context ctx, rcc_option option);
+int rccUiUnHideOption(rcc_ui_context ctx, rcc_option option);
+
/**
* Restores current language UI menu values from #rcc_context.
*
diff --git a/ui/rccmenu.c b/ui/rccmenu.c
index 5a51c56..0e87b08 100644
--- a/ui/rccmenu.c
+++ b/ui/rccmenu.c
@@ -51,6 +51,7 @@ rcc_ui_menu_context rccUiOptionMenuCreateContext(rcc_ui_menu_type type, rcc_opti
ctx->ui_menu.type = type;
ctx->id = id;
ctx->type = otype;
+ ctx->realtype = otype;
ctx->range = range;
ctx->ui_menu.widget = rccUiMenuCreateWidget((rcc_ui_menu_context)ctx);
@@ -68,23 +69,54 @@ void rccUiMenuFreeContext(rcc_ui_menu_context ctx) {
rcc_class_id rccUiMenuGetClassId(rcc_ui_menu_context ctx) {
- if (ctx->type != RCC_UI_MENU_CHARSET) return (rcc_class_id)-1;
+ if ((!ctx)||(ctx->type != RCC_UI_MENU_CHARSET)) return (rcc_class_id)-1;
return ((rcc_ui_charset_menu_context)ctx)->id;
}
rcc_option rccUiMenuGetOption(rcc_ui_menu_context ctx) {
- if (ctx->type != RCC_UI_MENU_OPTION) return (rcc_option)-1;
+ if ((!ctx)||(ctx->type != RCC_UI_MENU_OPTION)) return (rcc_option)-1;
return ((rcc_ui_option_menu_context)ctx)->id;
}
rcc_option_type rccUiMenuGetType(rcc_ui_menu_context ctx) {
- if (ctx->type != RCC_UI_MENU_OPTION) return (rcc_option_type)-1;
+ if ((!ctx)||(ctx->type != RCC_UI_MENU_OPTION)) return (rcc_option_type)-1;
return ((rcc_ui_option_menu_context)ctx)->type;
}
+rcc_option_range *rccUiMenuGetRange(rcc_ui_menu_context ctx) {
+ if ((!ctx)||(ctx->type != RCC_UI_MENU_OPTION)) return NULL;
+ return ((rcc_ui_option_menu_context)ctx)->range;
+}
+
rcc_option_range_type rccUiMenuGetRangeType(rcc_ui_menu_context ctx) {
- if (ctx->type != RCC_UI_MENU_OPTION) return (rcc_option_type)-1;
+ if ((!ctx)||(ctx->type != RCC_UI_MENU_OPTION)) return (rcc_option_type)-1;
return ((rcc_ui_option_menu_context)ctx)->range->type;
}
+int rccUiMenuHide(rcc_ui_menu_context ctx) {
+ if (!ctx) return -1;
+
+ // Only options right now
+ if (ctx->type != RCC_UI_MENU_OPTION) return -1;
+
+ ((rcc_ui_option_menu_context)ctx)->type = RCC_OPTION_TYPE_INVISIBLE;
+
+ return 0;
+}
+
+int rccUiMenuUnHide(rcc_ui_menu_context ctx) {
+ if (!ctx) return -1;
+
+ // Only options right now
+ if (ctx->type != RCC_UI_MENU_OPTION) return -1;
+
+ if (((rcc_ui_option_menu_context)ctx)->type == RCC_OPTION_TYPE_INVISIBLE) {
+ if (((rcc_ui_option_menu_context)ctx)->realtype == RCC_OPTION_TYPE_INVISIBLE)
+ ((rcc_ui_option_menu_context)ctx)->type = RCC_OPTION_TYPE_STANDARD;
+ else
+ ((rcc_ui_option_menu_context)ctx)->type = ((rcc_ui_option_menu_context)ctx)->realtype;
+ }
+
+ return 0;
+}
diff --git a/ui/rccmenu.h b/ui/rccmenu.h
index 5ad14ff..f757732 100644
--- a/ui/rccmenu.h
+++ b/ui/rccmenu.h
@@ -37,6 +37,7 @@ struct rcc_ui_option_menu_context_t {
rcc_ui_menu_context_s ui_menu;
rcc_option id;
rcc_option_type type;
+ rcc_option_type realtype;
rcc_option_range *range;
};
typedef struct rcc_ui_option_menu_context_t rcc_ui_option_menu_context_s;
@@ -51,5 +52,9 @@ rcc_class_id rccUiMenuGetClassId(rcc_ui_menu_context ctx);
rcc_option rccUiMenuGetOption(rcc_ui_menu_context ctx);
rcc_option_type rccUiMenuGetType(rcc_ui_menu_context ctx);
rcc_option_range_type rccUiMenuGetRangeType(rcc_ui_menu_context ctx);
+rcc_option_range *rccUiMenuGetRange(rcc_ui_menu_context ctx);
+
+int rccUiMenuHide(rcc_ui_menu_context ctx);
+int rccUiMenuUnHide(rcc_ui_menu_context ctx);
#endif /* _RCC_UI_MENU_H */
diff --git a/ui/rccnames.c b/ui/rccnames.c
index 0e4f586..d18f524 100644
--- a/ui/rccnames.c
+++ b/ui/rccnames.c
@@ -43,6 +43,7 @@ rcc_option_name rcc_default_option_names_embeded[RCC_MAX_OPTIONS+1] = {
{ RCC_OPTION_AUTOENGINE_SET_CURRENT, "AutoEngine Set Current Encoding", rcc_default_option_boolean_names },
{ RCC_OPTION_AUTODETECT_LANGUAGE, "Autodetect Language", rcc_default_option_boolean_names },
{ RCC_OPTION_TRANSLATE, "Translate Text", rcc_default_option_translate_names },
+ { RCC_OPTION_TIMEOUT, "Recoding Timeout (us)", NULL },
{ RCC_MAX_OPTIONS }
};