Commit e2255584 authored by claes's avatar claes

Conversion of input string from utf8 to ISO8859

parent 8a3fd98b
/*
* Proview $Id: wb_foe_gtk.cpp,v 1.5 2007-01-24 12:42:44 claes Exp $
* Proview $Id: wb_foe_gtk.cpp,v 1.6 2007-02-06 10:06:40 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -528,17 +528,19 @@ void WFoeGtk::activate_edit_togg( GtkWidget *w, gpointer data)
void WFoeGtk::valchanged_textinput( GtkWidget *w, gpointer data)
{
WFoeGtk *foe = (WFoeGtk *)data;
char *value;
char *value, *valueutf8;
int sts;
if ( foe->widgets.textinput == 0)
return;
value = gtk_editable_get_chars( GTK_EDITABLE(foe->widgets.textinput), 0, -1);
if ( *value == 0) {
g_free(value);
valueutf8 = gtk_editable_get_chars( GTK_EDITABLE(foe->widgets.textinput), 0, -1);
if ( *valueutf8 == 0) {
g_free(valueutf8);
return;
}
value = g_convert( valueutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( valueutf8);
strcpy( foe->searchstring, value);
......
/*
* Proview $Id: wb_watt_gtk.cpp,v 1.3 2007-02-05 09:35:26 claes Exp $
* Proview $Id: wb_watt_gtk.cpp,v 1.4 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -251,13 +251,16 @@ void WAttGtk::change_value_close()
if ( input_open) {
if ( input_multiline) {
gchar *text;
gchar *text, *textutf8;
GtkTextIter start_iter, end_iter;
gtk_text_buffer_get_start_iter( cmd_scrolled_buffer, &start_iter);
gtk_text_buffer_get_end_iter( cmd_scrolled_buffer, &end_iter);
text = gtk_text_buffer_get_text( cmd_scrolled_buffer, &start_iter, &end_iter,
textutf8 = gtk_text_buffer_get_text( cmd_scrolled_buffer, &start_iter, &end_iter,
FALSE);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
// Replace ctrl characters with space
for ( s = (unsigned char *) text; *s; s++) {
if ( *s < ' ' && *s != 10 && *s != 13)
......@@ -279,8 +282,11 @@ void WAttGtk::change_value_close()
wattnav->set_inputfocus();
}
else {
char *text;
text = gtk_editable_get_chars( GTK_EDITABLE(cmd_input), 0, -1);
char *text, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(cmd_input), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
sts = wattnav->set_attr_value( input_node,
input_name, text);
g_free( text);
......@@ -297,7 +303,7 @@ void WAttGtk::change_value_close()
void WAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
{
char *text;
char *text, *textutf8;
WAttGtk *watt = (WAttGtk *)data;
int sts;
......@@ -306,7 +312,9 @@ void WAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
watt->wattnav->set_inputfocus();
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
if ( watt->input_open) {
sts = ((WAttNav *)watt->wattnav)->set_attr_value( watt->input_node,
watt->input_name, text);
......@@ -322,7 +330,7 @@ void WAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
void WAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
{
WAttGtk *watt = (WAttGtk *)data;
gchar *text;
gchar *text, *textutf8;
unsigned char *s;
int sts;
......@@ -331,8 +339,11 @@ void WAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
gtk_text_buffer_get_start_iter( watt->cmd_scrolled_buffer, &start_iter);
gtk_text_buffer_get_end_iter( watt->cmd_scrolled_buffer, &end_iter);
text = gtk_text_buffer_get_text( watt->cmd_scrolled_buffer, &start_iter, &end_iter,
textutf8 = gtk_text_buffer_get_text( watt->cmd_scrolled_buffer, &start_iter, &end_iter,
FALSE);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
// Replace ctrl characters with space
for ( s = (unsigned char *) text; *s; s++) {
if ( *s < ' ' && *s != 10 && *s != 13)
......
/*
* Proview $Id: wb_wda_gtk.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_wda_gtk.cpp,v 1.2 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -212,11 +212,17 @@ void WdaGtk::class_activate_ok( GtkWidget *w, gpointer data)
WdaGtk *wda = (WdaGtk *)data;
char *hiername;
char *classname;
char *utf8;
int sts;
pwr_tClassId new_classid;
hiername = gtk_editable_get_chars( GTK_EDITABLE(wda->wdaclass_hiervalue), 0, -1);
classname = gtk_editable_get_chars( GTK_EDITABLE(wda->wdaclass_classvalue), 0, -1);
utf8 = gtk_editable_get_chars( GTK_EDITABLE(wda->wdaclass_hiervalue), 0, -1);
hiername = g_convert( utf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( utf8);
utf8 = gtk_editable_get_chars( GTK_EDITABLE(wda->wdaclass_classvalue), 0, -1);
classname = g_convert( utf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( utf8);
wda->attrobjects = (int) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(wda->wdaclass_attrobjects));
if ( strcmp( hiername, "") == 0)
......@@ -352,8 +358,11 @@ void WdaGtk::change_value_close()
wdanav->set_inputfocus();
}
else {
char *text;
text = gtk_editable_get_chars( GTK_EDITABLE(cmd_input), 0, -1);
char *text, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(cmd_input), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
sts = wdanav->set_attr_value( input_node,
input_name, text);
g_free( text);
......@@ -370,7 +379,7 @@ void WdaGtk::change_value_close()
void WdaGtk::activate_cmd_input( GtkWidget *w, gpointer data)
{
char *text;
char *text, *textutf8;
WdaGtk *wda = (WdaGtk *)data;
int sts;
......@@ -379,7 +388,10 @@ void WdaGtk::activate_cmd_input( GtkWidget *w, gpointer data)
wda->wdanav->set_inputfocus();
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
if ( wda->input_open) {
sts = wda->wdanav->set_attr_value( wda->input_node,
wda->input_name, text);
......
/*
* Proview $Id: wb_wtt_gtk.cpp,v 1.8 2007-02-05 09:34:37 claes Exp $
* Proview $Id: wb_wtt_gtk.cpp,v 1.9 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1183,9 +1183,12 @@ void WttGtk::valchanged_cmd_input( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
int sts;
char *text;
char *text, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
if ( wtt->input_open) {
switch( wtt->input_mode) {
case wtt_eInputMode_Attribute:
......@@ -1228,10 +1231,13 @@ void WttGtk::valchanged_cmd_input( GtkWidget *w, gpointer data)
void WttGtk::activate_india_ok( GtkWidget *w, gpointer data)
{
Wtt *wtt = (Wtt *)data;
char *text;
char *text, *textutf8;
text = gtk_editable_get_chars( GTK_EDITABLE(((WttGtk *)wtt)->india_text),
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((WttGtk *)wtt)->india_text),
0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
g_object_set( ((WttGtk *)wtt)->india_widget, "visible", FALSE, NULL);
(wtt->india_ok_cb)( wtt, text);
......
/*
* Proview $Id: rt_xtt_gtk.cpp,v 1.5 2007-01-17 10:33:55 claes Exp $
* Proview $Id: rt_xtt_gtk.cpp,v 1.6 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -400,10 +400,13 @@ void XttGtk::activate_back( GtkWidget *w, gpointer data)
void XttGtk::activate_india_ok( GtkWidget *w, gpointer data)
{
Xtt *xtt = (Xtt *)data;
char *text;
char *text, *textutf8;
text = gtk_editable_get_chars( GTK_EDITABLE(((XttGtk *)xtt)->india_text),
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((XttGtk *)xtt)->india_text),
0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
g_object_set( ((XttGtk *)xtt)->india_widget, "visible", FALSE, NULL);
(xtt->india_ok_cb)( xtt, text);
......@@ -435,9 +438,12 @@ void XttGtk::valchanged_cmd_input( GtkWidget *w, gpointer data)
{
Xtt *xtt = (Xtt *)data;
int sts;
char *text;
char *text, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
if ( xtt->input_open) {
sts = xtt->xnav->set_attr_value( text);
g_object_set( w, "visible", FALSE, NULL);
......
/*
* Proview $Id: ge_attr_gtk.cpp,v 1.2 2007-01-12 07:58:06 claes Exp $
* Proview $Id: ge_attr_gtk.cpp,v 1.3 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -207,7 +207,7 @@ static gboolean attr_focus_in_event( GtkWidget *w, GdkEvent *event, gpointer dat
static void attr_activate_cmd_input( GtkWidget *w, gpointer data)
{
char *text;
char *text, *textutf8;
AttrGtk *attr = (AttrGtk *)data;
int sts;
......@@ -216,7 +216,9 @@ static void attr_activate_cmd_input( GtkWidget *w, gpointer data)
attr->attrnav->set_inputfocus();
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
if ( attr->input_open) {
sts = ((AttrNav *)attr->attrnav)->set_attr_value( text);
g_object_set( w, "visible", FALSE, NULL);
......@@ -232,7 +234,7 @@ static void attr_activate_cmd_input( GtkWidget *w, gpointer data)
static void attr_activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
{
AttrGtk *attr = (AttrGtk *)data;
gchar *text;
gchar *text, *textutf8;
int sts;
if ( attr->input_open) {
......@@ -240,8 +242,10 @@ static void attr_activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
gtk_text_buffer_get_start_iter( attr->cmd_scrolled_buffer, &start_iter);
gtk_text_buffer_get_end_iter( attr->cmd_scrolled_buffer, &end_iter);
text = gtk_text_buffer_get_text( attr->cmd_scrolled_buffer, &start_iter, &end_iter,
textutf8 = gtk_text_buffer_get_text( attr->cmd_scrolled_buffer, &start_iter, &end_iter,
FALSE);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
sts = attr->attrnav->set_attr_value( text);
g_object_set( attr->cmd_scrolledinput, "visible", FALSE, NULL);
......
/*
* Proview $Id: ge_gtk.cpp,v 1.7 2007-02-06 07:30:35 claes Exp $
* Proview $Id: ge_gtk.cpp,v 1.8 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1130,9 +1130,12 @@ void GeGtk::activate_help(GtkWidget *w, gpointer gectx)
void GeGtk::activate_india_ok(GtkWidget *w, gpointer gectx)
{
char *text;
char *text, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((GeGtk *)gectx)->india_text), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
text = gtk_editable_get_chars( GTK_EDITABLE(((GeGtk *)gectx)->india_text), 0, -1);
g_object_set( ((GeGtk *)gectx)->india_widget, "visible", FALSE, NULL);
((Ge *)gectx)->activate_india_ok( text);
g_free( text);
......@@ -1171,9 +1174,11 @@ void GeGtk::valchanged_cmd_input( GtkWidget *w, gpointer data)
{
GeGtk *gectx = (GeGtk *)data;
int sts;
char *text;
char *text, *textutf8;
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
if ( gectx->text_input_open) {
gectx->graph->change_text( gectx->current_text_object, text);
......
/*
* Proview $Id: xtt_xatt_gtk.cpp,v 1.2 2007-01-11 11:40:31 claes Exp $
* Proview $Id: xtt_xatt_gtk.cpp,v 1.3 2007-02-06 10:06:41 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -284,13 +284,15 @@ void XAttGtk::change_value_close()
if ( input_open) {
if ( input_multiline) {
gchar *text;
gchar *text, *textutf8;
GtkTextIter start_iter, end_iter;
gtk_text_buffer_get_start_iter( cmd_scrolled_buffer, &start_iter);
gtk_text_buffer_get_end_iter( cmd_scrolled_buffer, &end_iter);
text = gtk_text_buffer_get_text( cmd_scrolled_buffer, &start_iter, &end_iter,
textutf8 = gtk_text_buffer_get_text( cmd_scrolled_buffer, &start_iter, &end_iter,
FALSE);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
sts = xattnav->set_attr_value( input_node,
input_name, text);
......@@ -307,8 +309,12 @@ void XAttGtk::change_value_close()
xattnav->set_inputfocus();
}
else {
char *text;
text = gtk_editable_get_chars( GTK_EDITABLE(cmd_input), 0, -1);
char *text, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(cmd_input), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
sts = xattnav->set_attr_value( input_node,
input_name, text);
g_free( text);
......@@ -325,7 +331,7 @@ void XAttGtk::change_value_close()
void XAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
{
char *text;
char *text, *textutf8;
XAttGtk *xatt = (XAttGtk *)data;
int sts;
......@@ -334,7 +340,10 @@ void XAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
xatt->xattnav->set_inputfocus();
text = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(w), 0, -1);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
if ( xatt->input_open) {
sts = xatt->xattnav->set_attr_value( xatt->input_node,
xatt->input_name, text);
......@@ -350,7 +359,7 @@ void XAttGtk::activate_cmd_input( GtkWidget *w, gpointer data)
void XAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
{
XAttGtk *xatt = (XAttGtk *)data;
gchar *text;
gchar *text, *textutf8;
int sts;
if ( xatt->input_open) {
......@@ -358,8 +367,10 @@ void XAttGtk::activate_cmd_scrolled_ok( GtkWidget *w, gpointer data)
gtk_text_buffer_get_start_iter( xatt->cmd_scrolled_buffer, &start_iter);
gtk_text_buffer_get_end_iter( xatt->cmd_scrolled_buffer, &end_iter);
text = gtk_text_buffer_get_text( xatt->cmd_scrolled_buffer, &start_iter, &end_iter,
textutf8 = gtk_text_buffer_get_text( xatt->cmd_scrolled_buffer, &start_iter, &end_iter,
FALSE);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
sts = xatt->xattnav->set_attr_value( xatt->input_node,
xatt->input_name, text);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment