Commit 61bed774 authored by Claes Sjofors's avatar Claes Sjofors

Wb spreadsheet editor, select objects from name with wildcard search pattern added

parent 5aa19d94
......@@ -5724,25 +5724,26 @@ The Spreadsheet Editor is opened from the configurator: 'Functions/Spreadsheet'
If the configurator is in edit mode, the Spreadsheet Editor is also opened in edit mode.
When the spreadsheet editor is started, you first have to state which objects are to be
displayed, i.e. which class they belong to and under which hierarchy the are placed. This
is done by activating 'File/Select Class' in the menu. Enter class, hierarchy and state if
attribute objects, i.e. objects that reside as attributes in other objects, are to be displayed.
displayed, i.e. which class they belong to and under which hierarchy the are placed.This
is done by activating 'File/Select Class' in the menu. Enter class, hierarchy and state
if attribute objects, i.e. objects that reside as attributes in other objects, are to be
displayed. It's also possible to select objects by name with a wildcard search pattern.
<b>Choose class and hierarchy
<image>dg_fig33.gif
<image>dg_fig33.png
After this you choose which attribute is to be displayed. Select an attribute in the attribute
list and click on 'Ok', or doubleclick on an attribute.
<b>Choose attribute
<image>dg_fig34.gif
<image>dg_fig34.png
The result is shown in the figure below. Here, the attribute 'Description' was chosen. You
can easily view the other attributes in the object by activating 'File/Next Attribute'
(Ctrl/N) and 'File/Previous Attribute' in the menu.
<b>Spreadsheet Editor
<image>dg_fig35.gif
<image>dg_fig35.png
<h2>Menu
File/Select Class <t><t>State class and hierarchy for the objects that are to be displayed.
......
......@@ -5672,25 +5672,26 @@ Spreadsheet editorn startas fr
Om konfiguratören är i editeringsmod, startas även spreadsheet editorn in editeringsmod.
När spreadsheet editorn är startad, måste man först ange vilka objekt som ska visas: vilken
klass de tillhör och under vilken hierarki de ska ligga. Det här görs genom att aktivera
'File/Select Class' i menyn. Mata in klass, hieraki, samt ange om attributobjekt, dvs objekt
som ligger som attribut i andra objekt, ska vara med.
klass de tillhör och under vilken hierarki de ska ligga. Det här görs genom att aktivera
'File/Select Class' i menyn. Mata in klass, hierarki, samt ange om attributobjekt, dvs objekt
som ligger som attribut i andra objekt, ska vara med. Man kan även välja objekt efter namn med
en wildcard-sträng.
<b>Välja klass och hierarki
<image>dg_fig33.gif
<image>dg_fig33.png
Därefter väljer man vilket attribut som ska visas. Välj ut ett attribut i attributlistan
och klicka på 'Ok', eller dubbelklicka på ett attribut.
<b>Välja attribut
<image>dg_fig34.gif
<image>dg_fig34.png
Resultatet visas i figuren nedan. Här valdes attributet 'Description'. Man kan enkelt se
övriga attribut i objekten genom att aktivera 'File/Next Attribute' (Ctrl/N) och
'File/Previous Attribute' i menyn.
<b>Spreadsheet editorn
<image>dg_fig35.gif
<image>dg_fig35.png
<h2>Meny
File/Select Class <t><t>ange klass och hierarki för de objekt som ska visas.
......
......@@ -256,6 +256,7 @@ void WdaGtk::class_activate_ok( GtkWidget *w, gpointer data)
WdaGtk *wda = (WdaGtk *)data;
char *hiername;
char *classname;
char *searchname;
char *utf8;
int sts;
pwr_tClassId new_classid;
......@@ -263,6 +264,9 @@ void WdaGtk::class_activate_ok( GtkWidget *w, gpointer data)
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_namevalue), 0, -1);
searchname = 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);
......@@ -279,10 +283,12 @@ void WdaGtk::class_activate_ok( GtkWidget *w, gpointer data)
return;
}
}
strncpy( wda->search_name, searchname, sizeof(wda->search_name));
sts = ldh_ClassNameToId( wda->ldhses, &new_classid, classname);
g_free( classname);
g_free( hiername);
g_free( searchname);
if ( EVEN(sts)) {
CoWowGtk ww(wda->wdaclass_dia);
ww.DisplayError( "Class error", wnav_get_message( sts));
......@@ -299,7 +305,7 @@ void WdaGtk::class_activate_ok( GtkWidget *w, gpointer data)
else {
// Find new attributes
sts = ((WdaNav *)wda->wdanav)->update( wda->objid, wda->classid,
wda->attribute, wda->attrobjects);
wda->attribute, wda->attrobjects, wda->search_name);
if ( EVEN(sts)) {
CoWowGtk ww(wda->wdaclass_dia);
ww.DisplayError( "Spreadsheet error", wnav_get_message( sts));
......@@ -496,7 +502,7 @@ void WdaGtk::pop()
gtk_window_present( GTK_WINDOW(toplevel));
}
void WdaGtk::open_class_dialog( char *hierstr, char *classstr)
void WdaGtk::open_class_dialog( char *hierstr, char *classstr, char *namestr)
{
gint pos = 0;
gtk_editable_delete_text( GTK_EDITABLE(wdaclass_hiervalue), 0, -1);
......@@ -504,6 +510,9 @@ void WdaGtk::open_class_dialog( char *hierstr, char *classstr)
pos = 0;
gtk_editable_delete_text( GTK_EDITABLE(wdaclass_classvalue), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(wdaclass_classvalue), classstr, strlen(classstr), &pos);
pos = 0;
gtk_editable_delete_text( GTK_EDITABLE(wdaclass_namevalue), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(wdaclass_namevalue), namestr, strlen(namestr), &pos);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(wdaclass_attrobjects),
attrobjects ? TRUE : FALSE);
g_object_set( wdaclass_dia, "visible", TRUE, NULL);
......@@ -771,6 +780,10 @@ void WdaGtk::create_class_dialog()
GtkWidget *hier_label = gtk_label_new("Hierarchy");
gtk_widget_set_size_request( hier_label, 95, -1);
gtk_misc_set_alignment( GTK_MISC(hier_label), 0, 0.5);
wdaclass_namevalue = gtk_entry_new();
GtkWidget *name_label = gtk_label_new("Name");
gtk_widget_set_size_request( name_label, 95, -1);
gtk_misc_set_alignment( GTK_MISC(name_label), 0, 0.5);
wdaclass_attrobjects = gtk_check_button_new_with_label( "Attribute Objects");
GtkWidget *india_hboxclass = gtk_hbox_new( FALSE, 0);
......@@ -781,6 +794,10 @@ void WdaGtk::create_class_dialog()
gtk_box_pack_start( GTK_BOX(india_hboxhier), hier_label, FALSE, FALSE, 15);
gtk_box_pack_end( GTK_BOX(india_hboxhier), wdaclass_hiervalue, TRUE, TRUE, 30);
GtkWidget *india_hboxname = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(india_hboxname), name_label, FALSE, FALSE, 15);
gtk_box_pack_end( GTK_BOX(india_hboxname), wdaclass_namevalue, TRUE, TRUE, 30);
GtkWidget *india_hboxattrobj = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(india_hboxattrobj), wdaclass_attrobjects, FALSE, FALSE, 150);
......@@ -800,6 +817,7 @@ void WdaGtk::create_class_dialog()
GtkWidget *india_vbox = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(india_vbox), india_hboxclass, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(india_vbox), india_hboxhier, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(india_vbox), india_hboxname, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(india_vbox), india_hboxattrobj, TRUE, TRUE, 15);
gtk_box_pack_start( GTK_BOX(india_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
gtk_box_pack_end( GTK_BOX(india_vbox), india_hboxbuttons, FALSE, FALSE, 15);
......@@ -807,4 +825,4 @@ void WdaGtk::create_class_dialog()
gtk_widget_show_all( wdaclass_dia);
g_object_set( wdaclass_dia, "visible", FALSE, NULL);
}
\ No newline at end of file
......@@ -75,6 +75,7 @@ class WdaGtk : public Wda {
GtkWidget *pane;
GtkWidget *wdaclass_dia;
GtkWidget *wdaclass_hiervalue;
GtkWidget *wdaclass_namevalue;
GtkWidget *wdaclass_classvalue;
GtkWidget *wdaclass_attrobjects;
GtkWidget *wdaattr_dia;
......@@ -87,7 +88,7 @@ class WdaGtk : public Wda {
void change_value( int set_focus);
void change_value_close();
void pop();
void open_class_dialog( char *hierstr, char *classstr);
void open_class_dialog( char *hierstr, char *classstr, char *namestr);
void create_class_dialog();
void print( const char *title);
void update_title();
......@@ -113,4 +114,4 @@ class WdaGtk : public Wda {
};
#endif
\ No newline at end of file
#endif
......@@ -186,7 +186,7 @@ void Wda::open_class_dialog()
else
strcpy( classstr, "");
open_class_dialog( hierstr, classstr);
open_class_dialog( hierstr, classstr, search_name);
}
void Wda::open_attr_dialog()
......@@ -283,7 +283,7 @@ int Wda::next_attr()
get_next = 1;
else if ( get_next) {
strcpy( attribute, bodydef[j].ParName);
sts = ((WdaNav *)wdanav)->update( objid, classid, attribute, attrobjects);
sts = ((WdaNav *)wdanav)->update( objid, classid, attribute, attrobjects, search_name);
free((char *) bodydef);
return WDA__SUCCESS;
}
......@@ -332,7 +332,7 @@ int Wda::prev_attr()
}
else {
strcpy( attribute, prev_attr);
sts = ((WdaNav *)wdanav)->update( objid, classid, attribute, attrobjects);
sts = ((WdaNav *)wdanav)->update( objid, classid, attribute, attrobjects, search_name);
free((char *) bodydef);
return WDA__SUCCESS;
}
......@@ -344,7 +344,7 @@ int Wda::prev_attr()
if ( get_last && strcmp( prev_attr, "") != 0) {
strcpy( attribute, prev_attr);
sts = ((WdaNav *)wdanav)->update( objid, classid, attribute, attrobjects);
sts = ((WdaNav *)wdanav)->update( objid, classid, attribute, attrobjects, search_name);
return WDA__SUCCESS;
}
return WDA__NOPREVATTR;
......@@ -357,7 +357,7 @@ void Wda::set_attr_cb( void *ctx, char *text, int ok_pressed)
strcpy( wda->attribute, text);
sts = ((WdaNav *)wda->wdanav)->update( wda->objid, wda->classid,
wda->attribute, wda->attrobjects);
wda->attribute, wda->attrobjects, wda->search_name);
if ( EVEN(sts))
wda->wow->DisplayError("Spreadsheet error", wnav_get_message( sts));
}
......@@ -381,6 +381,7 @@ Wda::Wda(
input_open(0), input_multiline(0),
close_cb(0), redraw_cb(0), client_data(0),
attrobjects(0)
{
strcpy( attribute, wa_attribute);
}
\ No newline at end of file
{
strcpy( attribute, wa_attribute);
strcpy( search_name, "");
}
......@@ -77,6 +77,7 @@ class Wda {
char attribute[80];
int editmode;
char name[80];
char search_name[80];
WdaNav *wdanav;
void *root_item;
int input_open;
......@@ -94,7 +95,7 @@ class Wda {
virtual void message( char severity, const char *message) {}
virtual void set_prompt( const char *prompt) {}
virtual void open_class_dialog( char *hierstr, char *classstr) {}
virtual void open_class_dialog( char *hierstr, char *classstr, char *namestr) {}
virtual void change_value( int set_focus) {}
virtual void change_value_close() {}
virtual void pop() {}
......@@ -121,4 +122,4 @@ class Wda {
};
#endif
\ No newline at end of file
#endif
......@@ -655,6 +655,8 @@ int WdaNav::get_attr()
int elements;
int found;
pwr_tClassId classid_vect[2];
char name[80];
char *namep = name;
if ( classid == 0)
return WDA__SUCCESS;
......@@ -709,15 +711,20 @@ int WdaNav::get_attr()
elements = bodydef[j].Par->Output.Info.Elements;
if ( strcmp( search_name, "") != 0)
cdh_ToUpper( name, search_name);
else
namep = 0;
classid_vect[0] = classid;
classid_vect[1] = 0;
if ( !attrobjects) {
trv_get_objects_hcn( ldhses, objid, classid_vect, NULL, wdanav_attr_found_cb,
trv_get_objects_hcn( ldhses, objid, classid_vect, namep, wdanav_attr_found_cb,
(void *)this, (void *) &bodydef[j], (void *) body,
NULL, NULL);
}
else {
trv_get_attrobjects( ldhses, objid, classid_vect, NULL, trv_eDepth_Deep,
trv_get_attrobjects( ldhses, objid, classid_vect, namep, trv_eDepth_Deep,
wdanav_attr_found_cb, (void *)this, (void *) &bodydef[j],
(void *) body, NULL, NULL);
}
......@@ -871,7 +878,7 @@ int WdaNav::find_by_objid( pwr_tObjid oi, brow_tObject *object)
}
int WdaNav::update( pwr_tObjid new_objid, pwr_tClassId new_classid,
char *new_attribute, int new_attrobjects)
char *new_attribute, int new_attrobjects, char *new_search_name)
{
int sts;
int keep_select;
......@@ -884,6 +891,7 @@ int WdaNav::update( pwr_tObjid new_objid, pwr_tClassId new_classid,
if ( cdh_ObjidIsEqual( objid, new_objid) &&
classid == new_classid &&
strcmp( attribute, new_attribute) == 0 &&
strcmp( search_name, new_search_name) == 0 &&
attrobjects == new_attrobjects)
return WDA__SUCCESS;
......@@ -909,6 +917,7 @@ int WdaNav::update( pwr_tObjid new_objid, pwr_tClassId new_classid,
classid = new_classid;
strcpy( attribute, new_attribute);
attrobjects = new_attrobjects;
strcpy( search_name, new_search_name);
brow_SetNodraw( brow->ctx);
brow_DeleteAll( brow->ctx);
......@@ -1334,4 +1343,4 @@ int WdaNav::import_textfile( char *filename)
brow_Redraw( brow->ctx, 0);
return status;
}
\ No newline at end of file
}
......@@ -87,6 +87,7 @@ class WdaNav {
pwr_tObjid objid;
pwr_tClassId classid;
char attribute[80];
char search_name[80];
int editmode;
int advanced_user;
int display_objectname;
......@@ -115,7 +116,7 @@ class WdaNav {
{ this->editmode = editmode; this->ldhses = ldhses;};
int select_by_name( char *name);
int update( pwr_tObjid new_objid, pwr_tClassId new_classid,
char *new_attribute, int new_attrobjects);
char *new_attribute, int new_attrobjects, char *new_search_name);
int find_by_objid( pwr_tObjid oi, brow_tObject *object);
int print( char *filename);
int print_textfile( char *filename);
......@@ -130,4 +131,4 @@ class WdaNav {
#if defined __cplusplus
}
#endif
#endif
\ No newline at end of file
#endif
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